Last change
on this file since 3856 was 3621, checked in by Bruno Cornec, 8 years ago |
New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.
|
-
Property svn:eol-style
set to
native
|
File size:
864 bytes
|
Rev | Line | |
---|
[3621] | 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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.