mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-18 10:54:03 -05:00
IAPP: Set SO_REUSEADDR on listening socket
Make it possible for several instances of hostapd to listen on the same network interface. Signed-off-by: Petko Bordjukov <bordjukov@gmail.com>
This commit is contained in:
parent
9d5d1c5dd2
commit
72a652d785
@ -381,6 +381,7 @@ struct iapp_data * iapp_init(struct hostapd_data *hapd, const char *iface)
|
|||||||
struct sockaddr_in *paddr, uaddr;
|
struct sockaddr_in *paddr, uaddr;
|
||||||
struct iapp_data *iapp;
|
struct iapp_data *iapp;
|
||||||
struct ip_mreqn mreq;
|
struct ip_mreqn mreq;
|
||||||
|
int reuseaddr = 1;
|
||||||
|
|
||||||
iapp = os_zalloc(sizeof(*iapp));
|
iapp = os_zalloc(sizeof(*iapp));
|
||||||
if (iapp == NULL)
|
if (iapp == NULL)
|
||||||
@ -443,6 +444,18 @@ struct iapp_data * iapp_init(struct hostapd_data *hapd, const char *iface)
|
|||||||
os_memset(&uaddr, 0, sizeof(uaddr));
|
os_memset(&uaddr, 0, sizeof(uaddr));
|
||||||
uaddr.sin_family = AF_INET;
|
uaddr.sin_family = AF_INET;
|
||||||
uaddr.sin_port = htons(IAPP_UDP_PORT);
|
uaddr.sin_port = htons(IAPP_UDP_PORT);
|
||||||
|
|
||||||
|
if (setsockopt(iapp->udp_sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr,
|
||||||
|
sizeof(reuseaddr)) < 0) {
|
||||||
|
wpa_printf(MSG_INFO,
|
||||||
|
"iapp_init - setsockopt[UDP,SO_REUSEADDR]: %s",
|
||||||
|
strerror(errno));
|
||||||
|
/*
|
||||||
|
* Ignore this and try to continue. This is fine for single
|
||||||
|
* BSS cases, but may fail if multiple BSSes enable IAPP.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
if (bind(iapp->udp_sock, (struct sockaddr *) &uaddr,
|
if (bind(iapp->udp_sock, (struct sockaddr *) &uaddr,
|
||||||
sizeof(uaddr)) < 0) {
|
sizeof(uaddr)) < 0) {
|
||||||
wpa_printf(MSG_INFO, "iapp_init - bind[UDP]: %s",
|
wpa_printf(MSG_INFO, "iapp_init - bind[UDP]: %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user