lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <47148041.1020607@trash.net>
Date:	Tue, 16 Oct 2007 11:11:29 +0200
From:	Patrick McHardy <kaber@...sh.net>
To:	Laszlo Attila Toth <panther@...abit.hu>
CC:	netdev@...r.kernel.org, netfilter-devel@...r.kernel.org
Subject: Re: Resend: [IPROUTE2 PATCH] Interface group as new ip link option

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.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists