Changeset View
Changeset View
Standalone View
Standalone View
sbin/ifconfig/ifvlan.c
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
#ifndef lint | #ifndef lint | ||||
static const char rcsid[] = | static const char rcsid[] = | ||||
"$FreeBSD$"; | "$FreeBSD$"; | ||||
#endif | #endif | ||||
#define NOTAG ((u_short) -1) | #define NOTAG ((u_short) -1) | ||||
static struct vlanreq params = { | static struct vlanreq params = { | ||||
melifaro: Nit: 802.1q for consistency? | |||||
.vlr_tag = NOTAG, | .vlr_tag = NOTAG, | ||||
}; | }; | ||||
static int | static int | ||||
getvlan(int s, struct ifreq *ifr, struct vlanreq *vreq) | getvlan(int s, struct ifreq *ifr, struct vlanreq *vreq) | ||||
{ | { | ||||
bzero((char *)vreq, sizeof(*vreq)); | bzero((char *)vreq, sizeof(*vreq)); | ||||
ifr->ifr_data = (caddr_t)vreq; | ifr->ifr_data = (caddr_t)vreq; | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | DECL_CMD_FUNC(setvlanpcp, val, d) | ||||
u_long ul; | u_long ul; | ||||
char *endp; | char *endp; | ||||
ul = strtoul(val, &endp, 0); | ul = strtoul(val, &endp, 0); | ||||
if (*endp != '\0') | if (*endp != '\0') | ||||
errx(1, "invalid value for vlanpcp"); | errx(1, "invalid value for vlanpcp"); | ||||
if (ul > 7) | if (ul > 7) | ||||
errx(1, "value for vlanpcp out of range"); | errx(1, "value for vlanpcp out of range"); | ||||
ifr.ifr_vlan_pcp = ul; | ifr.ifr_vlan_pcp = ul; | ||||
if (ioctl(s, SIOCSVLANPCP, (caddr_t)&ifr) == -1) | if (ioctl(s, SIOCSVLANPCP, (caddr_t)&ifr) == -1) | ||||
Not Done Inline ActionsMay I kindly ask for 0xABCD notation for other stacking protocols in the wild, like 0x9100. donner: May I kindly ask for 0xABCD notation for other stacking protocols in the wild, like 0x9100. | |||||
err(1, "SIOCSVLANPCP"); | err(1, "SIOCSVLANPCP"); | ||||
} | } | ||||
static | static | ||||
DECL_CMD_FUNC(unsetvlandev, val, d) | DECL_CMD_FUNC(unsetvlandev, val, d) | ||||
{ | { | ||||
struct vlanreq vreq; | struct vlanreq vreq; | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
size_t i; | size_t i; | ||||
for (i = 0; i < nitems(vlan_cmds); i++) | for (i = 0; i < nitems(vlan_cmds); i++) | ||||
cmd_register(&vlan_cmds[i]); | cmd_register(&vlan_cmds[i]); | ||||
af_register(&af_vlan); | af_register(&af_vlan); | ||||
callback_register(vlan_cb, NULL); | callback_register(vlan_cb, NULL); | ||||
clone_setdefcallback("vlan", vlan_create); | clone_setdefcallback("vlan", vlan_create); | ||||
clone_setdefcallback("svlan", vlan_create); | |||||
} | } |
Nit: 802.1q for consistency?