From: Patrick McHardy <kaber@trash.net>
To: Laszlo Attila Toth <panther@balabit.hu>
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: Resend: [IPROUTE2 PATCH] Interface group as new ip link option
Date: Tue, 16 Oct 2007 11:11:29 +0200 [thread overview]
Message-ID: <47148041.1020607@trash.net> (raw)
In-Reply-To: <1192525384222-git-send-email-panther@balabit.hu>
Laszlo Attila Toth wrote:
> +static int set_group(const char *dev, int ifgroup)
> +{
> + struct {
> + struct nlmsghdr n;
> + struct ifinfomsg ifi;
> + char buf[256];
> + } req;
> + struct rtnl_handle rth;
> +
> + memset(&req, 0, sizeof(req));
> + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(req.ifi));
> + req.n.nlmsg_flags = NLM_F_REQUEST;
> + req.n.nlmsg_type = RTM_SETLINK;
> +
> + req.ifi.ifi_index = -1;
> +
> + addattr_l(&req.n, sizeof(req), IFLA_IFNAME, dev, strlen(dev)+1);
> + addattr_l(&req.n, sizeof(req), IFLA_IFGROUP, &ifgroup, sizeof(ifgroup));
> + if (rtnl_open(&rth, 0) < 0)
> + exit(1);
> + if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0)
> + return -1;
> + rtnl_close(&rth);
> + return 0;
> +}
> +
> static int get_address(const char *dev, int *htype)
> {
> struct ifreq ifr;
> @@ -545,6 +582,7 @@ static int do_set(int argc, char **argv)
> __u32 mask = 0;
> __u32 flags = 0;
> int qlen = -1;
> + __u32 group = 0;
> int mtu = -1;
> char *newaddr = NULL;
> char *newbrd = NULL;
> @@ -577,6 +615,13 @@ static int do_set(int argc, char **argv)
> duparg("txqueuelen", *argv);
> if (get_integer(&qlen, *argv, 0))
> invarg("Invalid \"txqueuelen\" value\n", *argv);
> + } else if (matches(*argv, "group") == 0) {
> + NEXT_ARG();
> + if (group != 0)
> + duparg("group", *argv);
> +
> + if (rtnl_ifgroup_a2n(&group, *argv) || group == 0)
> + invarg("\"group\" value is invalid\n", *argv);
> } else if (strcmp(*argv, "mtu") == 0) {
> NEXT_ARG();
> if (mtu != -1)
> @@ -696,6 +741,10 @@ static int do_set(int argc, char **argv)
> return -1;
> }
> }
> + if (group) {
> + if (set_group(dev, group) < 0)
> + return -1;
> + }
This part looks useless, for new kernels iproute always uses netlink
to configure things and old kernels don't support this feature. So
there's no need to support it in the ioctl-based configuration path.
next prev parent reply other threads:[~2007-10-16 9:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ifgroup.20071015.1192520046.panther@balabit.hu>
2007-10-16 8:01 ` [PATCH 0/2] Interface groups Laszlo Attila Toth
2007-10-16 8:01 ` Laszlo Attila Toth
2007-10-16 8:50 ` Philip Craig
2007-10-16 9:47 ` Laszlo Attila Toth
[not found] ` <1824b3d462b1d85aaf33941cf082c4e018d5bff7.1192460167.git.panther@balabit.hu>
2007-10-16 8:01 ` [PATCH 1/2] Interface group: core (netlink) part Laszlo Attila Toth
2007-10-16 8:34 ` Patrick McHardy
2007-10-16 8:01 ` Laszlo Attila Toth
[not found] ` <661f8f2fdb86cc70bdefd12403ecb0eaa7cfadd6.1192460168.git.panther@balabit.hu>
2007-10-16 8:01 ` [PATCH 2/2] Interface group match - netfilter part Laszlo Attila Toth
2007-10-16 8:30 ` Patrick McHardy
2007-10-16 9:46 ` Laszlo Attila Toth
2007-10-16 14:46 ` Jan Engelhardt
2007-10-17 9:08 ` Laszlo Attila Toth
2007-10-17 9:11 ` Patrick McHardy
2007-10-16 8:01 ` Laszlo Attila Toth
[not found] ` <a6713ba13c49b7fa20073d8abf1862480c2799e0.1192457385.git.panther@balabit.hu>
2007-10-16 8:01 ` [IPROUTE2 PATCH] Interface group as new ip link option Laszlo Attila Toth
2007-10-16 8:01 ` Laszlo Attila Toth
2007-10-16 8:38 ` Patrick McHardy
2007-10-16 9:33 ` Laszlo Attila Toth
2007-10-16 9:03 ` Resend: " Laszlo Attila Toth
2007-10-16 9:11 ` Patrick McHardy [this message]
2007-10-16 9:03 ` Laszlo Attila Toth
2007-10-16 10:45 ` jamal
2007-10-16 11:05 ` Laszlo Attila Toth
2007-10-16 11:26 ` jamal
2007-10-16 11:47 ` Laszlo Attila Toth
2007-10-16 12:08 ` jamal
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=47148041.1020607@trash.net \
--to=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=panther@balabit.hu \
/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).