net: vrf: Add support for sends to local broadcast address

This change “net: vrf: Add support for sends to local broadcast address” in Linux kernel is authored by David Ahern <dsahern [at]> on Wed Jan 24 19:37:37 2018 -0800.

net: vrf: Add support for sends to local broadcast address

Sukumar reported that sends to the local broadcast address
( are broken. Check for the address in vrf driver
and do not redirect to the VRF device - similar to multicast

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.

Reported-by: Sukumar Gopalakrishnan <>
Signed-off-by: David Ahern <>
Signed-off-by: David S. Miller <>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 1e19c4d.

There are 5 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 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 feb1b2e..139c61c 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))

The commit for this change in Linux stable tree is 1e19c4d (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *