aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig/af_link.c
Commit message (Collapse)AuthorAgeFilesLines
* ifconfig(8): optimize -f ether:dash modeAllan Jude2020-06-261-3/+3
| | | | | | | | | | | | Switch to the simplified while loop suggest by Aaron LI Post commit review via: https://reviews.freebsd.org/rS301185#inline-232 Submitted by: Aaron LI <aly@aaronly.me> Sponsored by: Klara Inc. Notes: svn path=/head/; revision=362654
* Allow to specify PCP on packets not belonging to any VLAN.Konstantin Belousov2018-03-271-69/+69
| | | | | | | | | | | | | | | | | | | | | | | | According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be considered as untagged, and only PCP and DEI values from the VLAN tag are meaningful. See for instance https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cg-switch-sw-master/software/configuration/guide/vlan0/b_vlan_0.html. Make it possible to specify PCP value for outgoing packets on an ethernet interface. When PCP is supplied, the tag is appended, VLAN id set to 0, and PCP is filled by the supplied value. The code to do VLAN tag encapsulation is refactored from the if_vlan.c and moved into if_ethersubr.c. Drivers might have issues with filtering VID 0 packets on receive. This bug should be fixed for each driver. Reviewed by: ae (previous version), hselasky, melifaro Sponsored by: Mellanox Technologies MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D14702 Notes: svn path=/head/; revision=331622
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. 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. Notes: svn path=/head/; revision=326025
* Selectively print "hwaddr" from ifconfig(8).Matt Joras2017-08-041-1/+9
| | | | | | | | | | | | | ifconfig(8) printing the hwaddr is only really useful if it differs from the link layer address. Reported by: jhb Reviewed by: rpokala Approved by: rstone (mentor) Differential Revision: https://reviews.freebsd.org/D11777 Notes: svn path=/head/; revision=322062
* Persistently store NIC's hardware MAC address, and add a way to retrive itRavi Pokala2017-05-101-1/+44
| | | | | | | | | | | | | | | | | | | | | The MAC address reported by `ifconfig ${nic} ether' does not always match the address in the hardware, as reported by the driver during attach. In particular, NICs which are components of a lagg(4) interface all report the same MAC. When attaching, the NIC driver passes the MAC address it read from the hardware as an argument to ether_ifattach(). Keep a second copy of it, and create ioctl(SIOCGHWADDR) to return it. Teach `ifconfig' to report it along with the active MAC address. PR: 194386 Reviewed by: glebius MFC after: 1 week Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D10609 Notes: svn path=/head/; revision=318160
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Indicate that this is a locally administered MAC address.Marcelo Araujo2016-09-271-1/+2
| | | | | | | | Submitted by: lidl Differential Revision: https://reviews.freebsd.org/D7903 Notes: svn path=/head/; revision=306371
* Add an option called "random" that combined with "ether" can generate aMarcelo Araujo2016-09-161-7/+17
| | | | | | | | | | | | random MAC address for an Ethernet interface. PR: 211984 Submitted by: pi@ Reviewed by: gnn, cem, jhb, lidl, rpokala, wblock Approved by: wblock (manpages) Notes: svn path=/head/; revision=305860
* Address feedback from hrs@ re: r301059 (ifconfig subnet mask)Allan Jude2016-06-021-13/+10
| | | | | | | | | | | | | - Use NI_MAXHOST to size buffers for getnameinfo() - remove non-standard 'full' inet6 address printing - remove 'no scope' option - use strchr(3) to optimize replacing separator character in lladdrs Reviewed by: gnn, jhb Differential Revision: https://reviews.freebsd.org/D2856 Notes: svn path=/head/; revision=301185
* ifconfig(8) now supports some output formatting optionsAllan Jude2016-05-311-2/+14
| | | | | | | | | | | | | | | | | | | specified by the -f flag or IFCONFIG_FORMAT environment variable, the user can request that inet4 subnet masks be printed in CIDR or dotted-quad notation, in addition to the traditional hex output. inet6 prefixes can be printed in CIDR as well. For more documentation see the ifconfig(8) man page. PR: 169072 Requested by: seanc, marcel, brd, many others Reviewed by: gnn, jhb (earlier version) Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D2856 Notes: svn path=/head/; revision=301059
* Ethernet vlan(4) interfaces have valid Ethernet link layer addresses butJohn Baldwin2010-08-061-1/+3
| | | | | | | | | | | use a different interface type (IFT_L2VLAN vs IFT_ETHER). Treat IFT_L2VLAN interfaces like IFT_ETHER interfaces when handling link layer addresses. Reviewed by: syrinx (bsnmpd) MFC after: 1 week Notes: svn path=/head/; revision=210936
* use getifaddrs from libc instead of private codeSam Leffler2007-02-241-5/+5
| | | | | | | | Reviewed by: bms MFC after: 1 month Notes: svn path=/head/; revision=166956
* Fix an off-by-one bug.Ruslan Ermilov2006-01-151-1/+1
| | | | | | | Submitted by: Ulrich Spoerlein Notes: svn path=/head/; revision=154401
* Fix special status reporting. Prior to the reorg there wasSam Leffler2004-12-311-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+125
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