From: David Miller <davem@davemloft.net>
To: danms@us.ibm.com
Cc: containers@lists.osdl.org, netdev@vger.kernel.org, orenl@librato.com
Subject: Re: [PATCH 3/3] C/R: Basic support for network namespaces and devices (v2)
Date: Sat, 23 Jan 2010 01:25:37 -0800 (PST) [thread overview]
Message-ID: <20100123.012537.99190542.davem@davemloft.net> (raw)
In-Reply-To: <1264194592-7529-4-git-send-email-danms@us.ibm.com>
From: Dan Smith <danms@us.ibm.com>
Date: Fri, 22 Jan 2010 13:09:52 -0800
> + if (strcmp(dev->name, "sit0") == 0) {
> + return 0; /* Skip sit0 */
> + } else if (dev->ethtool_ops && dev->ethtool_ops->get_drvinfo) {
> + dev->ethtool_ops->get_drvinfo(dev, &drvinfo);
> + if (strcmp(drvinfo.driver, "veth") == 0)
> + return 1; /* vethX is okay */
> + } else if (strcmp(dev->name, "lo") == 0)
> + return 1; /* lo is okay */
...
> + if (strcmp(dev->name, "lo") == 0)
> + h->type = CKPT_NETDEV_LO;
> + else if (strncmp(dev->name, "veth", 4) == 0) {
> + h->type = CKPT_NETDEV_VETH;
> + peer = veth_get_peer(dev);
> + } else {
This is gross. You can't do things this way.
First of all, devices can get whatever name the user wants
to assign to them. If they want to rename the loopback
device to something other than "lo" they can.
You need another way. Is it such a stretch of ingenuity to
simply add an attribute flag to struct netdev that you can test
here and perhaps a callback for what you need?
Your direct calls into these drivers, like the veth bits, will not
work if the driver is built modular. It's one of several reasons
why doing things this way isn't going to work.
This misdesign is also why you find a need to get at the RTNL link ops
too. You have no infrastructure for doing what you need to do
generically, so instead you are forced to directly call into drivers
and export RTNL internals needlessly.
This needs a lot of work, sorry.
next prev parent reply other threads:[~2010-01-23 9:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-22 21:09 C/R: Network namespace and device support (v2) Dan Smith
2010-01-22 21:09 ` [PATCH 1/3] Expose rtnl_link_ops_get() Dan Smith
2010-01-22 21:09 ` [PATCH 2/3] Add a veth_get_peer() and veth_set_peer() functions Dan Smith
2010-01-22 21:09 ` [PATCH 3/3] C/R: Basic support for network namespaces and devices (v2) Dan Smith
2010-01-23 9:25 ` David Miller [this message]
[not found] ` <20100123.012537.99190542.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-01-23 15:19 ` Dan Smith
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=20100123.012537.99190542.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=containers@lists.osdl.org \
--cc=danms@us.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=orenl@librato.com \
/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).