Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143216426
D51548.id159319.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D51548.id159319.diff
View Options
diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c
--- a/sbin/ifconfig/ifbridge.c
+++ b/sbin/ifconfig/ifbridge.c
@@ -79,6 +79,20 @@
return (0);
}
+static int
+get_vlan_id(const char *cp, ether_vlanid_t *valp)
+{
+ u_long val;
+
+ if (get_val(cp, &val) == -1)
+ return (-1);
+ if (val < DOT1Q_VID_MIN || val > DOT1Q_VID_MAX)
+ return (-1);
+
+ *valp = (ether_vlanid_t)val;
+ return (0);
+}
+
static int
do_cmd(if_ctx *ctx, u_long op, void *arg, size_t argsize, int set)
{
@@ -614,23 +628,13 @@
setbridge_untagged(if_ctx *ctx, const char *ifn, const char *vlanid)
{
struct ifbreq req;
- u_long val;
memset(&req, 0, sizeof(req));
+ strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname));
- if (get_val(vlanid, &val) < 0)
+ if (get_vlan_id(vlanid, &req.ifbr_untagged) < 0)
errx(1, "invalid VLAN identifier: %s", vlanid);
- /*
- * Reject vlan 0, since it's not a valid vlan identifier and has a
- * special meaning in the kernel interface.
- */
- if (val == 0)
- errx(1, "invalid VLAN identifier: %lu", val);
-
- strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname));
- req.ifbr_untagged = val;
-
if (do_cmd(ctx, BRDGSIFUNTAGGED, &req, sizeof(req), 1) < 0)
err(1, "BRDGSIFUNTAGGED %s", vlanid);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 28, 2:38 PM (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28066411
Default Alt Text
D51548.id159319.diff (1 KB)
Attached To
Mode
D51548: ifconfig/ifbridge.c: add get_vlan_id()
Attached
Detach File
Event Timeline
Log In to Comment