[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Sun Dec 11 13:53:02 UTC 2011


details:   http://zrouter.org/hg/FreeBSD/head//rev/2230520c0499
changeset: 246:2230520c0499
user:      ray at terran.dlink.ua
date:      Sun Dec 11 15:53:23 2011 +0200
description:
Move ioctl for prefetch port configuration into place where we really know a port number.

diffstat:

 head/sbin/switchctl/switchctl.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r 8b4d52080601 -r 2230520c0499 head/sbin/switchctl/switchctl.c
--- a/head/sbin/switchctl/switchctl.c	Sun Dec 11 15:29:47 2011 +0200
+++ b/head/sbin/switchctl/switchctl.c	Sun Dec 11 15:53:23 2011 +0200
@@ -339,18 +339,19 @@
 	port_flags_set = 0;
 	bzero(&vlan_port, sizeof(vlan_port));
 	vlan_port.version = 0;
-	vlan_port.cmd = 0;
 	vlan_port.vlan_type = VLAN_TYPE_DOT1Q;
 
-	/* Get current port config */
-	if (ioctl(fd, IOCTL_VLAN_PORT_CONFIG,	&vlan_port) == -1)
-		err(1, "error from IOCTL_VLAN_PORT_CONFIG");
-
-	vlan_port.cmd = 1;
 	/* set port 7 pvid 17 flags WAN Q-in-Q IngressCheck */
 	if (argc >= 5) {
 		int idx = strtoul(argv[4], 0, 0);
 		vlan_port.index = idx;
+
+		vlan_port.cmd = 0;
+		/* Get current port config */
+		if (ioctl(fd, IOCTL_VLAN_PORT_CONFIG,	&vlan_port) == -1)
+		    err(1, "error from IOCTL_VLAN_PORT_CONFIG");
+
+
 		for (i = 5; i < argc; i++) {
 			if (argv[i] && argv[i+1] && strcasecmp(argv[i], "pvid") == 0 && strtoul(argv[i+1], 0, 0)) {
 				i ++; /* Skip to argument */
@@ -410,6 +411,8 @@
 				err(1, "Unknown field \"%s\"\n", argv[i]);
 			}
 		}
+
+		vlan_port.cmd = 1;
 		if (port_flags_set > 0)
 			vlan_port.d.dot1q.flags = port_flags;
 		if (ioctl(fd, IOCTL_VLAN_PORT_CONFIG,	&vlan_port) == -1)


More information about the Zrouter-src-freebsd mailing list