Skip to content

Commit

Permalink
net/ip: fix input packet filtering criteria
Browse files Browse the repository at this point in the history
The "is this packet for us?" filter in net_ipv4_input() has a minor
logic error which fails to discard many packets which are.. not for us.

Fixes: #14647

Signed-off-by: Charles E. Youse <[email protected]>
  • Loading branch information
Charles E. Youse committed Mar 19, 2019
1 parent 3a8767c commit e82769c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/net/ip/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ enum net_verdict net_ipv4_input(struct net_pkt *pkt)
goto drop;
}

if (!net_ipv4_is_my_addr(&hdr->dst) &&
!net_ipv4_is_addr_mcast(&hdr->dst) &&
if ((!net_ipv4_is_my_addr(&hdr->dst) &&
!net_ipv4_is_addr_mcast(&hdr->dst)) ||
((hdr->proto == IPPROTO_UDP &&
net_ipv4_addr_cmp(&hdr->dst, net_ipv4_broadcast_address()) &&
!IS_ENABLED(CONFIG_NET_DHCPV4)) ||
Expand Down

0 comments on commit e82769c

Please sign in to comment.