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

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Fri Feb 3 15:31:02 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/7142a751aca2
changeset: 336:7142a751aca2
user:      ray at terran.dlink.ua
date:      Fri Feb 03 17:30:35 2012 +0200
description:
add pbvlan methods for Port Based VLAN setup

diffstat:

 head/sys/dev/switch/switch.c |  35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diffs (52 lines):

diff -r 1ba9fae8224d -r 7142a751aca2 head/sys/dev/switch/switch.c
--- a/head/sys/dev/switch/switch.c	Fri Feb 03 17:30:23 2012 +0200
+++ b/head/sys/dev/switch/switch.c	Fri Feb 03 17:30:35 2012 +0200
@@ -176,6 +176,26 @@
 }
 
 static int
+switch_pbvlan_sub(struct switch_softc *sc, struct vlan_vlan_config *vlan)
+{
+	int error = 0;
+
+	SWITCH_ASSERT_LOCKED(sc);
+
+	if (vlan->cmd == 1) {
+		/* Set */
+		error = SWITCH_PBVLAN_SETPORTS(sc->child, vlan->index,
+		    vlan->d.port.allowed);
+	} else {
+		/* Get */
+		error = SWITCH_PBVLAN_GETPORTS(sc->child, vlan->index,
+		    &vlan->d.port.allowed);
+	}
+
+	return (error);
+}
+
+static int
 vlan_config_sub(struct switch_softc *sc, struct vlan_config *vlan_config)
 {
 
@@ -206,6 +226,21 @@
 		return (EINVAL);
 	}
 
+	switch (vlan->vlan_type) {
+	case VLAN_TYPE_PORT:
+		error = switch_pbvlan_sub(sc, vlan);
+		return (error);
+		break;
+	case VLAN_TYPE_DOT1Q:
+		/* Handled here */
+		break;
+	case VLAN_TYPE_NONE:
+		return (0);
+	case VLAN_TYPE_ISL:
+	default:
+		return (EINVAL);
+	}
+
 	if (vlan->cmd == 1) {
 		/* Set */
 		if (vlan->vlan_type == VLAN_TYPE_DOT1Q) {


More information about the Zrouter-src-freebsd mailing list