aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig/ifvlan.c
Commit message (Collapse)AuthorAgeFilesLines
* Ensure consistent error messages from ifconfig(8).Hans Petter Selasky2020-11-261-2/+1
| | | | | | | | | | | | | | | | | | | If multiple threads are invoking "ifconfig XXX create" a race may occur which can lead to two different error messages for the same error. a) ifconfig: SIOCIFCREATE2: File exists b) ifconfig: interface XXX already exists This patch ensures ifconfig prints the same error code for the same case. Reviewed by: imp@ and kib@ Differential Revision: https://reviews.freebsd.org/D27380 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=368058
* Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q).Alexander V. Chernikov2020-10-211-1/+77
| | | | | | | | | | | | | | | | | | | | | 802.1ad interfaces are created with ifconfig using the "vlanproto" parameter. Eg., the following creates a 802.1Q VLAN (id #42) over a 802.1ad S-VLAN (id #5) over a physical Ethernet interface (em0). ifconfig vlan5 create vlandev em0 vlan 5 vlanproto 802.1ad up ifconfig vlan42 create vlandev vlan5 vlan 42 inet 10.5.42.1/24 VLAN_MTU, VLAN_HWCSUM and VLAN_TSO capabilities should be properly supported. VLAN_HWTAGGING is only partially supported, as there is currently no IFCAP_VLAN_* denoting the possibility to set the VLAN EtherType to anything else than 0x8100 (802.1ad uses 0x88A8). Submitted by: Olivier Piras Sponsored by: RG Nets Differential Revision: https://reviews.freebsd.org/D26436 Notes: svn path=/head/; revision=366917
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-181-1/+3
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* Add support to priority code point (PCP) that is an 3-bit fieldMarcelo Araujo2016-06-061-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which refers to IEEE 802.1p class of service and maps to the frame priority level. Values in order of priority are: 1 (Background (lowest)), 0 (Best effort (default)), 2 (Excellent effort), 3 (Critical applications), 4 (Video, < 100ms latency), 5 (Video, < 10ms latency), 6 (Internetwork control) and 7 (Network control (highest)). Example of usage: root# ifconfig em0.1 create root# ifconfig em0.1 vlanpcp 3 Note: The review D801 includes the pf(4) part, but as discussed with kristof, we won't commit the pf(4) bits for now. The credits of the original code is from rwatson. Differential Revision: https://reviews.freebsd.org/D801 Reviewed by: gnn, adrian, loos Discussed with: rwatson, glebius, kristof Tested by: many including Matthew Grooms <mgrooms__shrew.net> Obtained from: pfSense Relnotes: Yes Notes: svn path=/head/; revision=301496
* Replace N #defines with nitems to simplify ifconfig code slightlyEnji Cooper2015-09-271-3/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=288305
* Stop including if_var.h from userland.Gleb Smirnoff2015-04-061-1/+0
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=281143
* Allow toggling of IFCAP_VLAN_HWCSUM for hardware that supports checksumBjoern A. Zeeb2011-12-171-0/+2
| | | | | | | | | | offloading on vlans and document the new option. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=228641
* Add TSO support on VLAN in fconfig(8).Pyun YongHyeon2010-02-201-0/+2
| | | | | | | Reviewed by: thompsa Notes: svn path=/head/; revision=204150
* - Use size_t instead of int when appropriate;Xin LI2009-06-231-1/+1
| | | | | | | | | - Use C99 sparse initialization. With these changes ifconfig(8) is WARNS=2 clean. Notes: svn path=/head/; revision=194799
* Replace clone_setcallback() with a new function clone_setdefcallback()Rui Paulo2009-02-271-4/+1
| | | | | | | | | | | that selects a callback from an interface prefix name. This allows us to report a meaningful error when the user types 'ifconfig wlan0 create', for example, and also kills some redundant code. Reviewed by: sam (earlier version) Notes: svn path=/head/; revision=189096
* back out unintended changeSam Leffler2008-12-151-30/+13
| | | | Notes: svn path=/head/; revision=186108
* o distinguish between adhoc and ahdemo modesSam Leffler2008-12-151-13/+30
| | | | | | | | | | o do not require 1/2 and 1/4 rate channels be present in the calibration list when doing a gsm regulatory change; the existing 900MHz cards are not self-identifying so there is no way (using the calibration channel list) to check Notes: svn path=/head/; revision=186101
* add duplicate cmd entries for vlan and vlandev that are marked !cloneSam Leffler2008-10-021-0/+3
| | | | | | | | | so they can be used when not doing a create operation Reviewed by: ed Notes: svn path=/head/; revision=183554
* Add support in ifconfig to control the vlan hardware filter feature.Jack F Vogel2008-08-281-0/+2
| | | | | | | | Reviewed by: EvilSam and moi MFC after:1 week Notes: svn path=/head/; revision=182414
* Fix handling of create operation together with setting other parameters:Sam Leffler2008-03-311-2/+2
| | | | | | | | | | | | | | o mark cmds/parameters to indicate they are potential arguments to a clone operation (e.g. vlantag) o when handling a create/clone operation do the callback on seeing the first non-clone cmd line argument so the new device is created and can be used; and re-setup operating state to reflect the newly created device Reviewed by: Eugene Grosbein MFC after: 2 weeks Notes: svn path=/head/; revision=177799
* o replace special handling of clone operations by a clone callbackSam Leffler2006-07-091-54/+78
| | | | | | | | | | mechanism o change vlan cloning to use callback and pass all vlan parameters on create using the new SIOCREATE2 ioctl o update vlan set logic to match existing practice Notes: svn path=/head/; revision=160196
* Revert to setting vlan and vlandev parametes synchronously, as soonYaroslav Tykhiy2006-03-091-0/+9
| | | | | | | | | | | | | | | | | | as both have been read from the command line. Still use the callback, but this time only to verify that both vlan and vlandev have been found on the command line. This should allow for control over the relative order of processing parameters, which is needed to satisfy some caveats of the if_vlan driver. E.g., MTU cannot be changed on a vlan interface until it's attached to its parent. PR: bin/94028 Reviewed by: ru MFC after: 3 days Notes: svn path=/head/; revision=156498
* Eliminate some unneeded code bits.Yaroslav Tykhiy2005-10-061-10/+7
| | | | Notes: svn path=/head/; revision=151000
* Use a callback to set up a vlan interface so that "vlan"Yaroslav Tykhiy2005-10-041-36/+30
| | | | | | | | | | | | and "vlandev" commands can be specified in any order. This makes the code more compact and clear as well. Improve error check on vlan argument. MFC after: 2 weeks Notes: svn path=/head/; revision=150907
* Deprecate the useless argument to -vlandev.Yaroslav Tykhiy2005-09-291-1/+5
| | | | | | | | | Submitted by: Fredrik Lindberg <fli+freebsd-current at shapeshifter.se> (implementation) Reviewed by: brooks MFC after: 5 days Notes: svn path=/head/; revision=150736
* Fix special status reporting. Prior to the reorg there wasSam Leffler2004-12-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | special-purpose code to display status for an interface for state that was not address-oriented. This status reporting was merged in to the address-oriented status reporting but did not work for link address reporting (as discovered with fwip interfaces). Correct this mis-merge and eliminate the bogus kludge that was used for link-level address reporting. o add an af_other_status method for an address family for reporting status of things like media, vlan, etc. o call the af_other_status methods after reporting address status for an interface o special-case link address status; when reporting all status for an interface invoke it specially prior to reporting af_other_status methods (since it requires the sockaddr_dl that is passed in to status separately from the rtmsg address state) o correct the calling convention for link address status; don't cast types, construct the proper parameter This fixes ifconfig on fwip interfaces. Notes: svn path=/head/; revision=139494
* Overhaul to cleanup some of the tangled logic that's grown over the years.Sam Leffler2004-12-081-5/+32
| | | | | | | | | | | | | | | | | | | | | | | o break per-address family support out into separate files o modularize per-address family and functional operations using a registration mechanism; this permits configuration according to which files you include (but beware that order of the files is important to insure backwards compatibility) o many cleanups to eliminate incestuous behaviour, global variables, and poor coding practices (still much more to fix) The original motivation of this work was to support dynamic addition of functionality based on the interface so we can eliminate the various little control programs and so that vendors can distribute ifconfig plugins that support their in-kernel code. That work is still to be completed. o Update 802.11 support for all the new net80211 functionality; some of these operations (e.g. list *) may be better suited in a different program Notes: svn path=/head/; revision=138593
* De-__P, use ansi function definitionsWarner Losh2002-04-181-15/+8
| | | | Notes: svn path=/head/; revision=95005
* o Reduce userland inclusion of kernel headers -- remove unneeded includeRobert Watson2001-09-241-1/+0
| | | | | | | | | of <sys/mbuf.h>. Reviewed by: jlemon Notes: svn path=/head/; revision=83888
* Removed duplicate VCS ID tags, as per style(9).Ruslan Ermilov2001-08-131-2/+0
| | | | Notes: svn path=/head/; revision=81586
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-2/+2
| | | | Notes: svn path=/head/; revision=50476
* Grrr... botched remote commit. Let's try this again: vlan updates,Bill Paul1999-03-151-0/+156
take two. Notes: svn path=/head/; revision=44764