Re: [PATCH 1/3] macvlan: Reflect macvlan packets meant for other macvlan devices

From: roel kluin
Date: Wed Nov 18 2009 - 05:01:04 EST


On Tue, Nov 17, 2009 at 11:39 PM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> From: Eric Biederman <ebiederm@xxxxxxxxxxxx>
>
> Switch ports do not send packets back out the same port they came
> in on.  This causes problems when using a macvlan device inside
> of a network namespace as it becomes impossible to talk to
> other macvlan devices.
>
> Signed-off-by: Eric Biederman <ebiederm@xxxxxxxxxxxx>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

I found a problem:

> @@ -140,20 +145,45 @@ static void macvlan_broadcast(struct sk_buff *skb,
>        }
>  }
>
> +static int macvlan_unicast(struct sk_buff *skb, const struct macvlan_dev *dest)
> +{
> +       struct net_device *dev = dest->dev;
> +
> +       if (unlikely(!dev->flags & IFF_UP)) {

parentheses are missing:

if (unlikely(!(dev->flags & IFF_UP))) {

> +               kfree_skb(skb);
> +               return NET_XMIT_DROP;
> +       }
> +
> +       skb = skb_share_check(skb, GFP_ATOMIC);
> +       if (!skb) {
> +               dev->stats.rx_errors++;
> +               dev->stats.rx_dropped++;
> +               return NET_XMIT_DROP;
> +       }
> +
> +       dev->stats.rx_bytes += skb->len + ETH_HLEN;
> +       dev->stats.rx_packets++;
> +
> +       skb->dev = dev;
> +       skb->pkt_type = PACKET_HOST;
> +       netif_rx(skb);
> +       return NET_XMIT_SUCCESS;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/