Commit 6afafb12 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

sk-inet: if a source port isn't zero, a socket should be bound (v2)

Now crtools checks address, but it may be zero. For example,
a listen socket is bound to zero address to accept connections
from any addresses.

v2: add a comment about zero port
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 51133437
......@@ -279,12 +279,10 @@ int inet_collect_one(struct nlmsghdr *h, int family, int type, int proto)
return ret;
}
static u32 zero_addr[4];
static bool is_bound(struct inet_sk_info *ii)
{
return memcmp(zero_addr, ii->ie->src_addr, pb_repeated_size(ii->ie, src_addr)) ||
memcmp(zero_addr, ii->ie->dst_addr, pb_repeated_size(ii->ie, dst_addr));
/* zero port is reserved */
return ii->ie->src_port;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment