summaryrefslogtreecommitdiff
path: root/src/dhcpv6.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-02-05 14:47:47 +0100
committerSteven Barth <steven@midlink.org>2014-02-05 14:47:47 +0100
commitdb2915f095db17cb10bf67d5b3bf67f891d45625 (patch)
tree90a79b0d52fb68dc4f78f20dc1f470f4b15f4e16 /src/dhcpv6.c
parent6e5aec718c0ee08deed0b213606c927c455965ac (diff)
downloadodhcp6c-db2915f095db17cb10bf67d5b3bf67f891d45625.tar.gz
Add user-class option
Diffstat (limited to 'src/dhcpv6.c')
-rw-r--r--src/dhcpv6.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index c9915c2..f18a3e9 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -369,14 +369,20 @@ static void dhcpv6_send(enum dhcpv6_msg type, uint8_t trid[3], uint32_t ecs)
uint16_t oro_refresh = htons(DHCPV6_OPT_INFO_REFRESH);
// Build vendor-class option
- size_t vendor_class_len;
+ size_t vendor_class_len, user_class_len;
struct dhcpv6_vendorclass *vendor_class = odhcp6c_get_state(STATE_VENDORCLASS, &vendor_class_len);
+ void *user_class = odhcp6c_get_state(STATE_USERCLASS, &user_class_len);
struct {
uint16_t type;
uint16_t length;
} vendor_class_hdr = {htons(DHCPV6_OPT_VENDOR_CLASS), htons(vendor_class_len)};
+ struct {
+ uint16_t type;
+ uint16_t length;
+ } user_class_hdr = {htons(DHCPV6_OPT_USER_CLASS), htons(user_class_len)};
+
// Prepare Header
size_t oro_len;
void *oro = odhcp6c_get_state(STATE_ORO, &oro_len);
@@ -403,6 +409,8 @@ static void dhcpv6_send(enum dhcpv6_msg type, uint8_t trid[3], uint32_t ecs)
{srv_id, srv_id_len},
{&vendor_class_hdr, vendor_class_len ? sizeof(vendor_class_hdr) : 0},
{vendor_class, vendor_class_len},
+ {&user_class_hdr, user_class_len ? sizeof(user_class_hdr) : 0},
+ {user_class, user_class_len},
{&reconf_accept, sizeof(reconf_accept)},
{&fqdn, fqdn_len},
{&hdr_ia_na, sizeof(hdr_ia_na)},
@@ -412,11 +420,11 @@ static void dhcpv6_send(enum dhcpv6_msg type, uint8_t trid[3], uint32_t ecs)
size_t cnt = ARRAY_SIZE(iov);
if (type == DHCPV6_MSG_INFO_REQ) {
- cnt = 7;
+ cnt = 9;
iov[2].iov_len = sizeof(oro_refresh);
hdr.oro_len = htons(oro_len + sizeof(oro_refresh));
} else if (!request_prefix) {
- cnt = 11;
+ cnt = 13;
}
// Disable IAs if not used