net: Check that net context is unset based on IP protocol

Rather than checking whether the remote port is zero, use the IP protocol
field. The remote port might be zero if all incoming connections will be
accepted.

Change-Id: Ia1f24ae94fab27c561267c7bbc0f709fe98ee7e8
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Patrik Flykt 2015-05-27 15:00:40 +03:00 committed by Anas Nashif
commit fa87944a08

View file

@ -119,7 +119,7 @@ struct net_context *net_context_get(enum ip_protocol ip_proto,
}
for (i = 0; i < NET_MAX_CONTEXT; i++) {
if (!contexts[i].tuple.remote_port) {
if (!contexts[i].tuple.ip_proto) {
contexts[i].tuple.ip_proto = ip_proto;
contexts[i].tuple.remote_addr = (struct net_addr *)remote_addr;
contexts[i].tuple.remote_port = remote_port;