aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2025-02-09 12:54:50 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2025-02-09 12:54:50 +0100
commit779cca899fbf0cd398fdcff266fec693b507854f (patch)
tree3e67459d60e36e880488efa714a3067492a43147
parentef21820dc9dd7520cc89469ef2b9d7387c7be78b (diff)
downloadbusybox-w32-779cca899fbf0cd398fdcff266fec693b507854f.tar.gz
busybox-w32-779cca899fbf0cd398fdcff266fec693b507854f.tar.bz2
busybox-w32-779cca899fbf0cd398fdcff266fec693b507854f.zip
udhcpc6: move block comment, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/d6_dhcpc.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 706377be8..d639a9f80 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -1624,67 +1624,6 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1624 case RENEW_REQUESTED: 1624 case RENEW_REQUESTED:
1625 case REBINDING: 1625 case REBINDING:
1626 if (packet.d6_msg_type == D6_MSG_REPLY) { 1626 if (packet.d6_msg_type == D6_MSG_REPLY) {
1627 unsigned start;
1628 uint32_t lease_seconds;
1629 struct d6_option *option;
1630 unsigned address_timeout;
1631 unsigned prefix_timeout;
1632 type_is_ok:
1633 change_listen_mode(LISTEN_NONE);
1634
1635 address_timeout = 0;
1636 prefix_timeout = 0;
1637 option = d6_find_option(packet.d6_options, packet_end, D6_OPT_STATUS_CODE);
1638 if (option) {
1639// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1640// | OPTION_STATUS_CODE | option-len |
1641// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1642// | status-code | |
1643// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1644// . status-message .
1645// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1646 unsigned len, status;
1647 len = ((unsigned)option->len_hi << 8) + option->len;
1648 if (len < 2) {
1649 bb_simple_error_msg("invalid OPTION_STATUS_CODE, ignoring packet");
1650 continue;
1651 }
1652 status = ((unsigned)option->data[0] << 8) + option->data[1];
1653 if (status != 0) {
1654//TODO: handle status == 5 (UseMulticast)?
1655 /* return to init state */
1656 bb_info_msg("received DHCP NAK: %u '%.*s'", status, len - 2, option->data + 2);
1657 d6_run_script(packet.d6_options, packet_end, "nak");
1658 if (client_data.state != REQUESTING)
1659 d6_run_script_no_option("deconfig");
1660 sleep(3); /* avoid excessive network traffic */
1661 client_data.state = INIT_SELECTING;
1662 client_data.first_secs = 0; /* make secs field count from 0 */
1663 requested_ipv6 = NULL;
1664 timeout = 0;
1665 packet_num = 0;
1666 continue;
1667 }
1668 }
1669 option = d6_copy_option(packet.d6_options, packet_end, D6_OPT_SERVERID);
1670 if (!option) {
1671 bb_simple_info_msg("no server ID, ignoring packet");
1672 continue;
1673 /* still selecting - this server looks bad */
1674 }
1675//Note: we do not bother comparing server IDs in Advertise and Reply msgs.
1676//server_id variable is used solely for creation of proper server_id option
1677//in outgoing packets. (why DHCPv6 even introduced it is a mystery).
1678 free(client6_data.server_id);
1679 client6_data.server_id = option;
1680 if (packet.d6_msg_type == D6_MSG_ADVERTISE) {
1681 /* enter requesting state */
1682 change_listen_mode(LISTEN_RAW);
1683 client_data.state = REQUESTING;
1684 timeout = 0;
1685 packet_num = 0;
1686 continue;
1687 }
1688/* 1627/*
1689 * RFC 3315 18.1.8. Receipt of Reply Messages 1628 * RFC 3315 18.1.8. Receipt of Reply Messages
1690 * 1629 *
@@ -1770,6 +1709,67 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1770 * . . 1709 * . .
1771 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1710 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1772 */ 1711 */
1712 unsigned start;
1713 uint32_t lease_seconds;
1714 struct d6_option *option;
1715 unsigned address_timeout;
1716 unsigned prefix_timeout;
1717 type_is_ok:
1718 change_listen_mode(LISTEN_NONE);
1719
1720 address_timeout = 0;
1721 prefix_timeout = 0;
1722 option = d6_find_option(packet.d6_options, packet_end, D6_OPT_STATUS_CODE);
1723 if (option) {
1724// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1725// | OPTION_STATUS_CODE | option-len |
1726// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1727// | status-code | |
1728// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1729// . status-message .
1730// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1731 unsigned len, status;
1732 len = ((unsigned)option->len_hi << 8) + option->len;
1733 if (len < 2) {
1734 bb_simple_error_msg("invalid OPTION_STATUS_CODE, ignoring packet");
1735 continue;
1736 }
1737 status = ((unsigned)option->data[0] << 8) + option->data[1];
1738 if (status != 0) {
1739//TODO: handle status == 5 (UseMulticast)?
1740 /* return to init state */
1741 bb_info_msg("received DHCP NAK: %u '%.*s'", status, len - 2, option->data + 2);
1742 d6_run_script(packet.d6_options, packet_end, "nak");
1743 if (client_data.state != REQUESTING)
1744 d6_run_script_no_option("deconfig");
1745 sleep(3); /* avoid excessive network traffic */
1746 client_data.state = INIT_SELECTING;
1747 client_data.first_secs = 0; /* make secs field count from 0 */
1748 requested_ipv6 = NULL;
1749 timeout = 0;
1750 packet_num = 0;
1751 continue;
1752 }
1753 }
1754 option = d6_copy_option(packet.d6_options, packet_end, D6_OPT_SERVERID);
1755 if (!option) {
1756 bb_simple_info_msg("no server ID, ignoring packet");
1757 continue;
1758 /* still selecting - this server looks bad */
1759 }
1760//Note: we do not bother comparing server IDs in Advertise and Reply msgs.
1761//server_id variable is used solely for creation of proper server_id option
1762//in outgoing packets. (why DHCPv6 even introduced it is a mystery).
1763 free(client6_data.server_id);
1764 client6_data.server_id = option;
1765 if (packet.d6_msg_type == D6_MSG_ADVERTISE) {
1766 /* enter requesting state */
1767 change_listen_mode(LISTEN_RAW);
1768 client_data.state = REQUESTING;
1769 timeout = 0;
1770 packet_num = 0;
1771 continue;
1772 }
1773 if (option_mask32 & OPT_r) { 1773 if (option_mask32 & OPT_r) {
1774 struct d6_option *iaaddr; 1774 struct d6_option *iaaddr;
1775 1775