aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/packet.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* udhcpc[6]: make log2 messages for chaddr field indented like the restDenys Vlasenko2017-09-291-4/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: paranoia when using kernel UDP mode for sending renew: server ID may ↵Denys Vlasenko2017-09-291-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | be bogus With new code, we request that target IP (server ID) must be directly reachable. If it's not, this happens: udhcpc: waiting 2000 seconds udhcpc: entering listen mode: kernel udhcpc: opening listen socket on *:68 wlan0 udhcpc: entering renew state udhcpc: sending renew to 1.1.1.1 udhcpc: send: Network is unreachable ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.1.1.1 needs routing, this is fishy! udhcpc: entering rebinding state udhcpc: entering listen mode: raw udhcpc: created raw socket udhcpc: sending renew to 0.0.0.0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ going to use broadcast which is the desired behavior. Before the patch, packet to 1.1.1.1 was routed over eth0 (!) and maybe even into Internet (!!!). function old new delta udhcpc_main 2752 2763 +11 udhcp_send_kernel_packet 295 301 +6 send_renew 82 84 +2 send_packet 166 168 +2 bcast_or_ucast 23 25 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/0 up/down: 23/0) Total: 23 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc[6]: initialize entire sockaddr_llDenys Vlasenko2017-09-291-0/+2
| | | | | | | | | | | I see random field values like sll_hatype=0x267 when I strace. They seem to not matter, but just in case they sometimes do, let's at least have deterministic values (via memset(0)). function old new delta change_listen_mode 308 322 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2017-07-031-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: get rid of bb_info_msg()Denys Vlasenko2016-03-301-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta udhcpd_main 1501 1531 +30 d6_recv_raw_packet 251 264 +13 perform_d6_release 188 198 +10 udhcpc6_main 2443 2449 +6 udhcp_recv_raw_packet 582 588 +6 udhcp_recv_kernel_packet 132 138 +6 send_d6_renew 140 146 +6 d6_recv_kernel_packet 118 124 +6 send_renew 77 82 +5 send_discover 85 90 +5 send_decline 84 89 +5 send_d6_select 97 102 +5 send_d6_discover 174 179 +5 perform_release 167 172 +5 count_lines 72 74 +2 udhcpc_main 2836 2837 +1 bb_info_msg 125 - -125 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 17/4 up/down: 117/-180) Total: -63 bytes text data bss dec hex filename 924935 906 17160 943001 e6399 busybox_old 924736 906 17160 942802 e62d2 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: make DHCP packets to have at least 300 DHCP bytesJohannes Stezenbach2013-10-281-0/+9
| | | | | | | | | | | | | | | | | | Commit b8b72f02 removed all padding from DHCP packets to fix operation with buggy servers which can't handle maximum sized packets. But it introduced a regression with buggy routers which drop DHCP packets smaller than 300 bytes (i.e. 342 byte ethernet packets). Add back some padding to work around. function old new delta udhcp_send_kernel_packet 268 292 +24 udhcp_send_raw_packet 462 473 +11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 35/0) Total: 35 bytes Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: trim help text, rename badly-named variableDenys Vlasenko2011-11-071-12/+11
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: remove workaround for bugs in Win98 dhcp server ("MSFT 98" vendor ↵Denys Vlasenko2011-11-051-31/+3
| | | | | | | | | | | | | | | | | | | string) Stats for last three commits: function old new delta udhcpc_main 2635 2646 +11 udhcp_recv_raw_packet 425 414 -11 udhcp_recv_kernel_packet 210 134 -76 packed_usage 28940 28857 -83 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 11/-170) Total: -159 bytes text data bss dec hex filename 879524 493 7584 887601 d8b31 busybox_old 879340 493 7584 887417 d8a79 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* networking: consolidate the IP checksum code. -129 bytes.Baruch Siach2011-09-071-31/+3
| | | | | Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: simplify Ethernet header includesDan Fandrich2011-06-101-10/+3
| | | | | Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dhcp: typo fix: UPD_DHCP_SIZE -> UDP_DHCP_SIZEDenys Vlasenko2010-10-201-4/+4
| | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dhcp: truncate packets instead of padding them to 574 bytes. closes bug 1849Denys Vlasenko2010-05-311-12/+20
| | | | | | | | function old new delta udhcp_send_raw_packet 411 456 +45 udhcp_send_kernel_packet 259 271 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dhcp: readability cleanups and small code shrinkDenys Vlasenko2010-05-301-27/+19
| | | | | | | function old new delta udhcp_run_script 654 617 -37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: cosmetic cleanups; one case of s/full_read/xread/Denys Vlasenko2010-03-261-6/+7
| | | | | | | function old new delta dumpleases_main 632 623 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: pass pointer to whole packet to "add option" functionsDenys Vlasenko2010-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | This is needed for "overflow option" support function old new delta udhcp_find_option - 34 +34 udhcp_add_binary_option 94 106 +12 write_leases 227 223 -4 udhcp_init_header 86 82 -4 send_release 104 99 -5 init_packet 87 81 -6 add_client_options 160 154 -6 add_server_options 100 92 -8 udhcpd_main 1964 1954 -10 udhcpc_main 2859 2837 -22 find_option 34 - -34 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/8 up/down: 46/-99) Total: -53 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: handle errors in read_staticleaseDenys Vlasenko2010-03-231-3/+3
| | | | | | | | | also gets rid of ether-aton's static buffer in ether-wake: text data bss dec hexfilename 838664 441 7572 846677 ceb55busybox_old 838650 441 7564 846655 ceb3fbusybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: merge options.h into common.h, script.c into dhcpc.cDenys Vlasenko2010-03-221-4/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpd: untangle incredibly messy handling of DHCPREQUESTDenys Vlasenko2010-03-211-4/+7
| | | | | | | | | | | | | | Also fixes attacks possible via DHCPDECLINE / DHCPRELEASE function old new delta udhcpd_main 1846 1949 +103 send_renew 105 142 +37 send_NAK 61 - -61 send_ACK 180 - -180 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 2/0 up/down: 140/-241) Total: -101 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove trailing whitespaceDenys Vlasenko2009-07-151-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: fix trivial compile errorDenys Vlasenko2009-06-191-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: logging improvements, field and variable renamesDenys Vlasenko2009-06-171-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: shorten mac len from 16 to 6 in lease fileDenys Vlasenko2009-06-171-10/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcp: change UDHCP_DEBUG into int, make verbosity selectable with -vDenys Vlasenko2009-06-171-16/+60
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix forgotten license commentsDenis Vlasenko2008-12-071-0/+6
|
* udhcp: add inline docs; small code shrinkDenis Vlasenko2008-09-261-4/+4
| | | | | | | function old new delta send_packet 103 87 -16 udhcpc_main 2359 2323 -36
* udhcp: added some FIXMEs; code shrink. -49 bytesDenis Vlasenko2008-09-261-1/+2
|
* dhcp: add FAST_FUNC as appropriate. -160 bytes.Denis Vlasenko2008-09-261-5/+5
|
* udhcpc: regularize the names of receiving functions,Denis Vlasenko2008-05-211-1/+1
| | | | | | pause on "serious failure to receive". Some misc fixes are also folded in here.
* udhcp: we were forgetting to set right op byte in tha packetDenis Vlasenko2008-02-201-6/+1
| | | | | for DHCPDECLINE. Fixing, and making code smaller.
* Makefile: change version to 1.10.0.svnDenis Vlasenko2007-12-241-32/+41
| | | | | | | | | | | udhcpc: make UDP packet sending the same as raw sending in regards to error messages. Minor code size shrink. Total size grows due to added messages: text data bss dec hex filename 770312 683 7244 778239 bdfff busybox_old 770327 683 7244 778254 be00e busybox_unstripped
* udhcp: decided to not send "short" dhcp packets,Denis Vlasenko2007-12-211-1/+6
| | | | | but lets add comments how to do it if needed.
* udhcp: fix oversized packet sending (introduced by "slack for bad dhcp ↵Denis Vlasenko2007-12-201-13/+23
| | | | | | | | | | | | | | | | | servers" options); slight optimizations and function renaming udhcp_send_raw_packet - 391 +391 udhcp_send_kernel_packet - 197 +197 udhcp_recv_packet - 134 +134 get_raw_packet 353 326 -27 udhcp_get_packet 134 - -134 udhcp_kernel_packet 197 - -197 udhcp_raw_packet 391 - -391 ------------------------------------------------------------------------------ (add/remove: 3/3 grow/shrink: 0/1 up/down: 722/-749) Total: -27 bytes
* dhcp: stop using magic constants; use (htonl(CONST) != a) - it's smallerDenis Vlasenko2007-11-231-5/+1
| | | | | | | function old new delta udhcp_get_packet 146 134 -12 get_raw_packet 368 353 -15
* introduce and use xdup2(int, int)Denis Vlasenko2007-08-181-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stop checking whether setsockopt_reuseaddr(int fd) was successful (it always is) remove second parameter (sockllen) from xmalloc_sockaddr2xxxxx functions sockaddr2str 142 156 +14 collect_blk 467 474 +7 xdup2 28 33 +5 singlemount 4456 4454 -2 print_host 214 212 -2 nslookup_main 139 137 -2 ftpgetput_main 414 412 -2 udhcpd_main 1258 1255 -3 udhcpc_main 2405 2402 -3 traceroute_main 4125 4122 -3 nc_main 1072 1069 -3 buffer_fill_and_print 76 73 -3 xmalloc_sockaddr2hostonly_noport 18 14 -4 xmalloc_sockaddr2host_noport 18 14 -4 xmalloc_sockaddr2host 15 11 -4 xmalloc_sockaddr2dotted_noport 18 14 -4 xmalloc_sockaddr2dotted 18 14 -4 wget_main 2618 2614 -4 ping_main 393 389 -4 ip_port_str 120 115 -5 dhcprelay_main 1146 1141 -5 dnsd_main 1531 1525 -6 passwd_main 1110 1102 -8 udhcp_kernel_packet 206 197 -9 udhcp_listen_socket 154 144 -10 getty_main 2576 2566 -10 setup 655 640 -15 xmove_fd 51 34 -17 dolisten 759 742 -17 tcpudpsvd_main 1866 1836 -30 startservice 339 299 -40
* udhcp: many small fixes:Denis Vlasenko2007-07-031-10/+24
| | | | | | | | | | | | | | | | | | | | | | | | * arpping(): smaller and even probably fixed * lots of variables/params converted: ulong -> uint32_t * uptime() nuked in favor of monotonic_sec() * udhcp_get_packet(): only one "bad vendor", simplify function old new delta reservedIp 36 35 -1 udhcpc_main 2462 2460 -2 addStaticLease 64 62 -2 static.broken_vendors 16 - -16 uptime 19 - -19 udhcpd_main 1273 1238 -35 udhcp_get_packet 223 184 -39 .rodata 144162 144106 -56 arpping 690 609 -81 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/7 up/down: 0/-251) Total: -251 bytes text data bss dec hex filename 734241 3028 14400 751669 b7835 busybox_old 734005 3028 14400 751433 b7749 busybox_unstripped
* udhcp: MAC_BCAST_ADDR and blank_chaddr are in fact constant, move to rodata.Denis Vlasenko2007-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | a few global variables reduced to smallints function old new delta add_lease 75 227 +152 static.blank_chaddr - 16 +16 MAC_BCAST_ADDR - 6 +6 sockfd 4 8 +4 udhcp_run_script 1153 1155 +2 state 8 5 -3 listen_mode 4 1 -3 perform_release 152 148 -4 fd 8 4 -4 blank_chaddr 16 - -16 udhcpc_main 2518 2497 -21 .rodata 131864 131832 -32 oldest_expired_lease 61 - -61 clear_lease 127 - -127 ------------------------------------------------------------------------------ (add/remove: 2/3 grow/shrink: 3/6 up/down: 180/-271) Total: -91 bytes
* A bunch of defined(__GLIBC__) added. static-linking warning expandedDenis Vlasenko2006-12-181-1/+1
|
* introduce setsockopt_reuseaddr(int fd), setsockopt_broadcast(int fd),Denis Vlasenko2006-11-221-2/+1
| | | | | use them where appropriate. 200 bytes saved
* add compile-time check for correct DHCP packet sizeDenis Vlasenko2006-11-201-0/+4
|
* udhcp: fix indentation and style.Denis Vlasenko2006-11-181-16/+16
| | | | | Eliminate (group) a lot of smallish *.h files Remove lots of unneeded #includes
* add -Wundef, fix uncovered bugsDenis Vlasenko2006-11-171-1/+1
|
* message string changes, mostly for consistency, also -32 bytes in .rodataDenis Vlasenko2006-10-201-2/+2
|
* Implement optional syslog logging using ordinaryDenis Vlasenko2006-09-061-7/+7
| | | | | | bb_xx_msg calls, and convert networking/* to it. The rest of bbox will be converted gradually.
* Standardize on the vi editing directives being on the first line."Robert P. J. Day"2006-07-021-0/+1
|
* Remove all usage of the "register" storage class specifier."Robert P. J. Day"2006-07-011-1/+1
|
* My first bout of untangling udhcp. Make lots of gratuitous #defines goRob Landley2006-05-281-7/+7
| | | | | | away, substitutie BB_VER for an external VERSION, use busybox CONFIG symbols rather than checking for them then defining others, etc. Lots more cleanup to do...
* add back in udhcp supportMike Frysinger2006-05-081-0/+207
|
* remove in place of external linkMike Frysinger2006-03-231-207/+0
|
* sync busybox and udhcp treesMike Frysinger2006-03-231-2/+0
|