summaryrefslogtreecommitdiffstats
path: root/sys/net/if_vlan.c
Commit message (Collapse)AuthorAgeFilesLines
* if_printf() won't emit a newline unless told to.yar2004-05-261-2/+3
|
* After all the relevant drivers have been fixed, fix vlan(4) itselfyar2004-05-251-27/+27
| | | | | | | | | | WRT manipulating capabilities of the parent interface: - use ioctl(SIOCSIFCAP) to toggle VLAN_MTU (the way that was done before was just wrong); - use the right order of conditional clauses to set the MTU fudge (that is logically independent from toggling VLAN_MTU.)
* Consult parent's if_capenable for active VLAN-related capabilities.yar2004-05-231-1/+8
| | | | | | | | | | This change is possible since all the relevant drivers have been fixed to set if_capenable properly. The field if_capabilities tracks supported capabilities, which may be disabled administratively. Inheriting checksum offload support from the parent interface isn't that easy because the checksumming capabilities of the parent may be toggled on the fly. Disable the code for now.
* Added dependency on the miibus module.ru2004-05-211-0/+1
|
* Add route.h to pick up the rt_ifmsg() declaration.scottl2004-05-041-0/+1
|
* Link state change notification of ethernet media to the routing socket.andre2004-05-031-0/+25
| | | | | | | | | | | | | | | o Extend the if_data structure with an ifi_link_state field and provide the corresponding defines for the valid states. o The mii_linkchg() callback updates the ifi_link_state field and calls rt_ifmsg() to notify listeners on the routing socket in addition to the kqueue KNOTE. o If vlans are configured on a physical interface notify and update all vlan pseudo devices as well with the vlan_link_state() callback. No objections by: sam, wpaul, ru, bms Brucification by: bde
* arpcom untangling:luigi2004-04-241-1/+1
| | | | | | | | | | consistently with the rest of the code, use IFP2AC(ifp) to access the arpcom structure given the ifp. In this case also fix a difference in assumptions WRT the rest of the net/ sources: it is not the 'struct *softc' that starts with a 'struct arpcom', but a 'struct arpcom' that starts with a 'struct ifnet'
* backout the switch to use a zone for vlan tags; this requiressam2004-01-031-26/+4
| | | | vlans be present if any driver with h/w vlan tagging is configured
* switch vlan packet tag allocation to use a private zonesam2004-01-021-4/+26
|
* - vlan_start(): Increment the correct interface statistics member.ru2003-11-121-3/+3
| | | | | | Reviewed by: mdodd - vlan_input(): Macroize the VLAN tag extraction from mbuf.
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-4/+3
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Use VLANNAME instead of "vlan".brooks2003-10-281-4/+4
|
* Add locking. We use a single lock to guard the global vlan list and alsosam2003-09-051-17/+47
| | | | | | | | to protect the vlan state in each ifnet (e.g. vlan count). The latter is probably better handled through an ifnet-centric means but since changes are infrequent shouldn't matter for now. Sponsored by: FreeBSD Foundation
* - In vlan_input(), always mask off all but the VLID bits from tagswpaul2003-07-081-2/+10
| | | | | | | | | | | | extracted from received frames, both in the IFCAP_VLAN_HWTAGGING case and not. (Some drivers may already do this masking internally, but doing it here doesn't hurt and insures consistency.) - In vlan_ioctl(), don't let the user set a VLAN ID value with anything besides the VLID bits set, otherwise we will have trouble matching an interface in vlan_input() later. PR: kern/46405
* Testing VLANs with the new 8139C+ chip (which does hardware tagwpaul2003-07-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | insertion and extraction) has revealed two bugs: - In vlan_start(), we're supposed to check the underlying interface to see if it has the IFCAP_VLAN_HWTAGGING cabability set and, if so, set things up for the VLAN_OUTPUT_TAG() routine. However the code checks ifp->if_capabilities, which is the vlan pseudo-interface's capabilities when it should be checking p->if_capabilities, which relates to the underlying physical interface. Change ifp->if_capabilities to p->if_capabilities so this works. - In vlan_input(), we have to extract the 16-bit tag value from the received frame and use it to figure out which vlan interface gets the frame. The code that we use to track down the desired vlan pseudo-interface is: for (ifv = LIST_FIRST(&ifv_list); ifv != NULL; ifv = LIST_NEXT(ifv, ifv_list)) if (ifp == ifv->ifv_p && tag == ifv->ifv_tag) break; The problem is that 'tag' is not computed consistently. In the case where the interface supports hardware VLAN tag extraction and calls VLAN_INPUT_TAG(), we do this: tag = *(u_int*)(mtag+1); But in the software emulation case, we do this tag = EVL_VLANOFTAG(ntohs(evl->evl_tag)); The problem here is the EVL_VLANOFTAG() macro is only ever applied in this one case. It's never applied to ifv->ifv_tag or anwhere else. We must be consistent: either it's applied everywhere or nowhere. To see how this can be a problem, do something like ifconfig vlan0 vlan 12345 vlandev foo0 and observe the results. I'm not quite sure what the right thing is to do here. Neither the vlan(4) nor ifconfig(8) man pages suggest which way to go. For now, I've removed this use of EVL_VLANOFTAG() so that the tag will match correctly in all cases. I will not get upset if somebody makes a compelling argument for using EVL_VLANOFTAG() everywhere instead, as long as the use is consistent.
* correct two more flag misuses; m_tag* use malloc flagssam2003-03-121-1/+1
|
* sizeof(struct llc) -> LLC_SNAPFRAMELENmdodd2003-03-031-2/+2
| | | | | sizeof(struct ether_header) -> ETHER_HDR_LEN sizeof(struct fddi_header) -> FDDI_HDR_LEN
* Back out M_* changes, per decision of the TRB.imp2003-02-191-4/+4
| | | | Approved by: trb
* Implement SIOCGIFMEDIA for vlan devices by passing the request to thefenner2003-01-221-0/+23
| | | | | | | | parent device, if there is a parent configured. Modify the result returned by the parent to indicate that the only supported media is the currently configured one. Reviewed by: brooks
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-4/+4
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* o eliminate separate callback interface for h/w tagged input packets; insteadsam2002-11-141-142/+245
| | | | | | | | | | | | | | | | | | | | | drivers "tag packets" with an m_tag and the input packet handling recognizes such packets and does the right thing o track the number of active vlans on an interface; this lets lots of places only do vlan-specific processing when needed o track changes to ether_ifdetach/ether_ifattach o track bpf changes o eliminate the use of M_PROTO1 for communicating to drivers about tagged packets o eliminate the use of IFF_LINK0 for drivers communicating to the vlan code that they support h/w tagging; replaced by explicit interface capabilities o add ifnet capabilities for h/w tagging and support of "large mtu's" o use new interface capabilities to auto-configure use of large mtu's and h/w tagging o add support for proper handling of promiscuous mode o document driver/vlan communication conventions Reviewed by: many Approved by: re
* Add a cast to quiet a warning.jhb2002-11-071-1/+1
|
* Use if_printf(ifp, "blah") instead of printf("vlan%d: blah", ifp->if_unit).brooks2002-10-211-2/+2
|
* Move all unit number management cloned interfaces into the cloningbrooks2002-05-251-4/+3
| | | | | | | | code. The reverts the API change which made the <if>_clone_destory() functions return an int instead of void bringing us into closer alignment with NetBSD. Reviewed by: net (a long time ago)
* Fix a couple of incorrect m_free() vs. m_freem() usages and related issues.luigi2002-04-041-1/+3
| | | | Reviewed-by: brooks
* Simplify the interface cloning framework by handling unitmux2002-03-111-46/+5
| | | | | | | | | unit allocation with a bitmap in the generic layer. This allows us to get rid of the duplicated rman code in every clonable interface. Reviewed by: brooks Approved by: phk
* Change the network interface cloning API so the destroy function returnsbrooks2002-03-041-2/+3
| | | | | | | | an int errorcode instead of void in preperation for merging cloning of the loopback device. Submitted by: mux MFC after: 2 weeks
* When using hardware decoding, reconstruct the wire form of the ethernetbrooks2002-02-261-0/+20
| | | | | | | | header and push it up any attached bpf devices on the parent interface. This makes hardware vlan decoding more like the normal software path. Tested by: cjtt@employees.org MFC after: 2 weeks
* - Utilize the great M_ZERO flag rather than allocating memory then doarr2001-11-211-2/+1
| | | | a call to memset.
* Set the interface speed back to zero, after ether_ifattach() set itfenner2001-10-151-0/+1
| | | | | to 10Mbps. RFC 2863 says: "For a sub-layer which has no concept of bandwidth, [ifSpeed] should be zero."
* bring in ARP support for variable length link level addressesfjoe2001-10-141-1/+1
| | | | | | | Reviewed by: jdp Approved by: jdp Obtained from: NetBSD MFC after: 6 weeks
* - Fix typo in "didn't find tag in list" code -- != should have been ==.fenner2001-10-061-4/+5
| | | | | | | | | | | This fixes the panic when receiving a packet with an unknown tag, and also allows reception of packets with known tags. - Allow overlapping tag number spaces when using multiple hardware-assisted VLAN parent devices (by comparing the parent interface in vlan_input_tag() just as in vlan_input() ). - fix typo in comment MFC after: 1 week
* Wrap array accesses in macros, which also happen to be lvalues:jlemon2001-09-061-3/+3
| | | | | | | ifnet_addrs[i - 1] -> ifaddr_byindex(i) ifindex2ifnet[i] -> ifnet_byindex(i) This is intended to ease the conversion to SMPng.
* Make vlan(4) loadable, unloadable, and clonable. As a side effect,brooks2001-09-051-51/+129
| | | | | | | interfaces must now always enable VLAN support. Reviewed by: jlemon MFC after: 3 weeks
* Eliminate the panic, reported by Daniel Sobral, which occurs whenfenner2001-07-241-17/+36
| | | | | | | vlan_unconfig()-ing an interface on which multicast groups have been joined. Instead, keep the list of groups around (and, in fact, allow changing of the membership list) and re-join them when the vlan interface is reassociated with a lower level interface.
* Use the IANA assignment IFT_L2VLAN directly instead of indirecting throughfenner2001-07-241-2/+2
| | | | | | a privately #defined IFT_8021_VLAN. MFC after: 3 days
* Fix warning. s/char/unsigned char/ in "(char *)eth"peter2001-06-151-1/+1
| | | | 294: warning: ethernet address is not type unsigned char *
* Get IP multicast working on VLAN devices:fenner2001-05-021-1/+4
| | | | | | | | | | | - Allocate zeroed memory in ether_resolvemulti() to prevent equal() from comparing garbage and determining that two otherwise-equal sockaddr_dls are different. - Fill in all required fields of the sockaddr_dl - Actually copy the multicast address into the sockaddr_dl when calling if_addmulti() - Don't claim that we don't have a way to resolve layer 3 addresses into layer 2 addresses; use the ethernet way.
* Fix a number of minor bugs in the VLAN code:yar2001-03-281-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initialize the "struct sockaddr_dl sdl" correctly in vlan_setmulti(). PR: kern/22181 * The driver used to call malloc(..., M_NOWAIT), but to not check the return value. Change malloc(..., M_NOWAIT) to malloc(..., M_WAITOK) because the corresponding part of code is called from the upper half of the kernel only. PR: kern/22181 * Make sure a parent interface is up and running before invoking its if_start() routine in order to avoid system panic. PR: kern/22179 kern/24741 i386/25478 * Do not copy all the flags from a parent mindlessly. PR: kern/22179 * Do not call if_down() on a parent interface if it's already down. Call if_down() at splimp because if_down() needs that. PR: kern/22179 Reviewed by: wollman
* Fix another typo I missed on first reading:asmodai2001-02-141-1/+1
| | | | insersion -> insertion
* Fix typo and comma placement.asmodai2001-02-141-2/+2
|
* Convert if_multiaddrs from LIST to TAILQ so that it can be traversedphk2001-02-061-1/+1
| | | | | | backwards in the three drivers which want to do that. Reviewed by: mikeh
* Mechanical change to use <sys/queue.h> macro API instead ofphk2001-02-041-2/+1
| | | | | | | fondling implementation details. Created with: sed(1) Reviewed by: md5(1)
* Use <sys/queue.h> macro api rather than fondle its implementation detals.phk2001-02-031-6/+6
| | | | | Created with: /usr/bin/sed Reviewed by: /sbin/md5
* Exterminate the use of PSEUDO_SET() with extreme prejudice.peter2001-01-311-3/+26
|
* Lock down the network interface queues. The queue mutex must be obtainedjlemon2000-11-251-11/+3
| | | | | | | | | | | | | | before adding/removing packets from the queue. Also, the if_obytes and if_omcasts fields should only be manipulated under protection of the mutex. IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on the queue. An IF_LOCK macro is provided, as well as the old (mutex-less) versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which needs them, but their use is discouraged. Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF, which takes care of locking/enqueue, and also statistics updating/start if necessary.
* Make all Ethernet drivers attach using ether_ifattach() and detach usingarchie2000-07-131-3/+1
| | | | | | | | | ether_ifdetach(). The former consolidates the operations of if_attach(), ng_ether_attach(), and bpfattach(). The latter consolidates the corresponding detach operations. Reviewed by: julian, freebsd-net
* Move code to handle BPF and bridging for incoming Ethernet packets outarchie2000-05-141-26/+0
| | | | | | | | | | | | | | | of the individual drivers and into the common routine ether_input(). Also, remove the (incomplete) hack for matching ethernet headers in the ip_fw code. The good news: net result of 1016 lines removed, and this should make bridging now work with *all* Ethernet drivers. The bad news: it's nearly impossible to test every driver, especially for bridging, and I was unable to get much testing help on the mailing lists. Reviewed by: freebsd-net
* Remove duplicate wordcharnier2000-03-261-1/+1
|
* m_pullup() frees the supplied mbuf on failure; we don't need to trymdodd2000-02-071-5/+3
| | | | | | | and do this ourselves. Approved by: jkh Noticed by: Mike Spengler <mks@networkcs.com>
OpenPOWER on IntegriCloud