Skip to content

Commit

Permalink
Add missing rtm_protocol and routing message attributes definitions f…
Browse files Browse the repository at this point in the history
…rom Linux

For rtm_protocol definitions the Linux header file
(include/uapi/linux/rtnetlink.h) has comment:

  Values of protocol >= RTPROT_STATIC are not interpreted by kernel;
  they are just passed from user and back as is.  It will be used by
  hypothetical multiple routing daemons.  Note that protocol values
  should be standardized in order to avoid conflicts.

This commit is based on values from

  https://github.com/torvalds/linux/blob/f0c4d9fc9cc9462659728d168387191387e903cc/include/uapi/linux/rtnetlink.h#L274-L307

and

 https://github.com/torvalds/linux/blob/f0c4d9fc9cc9462659728d168387191387e903cc/include/uapi/linux/rtnetlink.h#L358-L393
  • Loading branch information
oherrala committed Mar 22, 2023
1 parent bac1442 commit 4128937
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 18 deletions.
28 changes: 28 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,18 @@ RTA_MP_ALGO
RTA_TABLE
RTA_MARK
RTA_MFC_STATS
RTA_VIA
RTA_NEWDST
RTA_PREF
RTA_ENCAP_TYPE
RTA_ENCAP
RTA_EXPIRES
RTA_PAD
RTA_UID
RTA_TTL_PROPAGATE
RTA_IP_PROTO
RTA_SPORT
RTA_DPORT
RTN_UNSPEC
RTN_UNICAST
RTN_LOCAL
Expand All @@ -2015,6 +2027,22 @@ RTPROT_REDIRECT
RTPROT_KERNEL
RTPROT_BOOT
RTPROT_STATIC
RTPROT_GATED
RTPROT_RA
RTPROT_MRT
RTPROT_ZEBRA
RTPROT_BIRD
RTPROT_DNROUTED
RTPROT_XORP
RTPROT_NTK
RTPROT_DHCP
RTPROT_MROUTED
RTPROT_BABEL
RTPROT_BGP
RTPROT_ISIS
RTPROT_OSPF
RTPROT_RIP
RTPROT_EIGRP
RT_SCOPE_UNIVERSE
RT_SCOPE_SITE
RT_SCOPE_LINK
Expand Down
10 changes: 2 additions & 8 deletions libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,6 @@ REG_ERPAREN
REG_ESIZE
REG_STARTEND
REISERFS_SUPER_MAGIC
RTA_NEWDST
RTA_OIF
RTA_PAD
RTA_PREF
RTA_TTL_PROPAGATE
RTA_UID
RTA_UNSPEC
RTA_VIA
RTLD_DEEPBIND
RTLD_DI_CONFIGADDR
RTLD_DI_LINKMAP
Expand All @@ -382,6 +374,8 @@ RTM_F_LOOKUP_TABLE
RTM_GETSTATS
RTM_NEWCACHEREPORT
RTM_NEWSTATS
RTPROT_KEEPALIVED
RTPROT_OPENR
RUN_LVL
RWF_APPEND
RWF_DSYNC
Expand Down
31 changes: 31 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2020,21 +2020,36 @@ RLIM_INFINITY
RLIM_SAVED_CUR
RLIM_SAVED_MAX
RTA_CACHEINFO
RTA_DPORT
RTA_DST
RTA_ENCAP
RTA_ENCAP_TYPE
RTA_EXPIRES
RTA_FLOW
RTA_GATEWAY
RTA_IIF
RTA_IP_PROTO
RTA_MARK
RTA_METRICS
RTA_MFC_STATS
RTA_MP_ALGO
RTA_MULTIPATH
RTA_NEWDST
RTA_NH_ID
RTA_OIF
RTA_PAD
RTA_PREF
RTA_PREFSRC
RTA_PRIORITY
RTA_PROTOINFO
RTA_SESSION
RTA_SPORT
RTA_SRC
RTA_TABLE
RTA_TTL_PROPAGATE
RTA_UID
RTA_UNSPEC
RTA_VIA
RTCF_DIRECTSRC
RTCF_DOREDIRECT
RTCF_LOG
Expand Down Expand Up @@ -2147,11 +2162,27 @@ RTN_UNICAST
RTN_UNREACHABLE
RTN_UNSPEC
RTN_XRESOLVE
RTPROT_BABEL
RTPROT_BGP
RTPROT_BIRD
RTPROT_BOOT
RTPROT_DHCP
RTPROT_DNROUTED
RTPROT_EIGRP
RTPROT_GATED
RTPROT_ISIS
RTPROT_KERNEL
RTPROT_MROUTED
RTPROT_MRT
RTPROT_NTK
RTPROT_OSPF
RTPROT_RA
RTPROT_REDIRECT
RTPROT_RIP
RTPROT_STATIC
RTPROT_UNSPEC
RTPROT_XORP
RTPROT_ZEBRA
RT_ADDRCLASS
RT_CLASS_DEFAULT
RT_CLASS_LOCAL
Expand Down
31 changes: 31 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2953,6 +2953,19 @@ pub const RTA_MP_ALGO: ::c_ushort = 14; // No longer used
pub const RTA_TABLE: ::c_ushort = 15;
pub const RTA_MARK: ::c_ushort = 16;
pub const RTA_MFC_STATS: ::c_ushort = 17;
pub const RTA_VIA: ::c_ushort = 18;
pub const RTA_NEWDST: ::c_ushort = 19;
pub const RTA_PREF: ::c_ushort = 20;
pub const RTA_ENCAP_TYPE: ::c_ushort = 21;
pub const RTA_ENCAP: ::c_ushort = 22;
pub const RTA_EXPIRES: ::c_ushort = 23;
pub const RTA_PAD: ::c_ushort = 24;
pub const RTA_UID: ::c_ushort = 25;
pub const RTA_TTL_PROPAGATE: ::c_ushort = 26;
pub const RTA_IP_PROTO: ::c_ushort = 27;
pub const RTA_SPORT: ::c_ushort = 28;
pub const RTA_DPORT: ::c_ushort = 29;
pub const RTA_NH_ID: ::c_ushort = 30;

pub const RTN_UNSPEC: ::c_uchar = 0;
pub const RTN_UNICAST: ::c_uchar = 1;
Expand All @@ -2972,6 +2985,24 @@ pub const RTPROT_REDIRECT: ::c_uchar = 1;
pub const RTPROT_KERNEL: ::c_uchar = 2;
pub const RTPROT_BOOT: ::c_uchar = 3;
pub const RTPROT_STATIC: ::c_uchar = 4;
pub const RTPROT_GATED: ::c_uchar = 8;
pub const RTPROT_RA: ::c_uchar = 9;
pub const RTPROT_MRT: ::c_uchar = 10;
pub const RTPROT_ZEBRA: ::c_uchar = 11;
pub const RTPROT_BIRD: ::c_uchar = 12;
pub const RTPROT_DNROUTED: ::c_uchar = 13;
pub const RTPROT_XORP: ::c_uchar = 14;
pub const RTPROT_NTK: ::c_uchar = 15;
pub const RTPROT_DHCP: ::c_uchar = 16;
pub const RTPROT_MROUTED: ::c_uchar = 17;
pub const RTPROT_KEEPALIVED: ::c_uchar = 18;
pub const RTPROT_BABEL: ::c_uchar = 42;
pub const RTPROT_OPENR: ::c_uchar = 99;
pub const RTPROT_BGP: ::c_uchar = 186;
pub const RTPROT_ISIS: ::c_uchar = 187;
pub const RTPROT_OSPF: ::c_uchar = 188;
pub const RTPROT_RIP: ::c_uchar = 189;
pub const RTPROT_EIGRP: ::c_uchar = 192;

pub const RT_SCOPE_UNIVERSE: ::c_uchar = 0;
pub const RT_SCOPE_SITE: ::c_uchar = 200;
Expand Down
10 changes: 0 additions & 10 deletions src/unix/linux_like/linux/gnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,16 +882,6 @@ pub const RTM_NEWCACHEREPORT: u16 = 96;
pub const RTM_F_LOOKUP_TABLE: ::c_uint = 0x1000;
pub const RTM_F_FIB_MATCH: ::c_uint = 0x2000;

pub const RTA_VIA: ::c_ushort = 18;
pub const RTA_NEWDST: ::c_ushort = 19;
pub const RTA_PREF: ::c_ushort = 20;
pub const RTA_ENCAP_TYPE: ::c_ushort = 21;
pub const RTA_ENCAP: ::c_ushort = 22;
pub const RTA_EXPIRES: ::c_ushort = 23;
pub const RTA_PAD: ::c_ushort = 24;
pub const RTA_UID: ::c_ushort = 25;
pub const RTA_TTL_PROPAGATE: ::c_ushort = 26;

// linux/neighbor.h
pub const NTF_EXT_LEARNED: u8 = 0x10;
pub const NTF_OFFLOADED: u8 = 0x20;
Expand Down
31 changes: 31 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2994,6 +2994,19 @@ pub const RTA_MP_ALGO: ::c_ushort = 14; // No longer used
pub const RTA_TABLE: ::c_ushort = 15;
pub const RTA_MARK: ::c_ushort = 16;
pub const RTA_MFC_STATS: ::c_ushort = 17;
pub const RTA_VIA: ::c_ushort = 18;
pub const RTA_NEWDST: ::c_ushort = 19;
pub const RTA_PREF: ::c_ushort = 20;
pub const RTA_ENCAP_TYPE: ::c_ushort = 21;
pub const RTA_ENCAP: ::c_ushort = 22;
pub const RTA_EXPIRES: ::c_ushort = 23;
pub const RTA_PAD: ::c_ushort = 24;
pub const RTA_UID: ::c_ushort = 25;
pub const RTA_TTL_PROPAGATE: ::c_ushort = 26;
pub const RTA_IP_PROTO: ::c_ushort = 27;
pub const RTA_SPORT: ::c_ushort = 28;
pub const RTA_DPORT: ::c_ushort = 29;
pub const RTA_NH_ID: ::c_ushort = 30;

pub const RTN_UNSPEC: ::c_uchar = 0;
pub const RTN_UNICAST: ::c_uchar = 1;
Expand All @@ -3013,6 +3026,24 @@ pub const RTPROT_REDIRECT: ::c_uchar = 1;
pub const RTPROT_KERNEL: ::c_uchar = 2;
pub const RTPROT_BOOT: ::c_uchar = 3;
pub const RTPROT_STATIC: ::c_uchar = 4;
pub const RTPROT_GATED: ::c_uchar = 8;
pub const RTPROT_RA: ::c_uchar = 9;
pub const RTPROT_MRT: ::c_uchar = 10;
pub const RTPROT_ZEBRA: ::c_uchar = 11;
pub const RTPROT_BIRD: ::c_uchar = 12;
pub const RTPROT_DNROUTED: ::c_uchar = 13;
pub const RTPROT_XORP: ::c_uchar = 14;
pub const RTPROT_NTK: ::c_uchar = 15;
pub const RTPROT_DHCP: ::c_uchar = 16;
pub const RTPROT_MROUTED: ::c_uchar = 17;
pub const RTPROT_KEEPALIVED: ::c_uchar = 18;
pub const RTPROT_BABEL: ::c_uchar = 42;
pub const RTPROT_OPENR: ::c_uchar = 99;
pub const RTPROT_BGP: ::c_uchar = 186;
pub const RTPROT_ISIS: ::c_uchar = 187;
pub const RTPROT_OSPF: ::c_uchar = 188;
pub const RTPROT_RIP: ::c_uchar = 189;
pub const RTPROT_EIGRP: ::c_uchar = 192;

pub const RT_SCOPE_UNIVERSE: ::c_uchar = 0;
pub const RT_SCOPE_SITE: ::c_uchar = 200;
Expand Down

0 comments on commit 4128937

Please sign in to comment.