Don't change socket to SOCK_PROMISC for bad iface

In src/server.c, server_setsockopt(), do not change socket state to
SOCK_PROMISC if the requested interface cannot be found
This commit is contained in:
XANTRONIX Development 2020-08-11 02:00:06 -04:00 committed by XANTRONIX Industrial
parent 4c427854da
commit acaa5dee0f

View file

@ -633,10 +633,6 @@ static int server_setsockopt(patty_ax25_server *server,
goto error_read;
}
if (data.state == PATTY_AX25_SOCK_PROMISC) {
sock->state = PATTY_AX25_SOCK_PROMISC;
}
if ((iface = patty_ax25_server_get_if(server, data.name)) == NULL) {
response.ret = -1;
response.eno = ENODEV;
@ -644,6 +640,10 @@ static int server_setsockopt(patty_ax25_server *server,
goto error_get_if;
}
if (data.state == PATTY_AX25_SOCK_PROMISC) {
sock->state = PATTY_AX25_SOCK_PROMISC;
}
patty_ax25_sock_bind_if(sock, iface);
fd_watch(server, sock->fd);