net/inet: Add check for protocol before handing out TCP and UDP sockets.
This commit is contained in:
parent
261045e689
commit
fb3655e9f0
@ -1237,9 +1237,23 @@ FAR const struct sock_intf_s *
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef NET_UDP_HAVE_STACK
|
||||
if (type == SOCK_DGRAM && (protocol == 0 || protocol == IPPROTO_UDP))
|
||||
{
|
||||
return &g_inet_sockif;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef NET_TCP_HAVE_STACK
|
||||
if (type == SOCK_STREAM && (protocol == 0 || protocol == IPPROTO_TCP))
|
||||
{
|
||||
return &g_inet_sockif;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_INET_SOCKETS */
|
||||
|
Loading…
x
Reference in New Issue
Block a user