]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove the custom SixRD decode function and replace with a generic
authorRoy Marples <roy@marples.name>
Thu, 10 Sep 2015 08:41:37 +0000 (08:41 +0000)
committerRoy Marples <roy@marples.name>
Thu, 10 Sep 2015 08:41:37 +0000 (08:41 +0000)
definition.
This does mean any 3rd party hook scripts using this will need to be changed.

dhcp-common.c
dhcp-common.h
dhcp.c
dhcp.h
dhcpcd-definitions.conf
if-options.c

index b633988865cfd24cea68fcfdd5363b9f04ef52a3..47bf47d985cde03f135be3a82ce4d1fd28c5ab12 100644 (file)
@@ -103,8 +103,6 @@ dhcp_print_option_encoding(const struct dhcp_opt *opt, int cols)
                printf(" rfc3361");
        if (opt->type & RFC3442)
                printf(" rfc3442");
-       if (opt->type & RFC5969)
-               printf(" rfc5969");
        if (opt->type & REQUEST)
                printf(" request");
        if (opt->type & NOREQ)
@@ -559,7 +557,7 @@ dhcp_optlen(const struct dhcp_opt *opt, size_t dl)
        size_t sz;
 
        if (opt->type == 0 ||
-           opt->type & (STRING | BINHEX | RFC3442 | RFC5969))
+           opt->type & (STRING | BINHEX | RFC3442))
        {
                if (opt->len) {
                        if ((size_t)opt->len > dl)
@@ -639,9 +637,6 @@ print_option(char *s, size_t len, const struct dhcp_opt *opt,
 
        if (opt->type & RFC3442)
                return decode_rfc3442(s, len, data, dl);
-
-       if (opt->type & RFC5969)
-               return decode_rfc5969(s, len, data, dl);
 #endif
 
        if (opt->type & STRING)
index 5a4cfc142506bd17b0d40900207f5b9cf57b533e..3899fc7f3fbf5c6ba002f71139788a7fb10657de 100644 (file)
@@ -52,7 +52,7 @@
 #define RFC3361                (1 << 9)
 #define RFC1035                (1 << 10)
 #define RFC3442                (1 << 11)
-#define RFC5969                (1 << 12)
+/* unassigned          (1 << 12) */
 #define ADDRIPV6       (1 << 13)
 #define BINHEX         (1 << 14)
 #define FLAG           (1 << 15)
diff --git a/dhcp.c b/dhcp.c
index 83053f6193a4d7b36d727df565af6ac7ed015cbd..c4451f92ea032eae83157537619d3a4ac2c1e755 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -480,74 +480,6 @@ decode_rfc3361(const uint8_t *data, size_t dl)
        return sip;
 }
 
-/* Decode an RFC5969 6rd order option into a space
- * separated string. Returns length of string (including
- * terminating zero) or zero on error. */
-ssize_t
-decode_rfc5969(char *out, size_t len, const uint8_t *p, size_t pl)
-{
-       uint8_t ipv4masklen, ipv6prefixlen;
-       uint8_t ipv6prefix[16];
-       uint8_t br[4];
-       int i;
-       ssize_t b, bytes = 0;
-
-       if (pl < 22) {
-               errno = EINVAL;
-               return 0;
-       }
-
-       ipv4masklen = *p++;
-       pl--;
-       ipv6prefixlen = *p++;
-       pl--;
-
-       for (i = 0; i < 16; i++) {
-               ipv6prefix[i] = *p++;
-               pl--;
-       }
-       if (out) {
-               b= snprintf(out, len,
-                   "%d %d "
-                   "%02x%02x:%02x%02x:"
-                   "%02x%02x:%02x%02x:"
-                   "%02x%02x:%02x%02x:"
-                   "%02x%02x:%02x%02x",
-                   ipv4masklen, ipv6prefixlen,
-                   ipv6prefix[0], ipv6prefix[1], ipv6prefix[2], ipv6prefix[3],
-                   ipv6prefix[4], ipv6prefix[5], ipv6prefix[6], ipv6prefix[7],
-                   ipv6prefix[8], ipv6prefix[9], ipv6prefix[10],ipv6prefix[11],
-                   ipv6prefix[12],ipv6prefix[13],ipv6prefix[14], ipv6prefix[15]
-               );
-
-               len -= (size_t)b;
-               out += b;
-               bytes += b;
-       } else {
-               bytes += 16 * 2 + 8 + 2 + 1 + 2;
-       }
-
-       while (pl >= 4) {
-               br[0] = *p++;
-               br[1] = *p++;
-               br[2] = *p++;
-               br[3] = *p++;
-               pl -= 4;
-
-               if (out) {
-                       b= snprintf(out, len, " %d.%d.%d.%d",
-                           br[0], br[1], br[2], br[3]);
-                       len -= (size_t)b;
-                       out += b;
-                       bytes += b;
-               } else {
-                       bytes += (4 * 4);
-               }
-       }
-
-       return bytes;
-}
-
 static char *
 get_option_string(struct dhcpcd_ctx *ctx,
     const struct dhcp_message *dhcp, uint8_t option)
diff --git a/dhcp.h b/dhcp.h
index 4cd242f7be397640a27eeefe1873687931240b12..6bbca2a3ad59a0a9022743aa73768dac42382fad 100644 (file)
--- a/dhcp.h
+++ b/dhcp.h
@@ -237,7 +237,6 @@ struct dhcp_state {
 #ifdef INET
 char *decode_rfc3361(const uint8_t *, size_t);
 ssize_t decode_rfc3442(char *, size_t, const uint8_t *p, size_t);
-ssize_t decode_rfc5969(char *, size_t, const uint8_t *p, size_t);
 
 void dhcp_printoptions(const struct dhcpcd_ctx *,
     const struct dhcp_opt *, size_t);
index 2b695a6e92192e99a30e470a6be1ffe80dc9325d..5c8b6225ec35470b3ee3cd3a63dd8c2e13e033fd 100644 (file)
@@ -270,7 +270,11 @@ define 210 string                  path_prefix
 define 211     uint32                  reboot_time
 
 # DHCP IPv6 Rapid Deployment on IPv4 Infrastructures, RFC5969
-define 212     rfc5969                 sixrd
+define 212     embed                   sixrd
+embed          byte                    mask_len
+embed          byte                    prefix_len
+embed          ip6address              prefix
+embed          array ipaddress         brip_address
 
 # DHCP Access Network Domain Name, RFC5986
 define 213     domain                  access_domain
index 57ccbbadd894a45a46a9fcbd8def66a288f371ae..c03f7d3fe9c551ac99abc8afe2f979a7e7d45e05 100644 (file)
@@ -1658,8 +1658,6 @@ err_sla:
                        t |= STRING | RFC3361;
                else if (strcasecmp(arg, "rfc3442") ==0)
                        t |= STRING | RFC3442;
-               else if (strcasecmp(arg, "rfc5969") == 0)
-                       t |= STRING | RFC5969;
                else if (strcasecmp(arg, "option") == 0)
                        t |= OPTION;
                else {