From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: [PATCH net-next 1/2] net: vrf: Add support for sends to local broadcast address Date: Wed, 24 Jan 2018 19:37:37 -0800 Message-ID: <20180125033738.28544-2-dsahern@gmail.com> References: <20180125033738.28544-1-dsahern@gmail.com> Cc: David Ahern To: netdev@vger.kernel.org Return-path: Received: from mail-pf0-f193.google.com ([209.85.192.193]:34165 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933615AbeAYDhr (ORCPT ); Wed, 24 Jan 2018 22:37:47 -0500 Received: by mail-pf0-f193.google.com with SMTP id e76so4831905pfk.1 for ; Wed, 24 Jan 2018 19:37:47 -0800 (PST) In-Reply-To: <20180125033738.28544-1-dsahern@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: Sukumar reported that sends to the local broadcast address (255.255.255.255) are broken. Check for the address in vrf driver and do not redirect to the VRF device - similar to multicast packets. With this change sockets can use SO_BINDTODEVICE to specify an egress interface and receive responses. Note: the egress interface can not be a VRF device but needs to be the enslaved device. https://bugzilla.kernel.org/show_bug.cgi?id=198521 Reported-by: Sukumar Gopalakrishnan Signed-off-by: David Ahern --- Dave: Really this is a day 1 bug that goes back to the beginning of VRF. IMO, backport to the 4.14 LTS kernel is sufficient; the multicast handling for IPv4 was only complete as of the 4.12 kernel. I directed this at net-next because it is not urgent for the 4.15 merge window. drivers/net/vrf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index feb1b2e15c2e..139c61c8244a 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -673,8 +673,9 @@ static struct sk_buff *vrf_ip_out(struct net_device *vrf_dev, struct sock *sk, struct sk_buff *skb) { - /* don't divert multicast */ - if (ipv4_is_multicast(ip_hdr(skb)->daddr)) + /* don't divert multicast or local broadcast */ + if (ipv4_is_multicast(ip_hdr(skb)->daddr) || + ipv4_is_lbcast(ip_hdr(skb)->daddr)) return skb; if (qdisc_tx_is_default(vrf_dev)) -- 2.11.0