Skip to content

Commit 0f66e9c

Browse files
rlubosjhedberg
authored andcommitted
net: context: Don't assert on address family mismatch
Providing a wrong address to the connect() call by the application is no reason to assert, connect() should just return an error in such case. Therefore remove the faulty assert and replace it with error log instead. Signed-off-by: Robert Lubos <[email protected]>
1 parent db02fdc commit 0f66e9c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

subsys/net/ip/net_context.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,10 +1358,8 @@ int net_context_connect(struct net_context *context,
13581358
}
13591359

13601360
if (addr->sa_family != net_context_get_family(context)) {
1361-
NET_ASSERT(addr->sa_family == net_context_get_family(context),
1362-
"Family mismatch %d should be %d",
1363-
addr->sa_family,
1364-
net_context_get_family(context));
1361+
NET_ERR("Address family %d does not match network context family %d",
1362+
addr->sa_family, net_context_get_family(context));
13651363
ret = -EINVAL;
13661364
goto unlock;
13671365
}

0 commit comments

Comments
 (0)