etherswitchcfg.c (253568) | etherswitchcfg.c (253569) |
---|---|
1/*- 2 * Copyright (c) 2011-2012 Stefan Bethke. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2011-2012 Stefan Bethke. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sbin/etherswitchcfg/etherswitchcfg.c 253568 2013-07-23 13:40:26Z loos $ | 26 * $FreeBSD: head/sbin/etherswitchcfg/etherswitchcfg.c 253569 2013-07-23 13:56:38Z loos $ |
27 */ 28 29#include <sys/cdefs.h> | 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sbin/etherswitchcfg/etherswitchcfg.c 253568 2013-07-23 13:40:26Z loos $"); | 30__FBSDID("$FreeBSD: head/sbin/etherswitchcfg/etherswitchcfg.c 253569 2013-07-23 13:56:38Z loos $"); |
31 32#include <ctype.h> 33#include <err.h> 34#include <errno.h> 35#include <fcntl.h> 36#include <stdio.h> 37#include <stdlib.h> 38#include <string.h> --- 427 unchanged lines hidden (view full) --- 466print_vlangroup(struct cfg *cfg, int vlangroup) 467{ 468 etherswitch_vlangroup_t vg; 469 int i, comma; 470 471 vg.es_vlangroup = vlangroup; 472 if (ioctl(cfg->fd, IOETHERSWITCHGETVLANGROUP, &vg) != 0) 473 err(EX_OSERR, "ioctl(IOETHERSWITCHGETVLANGROUP)"); | 31 32#include <ctype.h> 33#include <err.h> 34#include <errno.h> 35#include <fcntl.h> 36#include <stdio.h> 37#include <stdlib.h> 38#include <string.h> --- 427 unchanged lines hidden (view full) --- 466print_vlangroup(struct cfg *cfg, int vlangroup) 467{ 468 etherswitch_vlangroup_t vg; 469 int i, comma; 470 471 vg.es_vlangroup = vlangroup; 472 if (ioctl(cfg->fd, IOETHERSWITCHGETVLANGROUP, &vg) != 0) 473 err(EX_OSERR, "ioctl(IOETHERSWITCHGETVLANGROUP)"); |
474 if (vg.es_vid == 0 && vg.es_member_ports == 0) | 474 if ((vg.es_vid & ETHERSWITCH_VID_VALID) == 0) |
475 return; | 475 return; |
476 vg.es_vid &= ETHERSWITCH_VID_MASK; |
|
476 printf("vlangroup%d:\n", vlangroup); 477 if (cfg->conf.vlan_mode == ETHERSWITCH_VLAN_PORT) 478 printf("\tport: %d\n", vg.es_vid); 479 else 480 printf("\tvlan: %d\n", vg.es_vid); 481 printf("\tmembers "); 482 comma = 0; 483 if (vg.es_member_ports != 0) --- 224 unchanged lines hidden --- | 477 printf("vlangroup%d:\n", vlangroup); 478 if (cfg->conf.vlan_mode == ETHERSWITCH_VLAN_PORT) 479 printf("\tport: %d\n", vg.es_vid); 480 else 481 printf("\tvlan: %d\n", vg.es_vid); 482 printf("\tmembers "); 483 comma = 0; 484 if (vg.es_member_ports != 0) --- 224 unchanged lines hidden --- |