diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-11-07 15:55:39 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-11-07 15:55:39 +0100 |
commit | 9ba75048c0099ed90b9a64cb7bb57bf12be93528 (patch) | |
tree | 172ef8f52da2e4fc4ee0f52aef3234b3bd170f96 /networking/udhcp/d6_socket.c | |
parent | 50089fc61c1dbb3d09c4bee21ab6d2aa44361ff9 (diff) | |
download | busybox-w32-9ba75048c0099ed90b9a64cb7bb57bf12be93528.tar.gz busybox-w32-9ba75048c0099ed90b9a64cb7bb57bf12be93528.tar.bz2 busybox-w32-9ba75048c0099ed90b9a64cb7bb57bf12be93528.zip |
udhcpc6: new applet. Not yet functional.
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>
Diffstat (limited to 'networking/udhcp/d6_socket.c')
-rw-r--r-- | networking/udhcp/d6_socket.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/networking/udhcp/d6_socket.c b/networking/udhcp/d6_socket.c new file mode 100644 index 000000000..56f69f6a1 --- /dev/null +++ b/networking/udhcp/d6_socket.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * Copyright (C) 2011 Denys Vlasenko. | ||
4 | * | ||
5 | * Licensed under GPLv2, see file LICENSE in this source tree. | ||
6 | */ | ||
7 | #include "common.h" | ||
8 | #include "d6_common.h" | ||
9 | #include <net/if.h> | ||
10 | |||
11 | int FAST_FUNC d6_listen_socket(int port, const char *inf) | ||
12 | { | ||
13 | int fd; | ||
14 | struct sockaddr_in6 addr; | ||
15 | |||
16 | log1("Opening listen socket on *:%d %s", port, inf); | ||
17 | fd = xsocket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP); | ||
18 | |||
19 | setsockopt_reuseaddr(fd); | ||
20 | if (setsockopt_broadcast(fd) == -1) | ||
21 | bb_perror_msg_and_die("SO_BROADCAST"); | ||
22 | |||
23 | /* NB: bug 1032 says this doesn't work on ethernet aliases (ethN:M) */ | ||
24 | if (setsockopt_bindtodevice(fd, inf)) | ||
25 | xfunc_die(); /* warning is already printed */ | ||
26 | |||
27 | memset(&addr, 0, sizeof(addr)); | ||
28 | addr.sin6_family = AF_INET6; | ||
29 | addr.sin6_port = htons(port); | ||
30 | /* addr.sin6_addr is all-zeros */ | ||
31 | xbind(fd, (struct sockaddr *)&addr, sizeof(addr)); | ||
32 | |||
33 | return fd; | ||
34 | } | ||