Преглед изворни кода

Set DHCP_MESSAGE_TYPE option within the main options block. This

doesn't seem to be required by the RFCs, but at least ISC dhcpd and
ethereal refuse to recognise it otherwise.
tags/v0.9.3
Michael Brown пре 18 година
родитељ
комит
9ad5cede96
1 измењених фајлова са 8 додато и 6 уклоњено
  1. 8
    6
      src/net/udp/dhcp.c

+ 8
- 6
src/net/udp/dhcp.c Прегледај датотеку

@@ -232,7 +232,6 @@ static int create_dhcp_packet ( struct dhcp_session *dhcp, uint8_t msgtype,
232 232
 	struct dhcphdr *dhcphdr = data;
233 233
 	static const uint8_t overloading = ( DHCP_OPTION_OVERLOAD_FILE |
234 234
 					     DHCP_OPTION_OVERLOAD_SNAME );
235
-	int rc;
236 235
 
237 236
 	/* Sanity check */
238 237
 	if ( max_len < sizeof ( *dhcphdr ) )
@@ -264,11 +263,14 @@ static int create_dhcp_packet ( struct dhcp_session *dhcp, uint8_t msgtype,
264 263
 			       sizeof ( overloading ) ) == NULL )
265 264
 		return -ENOSPC;
266 265
 
267
-	/* Set DHCP_MESSAGE_TYPE option */
268
-	if ( ( rc = set_dhcp_packet_option ( dhcppkt, DHCP_MESSAGE_TYPE,
269
-					     &msgtype,
270
-					     sizeof ( msgtype ) ) ) != 0 )
271
-		return rc;
266
+	/* Set DHCP_MESSAGE_TYPE option within the main options block.
267
+	 * This doesn't seem to be required by the RFCs, but at least
268
+	 * ISC dhcpd and ethereal refuse to recognise it otherwise.
269
+	 */
270
+	if ( set_dhcp_option ( &dhcppkt->options[OPTS_MAIN],
271
+			       DHCP_MESSAGE_TYPE, &msgtype,
272
+			       sizeof ( msgtype ) ) == NULL )
273
+		return -ENOSPC;
272 274
 
273 275
 	return 0;
274 276
 }

Loading…
Откажи
Сачувај