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 <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2023-12-19 12:31:37 +02:00 committed by Carles Cufí
parent 6d41e68352
commit 19392a6d2b

View File

@ -299,6 +299,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)) {