# Fixme should be broken out into separate RFCs
$INCLUDE dictionary.rfc2131
$INCLUDE dictionary.rfc2610
+$INCLUDE dictionary.rfc3442
$INCLUDE dictionary.rfc4280
$INCLUDE dictionary.rfc4578
$INCLUDE dictionary.rfc4776
ATTRIBUTE Domain-Search 119 octets # really compressed, concatenated, dns_label array
# SIP-Servers DHCP Option
ATTRIBUTE SIP-Servers-Option 120 octets
-# Classless Static Route Option
-ATTRIBUTE Classless-Static-Route 121 octets
+
# CableLabs Client Configuration
ATTRIBUTE CCC 122 octets
# 16 GeoConf Option
--- /dev/null
+# -*- text -*-
+# Copyright (C) 2022 The FreeRADIUS Server project and contributors
+# This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0
+# Version $Id$
+##############################################################################
+#
+# RFC3442 - The Classless Static Route Option for DHCPv4
+#
+# $Id$
+#
+##############################################################################
+
+ATTRIBUTE Classless-Static-Route 121 struct
+MEMBER Destination-Descriptor struct array
+MEMBER Subnet ipv4prefix prefix=bits
+MEMBER Router-IP-Address ipv4addr
+
vp->vp_ipv4addr = htonl(ipaddr & mask);
break;
}
+
+ if (da_is_bits_prefix(vp->da)) {
+ uint32_t ipaddr, mask;
+
+ if ((data_len == 0) || (*p > 32)) goto raw;
+
+ if (exact && (data_len > 5)) goto raw;
+
+ vp->vp_ip.prefix = *p;
+
+ if (*p > 24) {
+ if (data_len < 5) goto raw;
+ ipaddr = fr_net_to_uint32(p + 1);
+ p += 5;
+
+ } else if (*p > 16) {
+ if (data_len < 4) goto raw;
+ ipaddr = fr_net_to_uint24(p + 1);
+ ipaddr <<= 8;
+ p += 4;
+
+ } else if (*p > 8) {
+ if (data_len < 3) goto raw;
+ ipaddr = fr_net_to_uint16(p + 1);
+ ipaddr <<= 16;
+ p += 3;
+
+ } else if (*p > 0) {
+ if (data_len < 2) goto raw;
+ ipaddr = p[1];
+ ipaddr <<= 24;
+ p += 2;
+
+ } else {
+ p++;
+ ipaddr = 0;
+ }
+
+ mask = ~(uint32_t) 0;
+ mask <<= (32 - vp->vp_ip.prefix);
+
+ vp->vp_ipv4addr = htonl(ipaddr & mask);
+ break;
+ }
+
FALL_THROUGH;
default:
fr_dbuff_in(&work_dbuff, mask);
break;
}
+
+ if (da_is_bits_prefix(vp->da)) {
+ int num_bytes = (vp->vp_ip.prefix + 0x07) >> 3;
+
+ fr_dbuff_in(&work_dbuff, (uint8_t) vp->vp_ip.prefix);
+
+ if (num_bytes) {
+ FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff,
+ (uint8_t const *)&vp->vp_ipv4addr,
+ num_bytes);
+ }
+
+ break;
+ }
+
goto from_network;
case FR_TYPE_STRING:
--- /dev/null
+proto dhcpv4
+proto-dictionary dhcpv4
+fuzzer-out dhcpv4
+
+encode-pair Classless-Static-Route = { Destination-Descriptor = { Subnet = 127.0.0.0/8, Router-IP-Address = 127.0.0.1 }, Destination-Descriptor = { Subnet = 192.168.0.0/16, Router-IP-Address = 192.168.0.1 } }
+match 79 0d 08 7f 7f 00 00 01 10 c0 a8 c0 a8 00 01
+
+decode-pair -
+match Classless-Static-Route = { Destination-Descriptor = { Subnet = 127.0.0.0/8, Router-IP-Address = 127.0.0.1 }, Destination-Descriptor = { Subnet = 192.168.0.0/16, Router-IP-Address = 192.168.0.1 } }
+
+
+count
+match 7