Commit 7215f361 authored by Jukka Rissanen's avatar Jukka Rissanen Committed by Josh Lilly
Browse files

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: default avatarJukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 19392a6d)
parent 955db450
Loading
Loading
Loading
Loading
+5 −0
Changes for subsys/net/ip/ipv4.c: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -286,6 +286,11 @@ enum net_verdict net_ipv4_input(struct net_pkt *pkt, bool is_loopback)
			NET_DBG("DROP: localhost packet");
			goto drop;
		}

		if (net_ipv4_is_my_addr((struct in_addr *)hdr->src)) {
			NET_DBG("DROP: src addr is %s", "mine");
			goto drop;
		}
	}

	if (net_ipv4_is_addr_mcast((struct in_addr *)hdr->src)) {