aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/d6_dhcpc.c
AgeCommit message (Collapse)Author
2017-03-27udhcp6: move misplaced commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-27udhcp6: fix releasingDenys Vlasenko
Patch is based on work by tiggerswelt.net. They say: " We wanted udhcpc6 to release its IPv6-Addresses on quit (-R-commandline-option) which turned out to generate once again kind of garbage on the network-link. We tracked this down to two issues: - udhcpc6 uses a variable called "srv6_buf" to send packets to the dhcp6-server, but this variable is never initialized correctly and contained kind of a garbage-address - The address of the dhcp6-server is usually a link-local-address, that requires an interface-index when using connect() on an AF_INET6- socket We added an additional parameter for ifindex to d6_send_kernel_packet() and made d6_recv_raw_packet() to capture the address of the dhcp6-server and forward it to its callee. " Three last patches together: function old new delta d6_read_interface - 454 +454 d6_recv_raw_packet - 283 +283 option_to_env 249 504 +255 .rodata 165226 165371 +145 send_d6_discover 195 237 +42 send_d6_select 118 159 +41 send_d6_renew 173 186 +13 send_d6_release 162 173 +11 opt_req - 10 +10 d6_send_kernel_packet 304 312 +8 opt_fqdn_req - 6 +6 d6_mcast_from_client_config_ifindex 48 51 +3 d6_find_option 63 61 -2 udhcpc6_main 2416 2411 -5 static.d6_recv_raw_packet 266 - -266 ------------------------------------------------------------------------------ (add/remove: 5/1 grow/shrink: 8/2 up/down: 1271/-273) Total: 998 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-27udhcp6: fix problems found running against dnsmasqDenys Vlasenko
Patch is based on work by tiggerswelt.net. They say: " But when we tried to use dnsmasq on server-side, udhcpc6 was unable to forward the acquired address to its setup-script although the IPv6-Address had been assigned by the server as we could see via tcpdump. We traced this issue down to a problem on how udhcpc6 parses DHCPv6-Options: When moving to next option, a pointer-address is increased and a length buffer is decreased by the length of the option. The problem is that it is done in this order: option += 4 + option[3]; len_m4 -= 4 + option[3]; But this has to be switched as the length is decreased by the length of the *next* option, not the current one. This affected both - internal checks if a required option is present and the function to expose options to the environment of the setup-script. There was also a bug parsing D6_OPT_STATUS_CODE Options, that made dnsmasq not work as udhcpc6 thought it is receiving a non-positive status-code (because it did not parse the status-code as required in RFC 3315). In addition we introduced basic support for RFC 3646 (OPTION_DNS_SERVERS and OPTION_DOMAIN_LIST) and RFC 4704 (OPTION_CLIENT_FQDN). " Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-27udhcp6: read_interface should save link-local ipv6 addressDenys Vlasenko
Patch is based on work by tiggerswelt.net. They say: "Using this patch it was no problem to acquire an IPv6-Address via DHCPv6 using ISC DHCPD6 on server-side." Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-17udhcpc: make sure we do not overflow poll timeoutDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-16udhcp: use poll() instead of select()Denys Vlasenko
function old new delta udhcp_sp_read 65 46 -19 udhcp_sp_fd_set 79 54 -25 udhcpd_main 1530 1482 -48 udhcpc_main 2780 2730 -50 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-142) Total: -142 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-04udhcp: tweak config order and menu item namesDenys Vlasenko
All other applets are listed simply by their name, no reason why dumpleases doesn't do that. Group all udhcpd feature options directly after it. Put "NOT READY" into udhcpc6 item (some users actually tried to use it, and complained). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-26udhcpc: Unconditionally call deconfig script, not only if lease is activePeter Korsgaard
The udhcpc script may be used to setup fallback configuration (E.G. IPv4LL, fixed IP address, ..) that also needs to be cleaned up on release (E.G. when SIGUSR2 is called or on shutdown with -R), so unconditionally call deconfig. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-06getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LISTDenys Vlasenko
In many cases, this aqllows to drop use of opt_complementary. Approximately -400 bytes: function old new delta getopt32 1423 1502 +79 opt_string 17 18 +1 OPT_STR 24 25 +1 uniq_main 416 406 -10 timeout_main 279 269 -10 sulogin_main 270 260 -10 readprofile_main 1825 1815 -10 ps_main 543 533 -10 pidof_main 245 235 -10 pgrep_main 611 601 -10 od_main 2600 2590 -10 mkfs_minix_main 2684 2674 -10 mkfs_ext2_main 2603 2593 -10 microcom_main 712 702 -10 makemime_main 315 305 -10 ionice_main 282 272 -10 inetd_main 2074 2064 -10 ifplugd_main 1144 1134 -10 halt_main 353 343 -10 getopt_main 636 626 -10 fdisk_main 2854 2844 -10 env_main 206 196 -10 dmesg_main 319 309 -10 conspy_main 1214 1204 -10 awk_main 981 971 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220) Total: -139 bytes text data bss dec hex filename 919373 906 14060 934339 e41c3 busybox_old 918969 906 14060 933935 e402f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-03udhcpc: run "deconfig" script in manual renew state too. closes 9061Denys Vlasenko
The bug was seen when the following is done: # killall 1 udhpc; killall 2 udhpc Performing a DHCP renew state: 2 -> 5 Sending renew... Entering released state state: 5 -> 6 <<<<<<<<<<<<<< not calling script!!!! Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21udhcp: add setup_common_bufsiz() as neededDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30udhcp: get rid of bb_info_msg()Denys Vlasenko
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>
2015-07-19libbb: add a function to make a copy of a region of memoryRon Yorston
Introduce a library routine to package the idiom: p = xmalloc(b, n); memcpy(p, b, n); and use it where possible. The example in traceroute used xzalloc but it didn't need to. function old new delta xmemdup - 32 +32 last_main 834 826 -8 make_device 2321 2311 -10 common_traceroute_main 3698 3685 -13 readtoken1 3182 3168 -14 procps_scan 1222 1206 -16 forkchild 655 638 -17 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/6 up/down: 32/-78) Total: -46 bytes Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-19udhcpc: fix BPF filter. Hopefully fixes the root cause of 4598 and 6746Denys Vlasenko
Use a *signed* large positive value in BPF filter to indicate success. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-28udhcpc6: fix port numbers used if !FEATURE_UDHCP_PORTDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-27udhcpc[6]: allow discover_retries == 0 (infinite)Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-27udhcpc: make -O <numeric_opt> work. Closes 5402Denys Vlasenko
function old new delta udhcpc_main 2642 2685 +43 udhcp_recv_raw_packet 414 415 +1 d6_recv_raw_packet 248 249 +1 udhcpc6_main 2430 2413 -17 add_client_options 239 213 -26 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/2 up/down: 45/-43) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-02udhcpc[6]: show select timeout in logDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-02udhcpc6: depend on ipv6Mike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-20fix build breakage found by randconfigDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-16udhcpc6: rudimentary code to export data to script; fix IAADDR parsingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-08udhcpc[6]: tweak help text, remove -B from udhcpc6 and "--version" from bothDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07udhcpc6: fix endiannessDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07udhcpc6: new applet. Not yet functional.Denys Vlasenko
It builds. It sends Solicit packets. Not sure these packets are well-formed. I have no server to test it against. function old new delta udhcpc6_main - 2426 +2426 d6_send_raw_packet - 428 +428 d6_send_kernel_packet - 274 +274 d6_recv_raw_packet - 248 +248 send_d6_discover - 177 +177 packed_usage 28795 28966 +171 d6_run_script - 156 +156 send_d6_renew - 140 +140 send_d6_release - 126 +126 d6_recv_kernel_packet - 116 +116 send_d6_select - 95 +95 perform_d6_release - 78 +78 d6_find_option - 74 +74 init_d6_packet - 54 +54 d6_copy_option - 48 +48 d6_mcast_from_client_config_ifindex - 42 +42 d6_dump_packet - 24 +24 static.FF02__1_2 - 16 +16 d6_store_blob - 13 +13 applet_names 2432 2440 +8 applet_main 1412 1416 +4 applet_nameofs 706 708 +2 add_d6_client_options - 1 +1 ------------------------------------------------------------------------------ (add/remove: 21/0 grow/shrink: 4/0 up/down: 4721/0) Total: 4721 bytes text data bss dec hex filename 879080 493 7584 887157 d8975 busybox_old 884585 497 7584 892666 d9efa busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>