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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 11 Feb 2011 16:27:05 +0100
From:	Jiri Pirko <jpirko@...hat.com>
To:	shemminger@...ux-foundation.org
Cc:	davem@...emloft.net, kaber@...sh.net, fubar@...ibm.com,
	netdev@...r.kernel.org
Subject: Re: [patch iproute2 2/4] implement slave management operations

Stephen,

I did not include include/linux/if_link.h changes here as I saw in
history it's been done in the same way. If they are needed I can repost.

Thanks, Jirka

Fri, Feb 11, 2011 at 04:22:15PM CET, jpirko@...hat.com wrote:
>
>Signed-off-by: Jiri Pirko <jpirko@...hat.com>
>---
> ip/ipaddress.c |   22 ++++++++++++++++++++++
> ip/iplink.c    |   16 ++++++++++++++++
> 2 files changed, 38 insertions(+), 0 deletions(-)
>
>diff --git a/ip/ipaddress.c b/ip/ipaddress.c
>index a775ecd..7446b81 100644
>--- a/ip/ipaddress.c
>+++ b/ip/ipaddress.c
>@@ -216,6 +216,18 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
> 		fprintf(fp, ", tx rate %d (Mbps)", vf_tx_rate->rate);
> }
> 
>+static void print_slave_info(FILE *fp, struct rtattr *sl)
>+{
>+	SPRINT_BUF(b1);
>+
>+	if (sl->rta_type != IFLA_SLAVE_DEV) {
>+		fprintf(stderr, "BUG: rta type is %d\n", sl->rta_type);
>+		return;
>+	}
>+
>+	fprintf(fp, " %s", ll_idx_n2a(*(int*)RTA_DATA(sl), b1));
>+}
>+
> int print_linkinfo(const struct sockaddr_nl *who,
> 		   struct nlmsghdr *n, void *arg)
> {
>@@ -420,6 +432,16 @@ int print_linkinfo(const struct sockaddr_nl *who,
> 			print_vfinfo(fp, i);
> 	}
> 
>+	if (tb[IFLA_SLAVE_LIST]) {
>+		struct rtattr *i, *slave_list = tb[IFLA_SLAVE_LIST];
>+		int rem = RTA_PAYLOAD(slave_list);
>+		fprintf(fp, "\n    slaves:");
>+		for (i = RTA_DATA(slave_list);
>+		     RTA_OK(i, rem);
>+		     i = RTA_NEXT(i, rem))
>+			print_slave_info(fp, i);
>+	}
>+
> 	fprintf(fp, "\n");
> 	fflush(fp);
> 	return 0;
>diff --git a/ip/iplink.c b/ip/iplink.c
>index cb2c4f5..02c48a2 100644
>--- a/ip/iplink.c
>+++ b/ip/iplink.c
>@@ -71,6 +71,7 @@ void iplink_usage(void)
> 	fprintf(stderr, "	                  [ vf NUM [ mac LLADDR ]\n");
> 	fprintf(stderr, "				   [ vlan VLANID [ qos VLAN-QOS ] ]\n");
> 	fprintf(stderr, "				   [ rate TXRATE ] ] \n");
>+	fprintf(stderr, "			  [ slave [ { add | del } ] DEVICE ]\n");
> 	fprintf(stderr, "       ip link show [ DEVICE ]\n");
> 
> 	if (iplink_have_newlink()) {
>@@ -361,6 +362,21 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
> 			if (len < 0)
> 				return -1;
> 			addattr_nest_end(&req->n, vflist);
>+		} else if (matches(*argv, "slave") == 0) {
>+			int type;
>+			int ifindex;
>+			NEXT_ARG();
>+			if (strcmp(*argv, "add") == 0)
>+				type = IFLA_SLAVE_ADD;
>+			else if (strcmp(*argv, "del") == 0)
>+				type = IFLA_SLAVE_DEL;
>+			else
>+				invarg("Invalid slave action\n", *argv);
>+			NEXT_ARG();
>+			ifindex = ll_name_to_index(*argv);
>+			if (!ifindex)
>+				invarg("Invalid slave device\n", *argv);
>+			addattr_l(&req->n, sizeof(*req), type, &ifindex, 4);
> #ifdef IFF_DYNAMIC
> 		} else if (matches(*argv, "dynamic") == 0) {
> 			NEXT_ARG();
>-- 
>1.7.3.4
>
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ