Skip to content

Commit

Permalink
net: ipv4: Drop packet if source address is my address
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
jukkar committed Dec 22, 2023
1 parent 05867dc commit 6a666a6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions subsys/net/ip/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,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(&hdr->src)) {
NET_DBG("DROP: src addr is %s", "mine");
goto drop;
}
}

if (net_ipv4_is_addr_mcast(&hdr->src)) {
Expand Down

0 comments on commit 6a666a6

Please sign in to comment.