Skip to content
Snippets Groups Projects
Commit cb60d370 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

server: remove address check from enable_pktinfo

parent 47b4e499
No related branches found
No related tags found
1 merge request!496udp-pktinfo: fix bsd recvdstaddr with socket bound to concrete address
......@@ -100,16 +100,13 @@ static bool enlarge_net_buffers(int sock, int min_recvsize, int min_sndsize)
/*!
* \brief Enable source packet information retrieval.
*/
static bool enable_pktinfo(int sock, struct sockaddr_storage *addr)
static bool enable_pktinfo(int sock, int family)
{
int level = 0;
int option = 0;
switch (addr->ss_family) {
switch (family) {
case AF_INET:
if (((struct sockaddr_in *)addr)->sin_addr.s_addr != INADDR_ANY) {
return true;
}
level = IPPROTO_IP;
#if defined(IP_PKTINFO)
option = IP_PKTINFO; /* Linux */
......@@ -200,7 +197,7 @@ static int server_init_iface(iface_t *new_if, struct sockaddr_storage *addr, int
warn_bufsize = true;
}
if (!enable_pktinfo(sock, addr)) {
if (sockaddr_is_any(addr) && !enable_pktinfo(sock, addr->ss_family)) {
log_warning("failed to enable received packet information retrieval");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment