]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
decode DHCP options for ADSL vendor forum
authorAlan T. DeKok <aland@freeradius.org>
Thu, 31 May 2018 15:39:58 +0000 (11:39 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 31 May 2018 15:39:58 +0000 (11:39 -0400)
share/dictionary.rfc4679
src/modules/proto_dhcp/dhcp.c

index f5ae46b492f4bc7de1be40a39c1cc985e2cfcaf3..2bc66e59da5538543bd4738f135bb1212b755962 100644 (file)
@@ -15,11 +15,11 @@ BEGIN-VENDOR        ADSL-Forum
 #  Glue attribute to allow decoding of ADSL-Form vendor specific
 #  DHCP options.
 #
-ATTRIBUTE      ADSL-Forum-DHCP-Vendor-Specific         0       tlv
-ATTRIBUTE      ADSL-Forum-Device-Manufacturer-OUI      0.1     octets
-ATTRIBUTE      ADSL-Forum-Device-Serial-Number         0.2     string
-ATTRIBUTE      ADSL-Forum-Device-Product-Class         0.3     string
-ATTRIBUTE      ADSL-Forum-Gateway-Manufacturer-OUI     0.4     octets
+ATTRIBUTE      ADSL-Forum-DHCP-Vendor-Specific         255     tlv
+ATTRIBUTE      ADSL-Forum-Device-Manufacturer-OUI      255.1   octets
+ATTRIBUTE      ADSL-Forum-Device-Serial-Number         255.2   string
+ATTRIBUTE      ADSL-Forum-Device-Product-Class         255.3   string
+ATTRIBUTE      ADSL-Forum-Gateway-Manufacturer-OUI     255.4   octets
 
 #
 #  The first two attributes are prefixed with "ADSL-" because of
index 3b654ed5ea8c108ba30502569a877b301df52ae5..113cb9b805315bf7f1114e476afa45fc78eb81a3 100644 (file)
@@ -920,6 +920,26 @@ ssize_t fr_dhcp_decode_options(TALLOC_CTX *ctx, VALUE_PAIR **out, uint8_t const
                        goto next;
                }
 
+               /*
+                *      Decode ADSL Forum vendor-specific options.
+                */
+               if ((p[0] == 125) && (p[1] > 6) && (p[2] == 0) && (p[3] == 0) && (p[4] == 0x0d) && (p[5] == 0xe9) &&
+                   (p[6] + 5 == p[1])) {
+                       da = dict_attrbyvalue(255, 0x0de9);
+                       if (!da) goto normal;
+
+                       vp = fr_pair_afrom_da(ctx, da);
+                       if (!vp) {
+                               fr_pair_list_free(out);
+                               return -1;
+                       }
+
+                       (void) fr_dhcp_decode_suboption(ctx, &vp, p + 7, p[6]);
+                       if (vp) fr_cursor_merge(&cursor, vp);
+                       goto next;
+               }
+
+       normal:
                /*
                 *      Array type sub-option create a new VALUE_PAIR
                 *      for each array element.