diff options
Diffstat (limited to 'src/rfc3315.c')
-rw-r--r-- | src/rfc3315.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/rfc3315.c b/src/rfc3315.c index 8d601c4..c055718 100644 --- a/src/rfc3315.c +++ b/src/rfc3315.c @@ -1879,23 +1879,23 @@ static void update_leases(struct state *state, struct dhcp_context *context, str #ifdef HAVE_SCRIPT if (daemon->lease_change_command) { - void *class_opt; + void *opt; lease->flags |= LEASE_CHANGED; free(lease->extradata); lease->extradata = NULL; lease->extradata_size = lease->extradata_len = 0; lease->vendorclass_count = 0; - if ((class_opt = opt6_find(state->packet_options, state->end, OPTION6_VENDOR_CLASS, 4))) + if ((opt = opt6_find(state->packet_options, state->end, OPTION6_VENDOR_CLASS, 4))) { - void *enc_opt, *enc_end = opt6_ptr(class_opt, opt6_len(class_opt)); + void *enc_opt, *enc_end = opt6_ptr(opt, opt6_len(opt)); lease->vendorclass_count++; /* send enterprise number first */ - sprintf(daemon->dhcp_buff2, "%u", opt6_uint(class_opt, 0, 4)); + sprintf(daemon->dhcp_buff2, "%u", opt6_uint(opt, 0, 4)); lease_add_extradata(lease, (unsigned char *)daemon->dhcp_buff2, strlen(daemon->dhcp_buff2), 0); - if (opt6_len(class_opt) >= 6) - for (enc_opt = opt6_ptr(class_opt, 4); enc_opt; enc_opt = opt6_next(enc_opt, enc_end)) + if (opt6_len(opt) >= 6) + for (enc_opt = opt6_ptr(opt, 4); enc_opt; enc_opt = opt6_next(enc_opt, enc_end)) { lease->vendorclass_count++; lease_add_extradata(lease, opt6_ptr(enc_opt, 0), opt6_len(enc_opt), 0); @@ -1934,20 +1934,15 @@ static void update_leases(struct state *state, struct dhcp_context *context, str lease_add_extradata(lease, (unsigned char *)daemon->addrbuff, state->link_address ? strlen(daemon->addrbuff) : 0, 0); - void *mud_opt; - if ((mud_opt = opt6_find(state->packet_options, state->end, OPTION6_MUD_URL, 1))) - { - lease_add_extradata(lease, opt6_ptr(mud_opt, 0), opt6_len(mud_opt), NULL); - } + if ((opt = opt6_find(state->packet_options, state->end, OPTION6_MUD_URL, 1))) + lease_add_extradata(lease, opt6_ptr(opt, 0), opt6_len(opt), 0); else - { - lease_add_extradata(lease, NULL, 0, 0); - } + lease_add_extradata(lease, NULL, 0, 0); - if ((class_opt = opt6_find(state->packet_options, state->end, OPTION6_USER_CLASS, 2))) + if ((opt = opt6_find(state->packet_options, state->end, OPTION6_USER_CLASS, 2))) { - void *enc_opt, *enc_end = opt6_ptr(class_opt, opt6_len(class_opt)); - for (enc_opt = opt6_ptr(class_opt, 0); enc_opt; enc_opt = opt6_next(enc_opt, enc_end)) + void *enc_opt, *enc_end = opt6_ptr(opt, opt6_len(opt)); + for (enc_opt = opt6_ptr(opt, 0); enc_opt; enc_opt = opt6_next(enc_opt, enc_end)) lease_add_extradata(lease, opt6_ptr(enc_opt, 0), opt6_len(enc_opt), 0); } } |