diff options
-rw-r--r-- | networking/udhcp/dhcpc.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 36c8a3dd3..7cd0b7bcb 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -1533,7 +1533,25 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
1533 | case INIT_SELECTING: | 1533 | case INIT_SELECTING: |
1534 | /* Must be a DHCPOFFER to one of our xid's */ | 1534 | /* Must be a DHCPOFFER to one of our xid's */ |
1535 | if (*message == DHCPOFFER) { | 1535 | if (*message == DHCPOFFER) { |
1536 | /* TODO: why we don't just fetch server's IP from IP header? */ | 1536 | /* What exactly is server's IP? There are several values. |
1537 | * Example DHCP offer captured with tchdump: | ||
1538 | * | ||
1539 | * 10.34.25.254:67 > 10.34.25.202:68 // IP header's src | ||
1540 | * BOOTP fields: | ||
1541 | * Your-IP 10.34.25.202 | ||
1542 | * Server-IP 10.34.32.125 // "next server" IP | ||
1543 | * Gateway-IP 10.34.25.254 // relay's address (if DHCP relays are in use) | ||
1544 | * DHCP options: | ||
1545 | * DHCP-Message Option 53, length 1: Offer | ||
1546 | * Server-ID Option 54, length 4: 10.34.255.7 // "server ID" | ||
1547 | * Default-Gateway Option 3, length 4: 10.34.25.254 // router | ||
1548 | * | ||
1549 | * We think that real server IP (one to use in renew/release) | ||
1550 | * is one in Server-ID option. But I am not 100% sure. | ||
1551 | * IP header's src and Gateway-IP (same in this exaqmple) | ||
1552 | * might work too. | ||
1553 | * "Next server" and router are definitely wrong ones to use, though... | ||
1554 | */ | ||
1537 | temp = udhcp_get_option(&packet, DHCP_SERVER_ID); | 1555 | temp = udhcp_get_option(&packet, DHCP_SERVER_ID); |
1538 | if (!temp) { | 1556 | if (!temp) { |
1539 | bb_error_msg("no server ID, ignoring packet"); | 1557 | bb_error_msg("no server ID, ignoring packet"); |