Skip to content

Commit

Permalink
net: ipv4: Drop incoming packets with src addr is multicast
Browse files Browse the repository at this point in the history
As per RFC1112 sec 6.2 "A host group address must never be
placed in the source address field or anywhere in a source
route or record route option of an outgoing IP datagram."

Signed-off-by: Ravi kumar Veeramally <[email protected]>
  • Loading branch information
rveerama1 authored and carlescufi committed Nov 28, 2018
1 parent 3746652 commit 7a5640f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions subsys/net/ip/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ enum net_verdict net_ipv4_process_pkt(struct net_pkt *pkt)
goto drop;
}

if (net_ipv4_is_addr_mcast(&hdr->src)) {
NET_DBG("DROP: src addr is mcast");
goto drop;
}

if (net_ipv4_is_addr_bcast(net_pkt_iface(pkt), &hdr->src)) {
NET_DBG("DROP: src addr is bcast");
goto drop;
}

Expand Down

0 comments on commit 7a5640f

Please sign in to comment.