Skip to content

Commit 32748c6

Browse files
jukkarcfriedt
authored andcommitted
net: ipv4: Drop packet if source address is my address
If we receive a packet where the source address is our own address, then we should drop it. Signed-off-by: Jukka Rissanen <[email protected]> (cherry picked from commit 19392a6)
1 parent 65104bc commit 32748c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

subsys/net/ip/ipv4.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ enum net_verdict net_ipv4_input(struct net_pkt *pkt, bool is_loopback)
272272
NET_DBG("DROP: localhost packet");
273273
goto drop;
274274
}
275+
276+
if (net_ipv4_is_my_addr(&hdr->src)) {
277+
NET_DBG("DROP: src addr is %s", "mine");
278+
goto drop;
279+
}
275280
}
276281

277282
if (net_ipv4_is_addr_mcast(&hdr->src)) {

0 commit comments

Comments
 (0)