git: c0c42c689acc - stable/13 - netlink: add userland name mappings to all NETLINK_ROUTE messages.

From: Alexander V. Chernikov <melifaro_at_FreeBSD.org>
Date: Sat, 08 Apr 2023 19:44:44 UTC
The branch stable/13 has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=c0c42c689acc76ccad72edbb316ca7dc2e326246

commit c0c42c689acc76ccad72edbb316ca7dc2e326246
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-03-01 15:22:21 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-04-08 19:03:13 +0000

    netlink: add userland name mappings to all NETLINK_ROUTE messages.
    
    MFC after:      1 day
    
    (cherry picked from commit e6b4177c478da54e25db464ae60ddae9e890c2cb)
---
 sys/netlink/route/common.h | 78 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 62 insertions(+), 16 deletions(-)

diff --git a/sys/netlink/route/common.h b/sys/netlink/route/common.h
index 1bfb888b34c0..1f1d98dc4384 100644
--- a/sys/netlink/route/common.h
+++ b/sys/netlink/route/common.h
@@ -97,23 +97,64 @@ enum {
  * Use NL_RTM_ prefix in the kernel and map it to RTM_
  * for userland.
  */
-#define RTM_BASE	NL_RTM_BASE
-#define RTM_NEWLINK 	NL_RTM_NEWLINK
-#define RTM_DELLINK 	NL_RTM_DELLINK
-#define RTM_GETLINK 	NL_RTM_GETLINK
-#define RTM_SETLINK 	NL_RTM_SETLINK
-#define RTM_NEWADDR	NL_RTM_NEWADDR
-#define RTM_DELADDR	NL_RTM_DELADDR
-#define RTM_GETADDR 	NL_RTM_GETADDR
-#define RTM_NEWROUTE 	NL_RTM_NEWROUTE
-#define RTM_DELROUTE 	NL_RTM_DELROUTE
-#define RTM_GETROUTE 	NL_RTM_GETROUTE
-#define	RTM_NEWNEXTHOP	NL_RTM_NEWNEXTHOP
-#define	RTM_DELNEXTHOP	NL_RTM_DELNEXTHOP
-#define	RTM_GETNEXTHOP	NL_RTM_GETNEXTHOP
-#endif
+#define RTM_BASE		NL_RTM_BASE
+#define RTM_NEWLINK		NL_RTM_NEWLINK
+#define RTM_DELLINK		NL_RTM_DELLINK
+#define RTM_GETLINK		NL_RTM_GETLINK
+#define RTM_SETLINK		NL_RTM_SETLINK
+#define RTM_NEWADDR		NL_RTM_NEWADDR
+#define RTM_DELADDR		NL_RTM_DELADDR
+#define RTM_GETADDR		NL_RTM_GETADDR
+#define RTM_NEWROUTE		NL_RTM_NEWROUTE
+#define RTM_DELROUTE		NL_RTM_DELROUTE
+#define RTM_GETROUTE		NL_RTM_GETROUTE
+#define RTM_NEWNEIGH		NL_RTM_NEWNEIGH
+#define RTM_DELNEIGH		NL_RTM_DELNEIGH
+#define RTM_GETNEIGH		NL_RTM_GETNEIGH
+#define RTM_NEWRULE		NL_RTM_NEWRULE
+#define RTM_DELRULE		NL_RTM_DELRULE
+#define RTM_GETRULE		NL_RTM_GETRULE
+#define RTM_NEWQDISC		NL_RTM_NEWQDISC
+#define RTM_DELQDISC		NL_RTM_DELQDISC
+#define RTM_GETQDISC		NL_RTM_GETQDISC
+#define RTM_NEWTCLASS		NL_RTM_NEWTCLASS
+#define RTM_DELTCLASS		NL_RTM_DELTCLASS
+#define RTM_GETTCLASS		NL_RTM_GETTCLASS
+#define RTM_NEWTFILTER		NL_RTM_NEWTFILTER
+#define RTM_DELTFILTER		NL_RTM_DELTFILTER
+#define RTM_GETTFILTER		NL_RTM_GETTFILTER
+#define RTM_NEWACTION		NL_RTM_NEWACTION
+#define RTM_DELACTION		NL_RTM_DELACTION
+#define RTM_GETACTION		NL_RTM_GETACTION
+#define RTM_NEWPREFIX		NL_RTM_NEWPREFIX
+#define RTM_GETMULTICAST	NL_RTM_GETMULTICAST
+#define RTM_GETANYCAST		NL_RTM_GETANYCAST
+#define RTM_NEWNEIGHTBL		NL_RTM_NEWNEIGHTBL
+#define RTM_GETNEIGHTBL		NL_RTM_GETNEIGHTBL
+#define RTM_SETNEIGHTBL		NL_RTM_SETNEIGHTBL
+#define RTM_NEWNDUSEROPT	NL_RTM_NEWNDUSEROPT
+#define RTM_NEWADDRLABEL	NL_RTM_NEWADDRLABEL
+#define RTM_DELADDRLABEL	NL_RTM_DELADDRLABEL
+#define RTM_GETADDRLABEL	NL_RTM_GETADDRLABEL
+#define RTM_GETDCB		NL_RTM_GETDCB
+#define RTM_SETDCB		NL_RTM_SETDCB
+#define RTM_NEWNETCONF		NL_RTM_NEWNETCONF
+#define RTM_GETNETCONF		NL_RTM_GETNETCONF
+#define RTM_NEWMDB		NL_RTM_NEWMDB
+#define RTM_DELMDB		NL_RTM_DELMDB
+#define RTM_GETMDB		NL_RTM_GETMDB
+#define RTM_NEWNSID		NL_RTM_NEWNSID
+#define RTM_DELNSID		NL_RTM_DELNSID
+#define RTM_GETNSID		NL_RTM_GETNSID
+#define RTM_NEWSTATS		NL_RTM_NEWSTATS
+#define RTM_GETSTATS		NL_RTM_GETSTATS
+#define RTM_NEWNEXTHOP		NL_RTM_NEWNEXTHOP
+#define RTM_DELNEXTHOP		NL_RTM_DELNEXTHOP
+#define RTM_GETNEXTHOP		NL_RTM_GETNEXTHOP
+#define __RTM_MAX		__NL_RTM_MAX
+
+#define RTM_MAX			(roundup2(__RTM_MAX, 4))
 
-#ifndef _KERNEL
 /* rtnetlink multicast groups - backwards compatibility for userspace */
 #define RTMGRP_LINK		0x01
 #define RTMGRP_NOTIFY		0x02
@@ -209,5 +250,10 @@ enum rtnetlink_groups {
 #define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
 
 
+/* Defined NETLINK_ROUTE virtual multicast address families */
+#define RTNL_FAMILY_IPMR		128 /* Not supported */
+#define RTNL_FAMILY_IP6MR		129 /* Not supported */
+#define RTNL_FAMILY_MAX			129
+
 #endif