From: Ben Greear <greearb@candelatech.com>
To: Pavel Emelianov <xemul@sw.ru>
Cc: David Miller <davem@davemloft.net>,
Patrick McHardy <kaber@trash.net>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Linux Netdev List <netdev@vger.kernel.org>,
Linux Containers <containers@lists.osdl.org>,
Kirill Korotaev <dev@sw.ru>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
devel@openvz.org,
Stephen Hemminger <shemminger@linux-foundation.org>
Subject: Re: [PATCH] Virtual ethernet device (tunnel)
Date: Wed, 02 May 2007 09:50:48 -0700 [thread overview]
Message-ID: <4638C168.2040308@candelatech.com> (raw)
In-Reply-To: <46386DFB.7090109@sw.ru>
Pavel Emelianov wrote:
> Veth stands for Virtual ETHernet. It is a simple tunnel driver
> that works at the link layer and looks like a pair of ethernet
> devices interconnected with each other.
>
> Mainly it allows to communicate between network namespaces but
> it can be used as is as well.
>
> Eric recently sent a similar driver called etun. This
> implementation is closer to the OpenVZ one and it lacks
> some unimportant features of etun driver (like ethtool_ops)
> for simplicity.
>
> The general difference from etun is that a netlink interface
> is used to create and destroy the pairs. The patch for an
> ip utility is also provided.
>
> Signed-off-by: Pavel Emelianov <xemul@openvz.org>
> Acked-By: Kirill Korotaev <dev@sw.ru>
> Acked-By: Dmitry Mishin <dim@openvz.org>
> Acked-By: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
>
In your veth_xmit method, do you perhaps also need to initialize
skb->mark to zero?
> +static int veth_create_pair(char *name, char *peer_name)
> +{
> + struct net_device *dev;
> + struct net_device *peer;
> + struct veth_struct *dev_veth;
> + struct veth_struct *peer_veth;
> + int err;
> +
> + dev = veth_dev_start(name);
> + if (IS_ERR(dev)) {
> + err = PTR_ERR(dev);
> + goto err;
> + }
> +
> + peer = veth_dev_start(peer_name);
> + if (IS_ERR(peer)) {
> + err = PTR_ERR(peer);
> + goto err_peer;
> + }
> +
> + dev_veth = dev->priv;
> + peer_veth = peer->priv;
> +
> + dev_veth->peer = peer;
> + dev_veth->dev = dev;
> + peer_veth->peer = dev;
> + peer_veth->dev = peer;
>
It looks like you add it to netdev list before you set up the peer, so
it could race
and crash on stale/null peer pointers?
> +
> + rtnl_lock();
> + list_add(&dev_veth->list, &veth_list);
> + INIT_LIST_HEAD(&peer_veth->list);
> + rtnl_unlock();
> + return 0;
>
Seems to me you might want get all of your state and internal list setup
completed before you register it with the
netdev list, though I'm not sure it matters in this case.
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
prev parent reply other threads:[~2007-05-02 16:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-02 10:54 [PATCH] Virtual ethernet device (tunnel) Pavel Emelianov
2007-05-02 10:57 ` [PATCH] Make ip utility veth driver aware Pavel Emelianov
2007-05-02 12:07 ` [Devel] [PATCH] Virtual ethernet device (tunnel) Daniel Lezcano
2007-05-02 12:27 ` Pavel Emelianov
2007-05-02 12:34 ` Patrick McHardy
2007-05-02 12:49 ` jamal
2007-05-02 12:59 ` Patrick McHardy
2007-05-02 13:40 ` Eric W. Biederman
2007-05-02 13:57 ` Patrick McHardy
2007-05-02 16:37 ` Stephen Hemminger
2007-05-02 16:50 ` Ben Greear [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4638C168.2040308@candelatech.com \
--to=greearb@candelatech.com \
--cc=containers@lists.osdl.org \
--cc=davem@davemloft.net \
--cc=dev@sw.ru \
--cc=devel@openvz.org \
--cc=ebiederm@xmission.com \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
--cc=xemul@sw.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).