aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-01-16 21:35:39 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-01-16 21:35:39 +0100
commit1e8d79ba12d715d4375856418173c5375fbfce40 (patch)
tree65d4b9743d27ae1f6e6b282cfbeaf4f53434e755 /networking/udhcp
parent688cb3bc1979bad4236315517a7c7bb3a51289f1 (diff)
downloadbusybox-w32-1e8d79ba12d715d4375856418173c5375fbfce40.tar.gz
busybox-w32-1e8d79ba12d715d4375856418173c5375fbfce40.tar.bz2
busybox-w32-1e8d79ba12d715d4375856418173c5375fbfce40.zip
udhcpc6: preparatory patch, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/d6_dhcpc.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 65ff5deab..57ad968cd 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -1589,44 +1589,44 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1589 * . . 1589 * . .
1590 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1590 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1591 */ 1591 */
1592 free(client6_data.ia_na); 1592 free(client6_data.ia_na);
1593 client6_data.ia_na = d6_copy_option(packet.d6_options, packet_end, D6_OPT_IA_NA); 1593 client6_data.ia_na = d6_copy_option(packet.d6_options, packet_end, D6_OPT_IA_NA);
1594 if (!client6_data.ia_na) { 1594 if (!client6_data.ia_na) {
1595 bb_error_msg("no %s option, ignoring packet", "IA_NA"); 1595 bb_error_msg("no %s option, ignoring packet", "IA_NA");
1596 continue; 1596 continue;
1597 } 1597 }
1598 if (client6_data.ia_na->len < (4 + 4 + 4) + (2 + 2 + 16 + 4 + 4)) { 1598 if (client6_data.ia_na->len < (4 + 4 + 4) + (2 + 2 + 16 + 4 + 4)) {
1599 bb_error_msg("IA_NA option is too short:%d bytes", client6_data.ia_na->len); 1599 bb_error_msg("IA_NA option is too short:%d bytes", client6_data.ia_na->len);
1600 continue; 1600 continue;
1601 } 1601 }
1602 iaaddr = d6_find_option(client6_data.ia_na->data + 4 + 4 + 4, 1602 iaaddr = d6_find_option(client6_data.ia_na->data + 4 + 4 + 4,
1603 client6_data.ia_na->data + client6_data.ia_na->len, 1603 client6_data.ia_na->data + client6_data.ia_na->len,
1604 D6_OPT_IAADDR 1604 D6_OPT_IAADDR
1605 ); 1605 );
1606 if (!iaaddr) { 1606 if (!iaaddr) {
1607 bb_error_msg("no %s option, ignoring packet", "IAADDR"); 1607 bb_error_msg("no %s option, ignoring packet", "IAADDR");
1608 continue; 1608 continue;
1609 } 1609 }
1610 if (iaaddr->len < (16 + 4 + 4)) { 1610 if (iaaddr->len < (16 + 4 + 4)) {
1611 bb_error_msg("IAADDR option is too short:%d bytes", iaaddr->len); 1611 bb_error_msg("IAADDR option is too short:%d bytes", iaaddr->len);
1612 continue; 1612 continue;
1613 } 1613 }
1614 /* Note: the address is sufficiently aligned for cast: 1614 /* Note: the address is sufficiently aligned for cast:
1615 * we _copied_ IA-NA, and copy is always well-aligned. 1615 * we _copied_ IA-NA, and copy is always well-aligned.
1616 */ 1616 */
1617 requested_ipv6 = (struct in6_addr*) iaaddr->data; 1617 requested_ipv6 = (struct in6_addr*) iaaddr->data;
1618 move_from_unaligned32(lease_seconds, iaaddr->data + 16 + 4); 1618 move_from_unaligned32(lease_seconds, iaaddr->data + 16 + 4);
1619 lease_seconds = ntohl(lease_seconds); 1619 lease_seconds = ntohl(lease_seconds);
1620 /* paranoia: must not be too small and not prone to overflows */ 1620 /* paranoia: must not be too small and not prone to overflows */
1621 if (lease_seconds < 0x10) 1621 if (lease_seconds < 0x10)
1622 lease_seconds = 0x10; 1622 lease_seconds = 0x10;
1623/// TODO: check for 0 lease time? 1623/// TODO: check for 0 lease time?
1624 if (lease_seconds > 0x7fffffff / 1000) 1624 if (lease_seconds > 0x7fffffff / 1000)
1625 lease_seconds = 0x7fffffff / 1000; 1625 lease_seconds = 0x7fffffff / 1000;
1626 /* enter bound state */ 1626 /* enter bound state */
1627 timeout = lease_seconds / 2; 1627 timeout = lease_seconds / 2;
1628 bb_error_msg("lease obtained, lease time %u", 1628 bb_error_msg("lease obtained, lease time %u",
1629 /*inet_ntoa(temp_addr),*/ (unsigned)lease_seconds); 1629 /*inet_ntoa(temp_addr),*/ (unsigned)lease_seconds);
1630 d6_run_script(&packet, state == REQUESTING ? "bound" : "renew"); 1630 d6_run_script(&packet, state == REQUESTING ? "bound" : "renew");
1631 1631
1632 state = BOUND; 1632 state = BOUND;