Patchwork [PING] Add missing ICMPv6 flags and options

login
register
mail settings
Submitter Dan Lüdtke
Date March 18, 2014, 1:05 p.m.
Message ID <CAAfuxnLgZGW8U2Je7KXMw2zkoirXevKbTCny4YGRrkSd8Kn4Qg@mail.gmail.com>
Download mbox | patch
Permalink /patch/143/
State New
Headers show

Comments

Dan Lüdtke - March 18, 2014, 1:05 p.m.
As already discussed in:
Message-Id: <1392230153-23499-1-git-send-email-danrl@danrl.de>
Message-Id: <1392240088-6992-1-git-send-email-danrl@danrl.de>

---
 ChangeLog            | 24 ++++++++++++++++++++++++
 inet/netinet/icmp6.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

   {
@@ -231,6 +242,45 @@ struct nd_opt_mtu             /* MTU option */
     uint32_t  nd_opt_mtu_mtu;
   };

+#define ND_OPT_RI_RTPREF_LOW    0x18
+#define ND_OPT_RI_RTPREF_MEDIUM 0x00
+#define ND_OPT_RI_RTPREF_HIGH   0x08
+#define ND_OPT_RI_RTPREF_MASK   0x18
+#define ND_OPT_RI_RTPREF_RSV    0x10
+
+struct nd_opt_route_info      /* route information option */
+  {
+    uint8_t   nd_opt_ri_type;
+    uint8_t   nd_opt_ri_len;
+    uint8_t   nd_opt_ri_prefix_len;
+    uint8_t   nd_opt_ri_pref_reserved;
+    uint32_t  nd_opt_ri_lifetime;
+    /* followed by prefixes */
+  };
+
+struct nd_opt_rdnss           /* RDNSS option */
+  {
+    uint8_t   nd_opt_rdnss_type;
+    uint8_t   nd_opt_rdnss_len;
+    uint16_t  nd_opt_rdnss_reserved;
+    uint32_t  nd_opt_rdnss_lifetime;
+    /* followed by recursive DNS servers */
+  };
+
+#define ND_OPT_AR_STATUS_SUCCESS   0x00
+#define ND_OPT_AR_STATUS_DUPLICATE 0x01
+#define ND_OPT_AR_STATUS_CACHEFULL 0x02
+
+struct nd_opt_address_reg     /* address registration option */
+  {
+    uint8_t   nd_opt_ar_type;
+    uint8_t   nd_opt_ar_len;
+    uint8_t   nd_opt_ar_status;
+    uint8_t   nd_opt_ar_reserved1;
+    uint16_t  nd_opt_ar_reserved2;
+    uint64_t  nd_opt_ar_eui64;
+  };
+
 struct mld_hdr
   {
     struct icmp6_hdr    mld_icmp6_hdr;

--
1.9.0

Patch

diff --git a/ChangeLog b/ChangeLog
index 45eb5ab..9c12a74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@ 
+2014-03-01  Dan Luedtke  <mail@danrl.de>
+
+       * inet/netinet/icmp6.h (ND_RA_FLAG_RTPREF_LOW): Define.
+       (ND_RA_FLAG_RTPREF_MEDIUM): Likewise.
+       (ND_RA_FLAG_RTPREF_HIGH): Likewise.
+       (ND_RA_FLAG_RTPREF_MASK): Likewise.
+       (ND_RA_FLAG_RTPREF_RSV): Likewise.
+       (ND_RA_FLAG_PROXY): Likewise.
+       (ND_RA_FLAG_HA): Likewise.
+       (ND_OPT_ROUTE_INFO): Likewise.
+       (ND_OPT_RDNSS): Likewise.
+       (ND_OPT_ADDRESS_REGISTRATION): Likewise.
+       (ND_OPT_RI_RTPREF_LOW): Likewise.
+       (ND_OPT_RI_RTPREF_MEDIUM): Likewise.
+       (ND_OPT_RI_RTPREF_HIGH): Likewise.
+       (ND_OPT_RI_RTPREF_MASK): Likewise.
+       (ND_OPT_RI_RTPREF_RSV): Likewise.
+       (ND_OPT_AR_STATUS_SUCCESS): Likewise.
+       (ND_OPT_AR_STATUS_DUPLICATE): Likewise.
+       (ND_OPT_AR_STATUS_CACHEFULL): Likewise.
+       (nd_opt_route_info): New structure.
+       (nd_opt_rdnss): Likewise.
+       (nd_opt_address_reg): Likewise.
+
 2014-02-28  Ondřej Bílka  <neleai@seznam.cz>

        * benchtest/bench-strtok.c (simple_strtok): Delete.
diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h
index baaeb26..86e45b2 100644
--- a/inet/netinet/icmp6.h
+++ b/inet/netinet/icmp6.h
@@ -135,6 +135,14 @@  struct nd_router_advert       /* router advertisement */
 #define ND_RA_FLAG_MANAGED       0x80
 #define ND_RA_FLAG_OTHER         0x40
 #define ND_RA_FLAG_HOME_AGENT    0x20
+/* For compatibility with BSD.  */
+#define ND_RA_FLAG_HA           ND_RA_FLAG_HOME_AGENT
+#define ND_RA_FLAG_RTPREF_LOW    0x18
+#define ND_RA_FLAG_RTPREF_MEDIUM 0x00
+#define ND_RA_FLAG_RTPREF_HIGH   0x08
+#define ND_RA_FLAG_RTPREF_MASK   0x18
+#define ND_RA_FLAG_RTPREF_RSV    0x10
+#define ND_RA_FLAG_PROXY         0x04
 #define nd_ra_router_lifetime    nd_ra_hdr.icmp6_data16[1]

 struct nd_neighbor_solicit    /* neighbor solicitation */
@@ -197,6 +205,9 @@  struct nd_opt_hdr             /* Neighbor
discovery option header */
 #define ND_OPT_MTU                     5
 #define ND_OPT_RTR_ADV_INTERVAL                7
 #define ND_OPT_HOME_AGENT_INFO         8
+#define ND_OPT_ROUTE_INFO              24
+#define ND_OPT_RDNSS                   25
+#define ND_OPT_ADDRESS_REGISTRATION    33

 struct nd_opt_prefix_info     /* prefix information */