From: Alan T. DeKok Date: Thu, 31 May 2018 15:39:58 +0000 (-0400) Subject: decode DHCP options for ADSL vendor forum X-Git-Tag: release_3_0_18~299 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a552de58715d0e02837769c0ed5f8a455e5e2ebe;p=thirdparty%2Ffreeradius-server.git decode DHCP options for ADSL vendor forum --- diff --git a/share/dictionary.rfc4679 b/share/dictionary.rfc4679 index f5ae46b492f..2bc66e59da5 100644 --- a/share/dictionary.rfc4679 +++ b/share/dictionary.rfc4679 @@ -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 diff --git a/src/modules/proto_dhcp/dhcp.c b/src/modules/proto_dhcp/dhcp.c index 3b654ed5ea8..113cb9b8053 100644 --- a/src/modules/proto_dhcp/dhcp.c +++ b/src/modules/proto_dhcp/dhcp.c @@ -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.