aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/dhcp6.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-07-08 16:02:56 -0700
committerRob Landley <rob@landley.net>2019-07-11 22:02:12 -0500
commita57721d14642291696be4ffd5d8bb0915fbe861b (patch)
tree11a18894601df31ce1eb9c46c5d1faaa59e2f9e8 /toys/pending/dhcp6.c
parent34f095fcbf0829719f9a130a359ebf2a3e223ca0 (diff)
downloadtoybox-a57721d14642291696be4ffd5d8bb0915fbe861b.tar.gz
bind/connect cleanup.
Rename the existing xbind/xconnect to xbindany/xconnectany, to make room for new xbind/xconnect that are more like 'x' versions of the regular bind and connect. Move explicit bind/connect callers over to xbind/xconnect. Of the affected commands, only netcat is actually used by Android. It was the most recent patch to netcat that made the lack of a more traditional xbind/xconnect apparent.
Diffstat (limited to 'toys/pending/dhcp6.c')
-rw-r--r--toys/pending/dhcp6.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/toys/pending/dhcp6.c b/toys/pending/dhcp6.c
index c69c4aed..728dc7d1 100644
--- a/toys/pending/dhcp6.c
+++ b/toys/pending/dhcp6.c
@@ -249,10 +249,7 @@ static void mode_raw()
sockll.sll_family = AF_PACKET;
sockll.sll_protocol = htons(ETH_P_IPV6);
sockll.sll_ifindex = if_nametoindex(TT.interface_name);
- if (bind(TT.sock, (struct sockaddr *) &sockll, sizeof(sockll))) {
- xclose(TT.sock);
- error_exit("MODE RAW : Bind fail.\n");
- }
+ xbind(TT.sock, (struct sockaddr *) &sockll, sizeof(sockll));
if (setsockopt(TT.sock, SOL_PACKET, PACKET_HOST,&constone, sizeof(int)) < 0) {
if (errno != ENOPROTOOPT) error_exit("MODE RAW : Bind fail.\n");
}
@@ -575,10 +572,7 @@ void dhcp6_main(void)
xsetsockopt(TT.sock1, SOL_SOCKET, SO_REUSEADDR, &constone, sizeof(constone));
- if (bind(TT.sock1, (struct sockaddr *)&sinaddr6, sizeof(sinaddr6))) {
- xclose(TT.sock1);
- error_exit("bind failed");
- }
+ xbind(TT.sock1, (struct sockaddr *)&sinaddr6, sizeof(sinaddr6));
mode_raw();
set_timeout(0);