Skip to content

Commit 93874f0

Browse files
jukkarnashif
authored andcommitted
net: ipv4: Drop pkt if src address is unspecified
If we receive IPv4 packet where source address is unspecified (all zeros), then we need to drop it. Fixes #17427 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
1 parent 7ddd15c commit 93874f0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

subsys/net/ip/ipv4.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,17 @@ enum net_verdict net_ipv4_input(struct net_pkt *pkt)
150150
}
151151

152152
if (net_ipv4_is_addr_mcast(&hdr->src)) {
153-
NET_DBG("DROP: src addr is mcast");
153+
NET_DBG("DROP: src addr is %s", "mcast");
154154
goto drop;
155155
}
156156

157157
if (net_ipv4_is_addr_bcast(net_pkt_iface(pkt), &hdr->src)) {
158-
NET_DBG("DROP: src addr is bcast");
158+
NET_DBG("DROP: src addr is %s", "bcast");
159+
goto drop;
160+
}
161+
162+
if (net_ipv4_is_addr_unspecified(&hdr->src)) {
163+
NET_DBG("DROP: src addr is %s", "unspecified");
159164
goto drop;
160165
}
161166

0 commit comments

Comments
 (0)