return NULL;
}
- if ((code[1] < 1) || (code[2] == 0) || (code[2] > 11)) {
- fr_strerror_printf("Unknown value for message-type option");
+ if ((code[1] < 1) || (code[2] == 0) || (code[2] > 15)) {
+ fr_strerror_printf("Unknown value %d for message-type option", code[2]);
rad_free(&packet);
return NULL;
}
char src_ip_buf[256], dst_ip_buf[256];
if ((packet->code >= PW_DHCP_DISCOVER) &&
- (packet->code <= (1024 + 11))) {
+ (packet->code <= (1024 + 15))) {
name = dhcp_message_types[packet->code - PW_DHCP_OFFSET];
} else {
snprintf(type_buf, sizeof(type_buf), "%d",
char dst_ip_buf[INET6_ADDRSTRLEN];
if ((packet->code >= PW_DHCP_DISCOVER) &&
- (packet->code <= (1024 + 11))) {
+ (packet->code <= (1024 + 15))) {
name = dhcp_message_types[packet->code - PW_DHCP_OFFSET];
} else {
snprintf(type_buf, sizeof(type_buf), "%d",
/*
* Skip chaddr if it doesn't exist.
*/
- if ((packet->data[1] == 0) || (packet->data[2] == 2)) continue;
+ if ((packet->data[1] == 0) || (packet->data[2] == 0)) continue;
if ((packet->data[1] == 1) && (packet->data[2] != sizeof(vp->vp_ether))) {
DICT_ATTR const *da = dict_unknown_afrom_fields(packet, vp->da->attr, vp->da->vendor);
#ifndef NDEBUG
if ((packet->code >= PW_DHCP_DISCOVER) &&
- (packet->code <= (1024 + 11))) {
+ (packet->code <= (1024 + 15))) {
name = dhcp_message_types[packet->code - PW_DHCP_OFFSET];
} else {
name = "?Unknown?";
char dst_ip_buf[INET6_ADDRSTRLEN];
if ((packet->code >= PW_DHCP_DISCOVER) &&
- (packet->code <= (1024 + 11))) {
+ (packet->code <= (1024 + 15))) {
name = dhcp_message_types[packet->code - PW_DHCP_OFFSET];
} else {
snprintf(type_buf, sizeof(type_buf), "%d",
char src_ip_buf[256], dst_ip_buf[256];
if ((packet->code >= PW_DHCP_DISCOVER) &&
- (packet->code <= (1024 + 11))) {
+ (packet->code <= (1024 + 15))) {
name = dhcp_message_types[packet->code - PW_DHCP_OFFSET];
} else {
snprintf(type_buf, sizeof(type_buf), "%d", packet->code - PW_DHCP_OFFSET);
{ "decline", PW_DHCP_DECLINE },
{ "release", PW_DHCP_RELEASE },
{ "inform", PW_DHCP_INFORM },
+ { "lease_query", PW_DHCP_LEASE_QUERY },
{ "auto", PW_CODE_UNDEFINED },
{ NULL, 0}
};
packet_code = atoi(argv[2]);
}
}
- if (server_port == 0) server_port = 67;
+ if (!server_port) server_port = 67;
request_init(filename);
reply_expected = false;
}
+ /*
+ * Always true for DHCP
+ */
+ client_port = server_port + 1;
+
/*
* Bind to the first specified IP address and port.
* This means we ignore later ones.
if (request->src_ipaddr.af == AF_UNSPEC) {
memset(&client_ipaddr, 0, sizeof(client_ipaddr));
client_ipaddr.af = server_ipaddr.af;
- client_port = 0;
} else {
client_ipaddr = request->src_ipaddr;
- client_port = request->src_port;
}
/* set "raw mode" if an interface is specified and if destination IP address is the broadcast address. */