summaryrefslogtreecommitdiffstats
path: root/sys/net/if_vlan.c
Commit message (Collapse)AuthorAgeFilesLines
...
* - 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>
* Make sure that the entire header is in the first mbuf before wemdodd2000-02-031-2/+14
| | | | | | | | | | | | | | | attempt to copy the ethernet header forward and otherwise encapsulate a packet for output. This fixes the panic when using VLAN devices on hardware that doesn't do 802.1Q tagging onboard. (That is to say, all drivers except the Tigon.) My tests consisted of telnet, ttcp, and a pingflood of packets between 1 and 1600 (plus headers) bytes. MFC to follow in 1 week. Approved by: jkh
* Remove some #if NFOO > 0 that are always true because of config rules.peter2000-01-291-3/+0
|
* The current code incorrectly assumes that all vlansjkh1999-12-131-4/+3
| | | | | | | | | are configured, and/or associated with a parent device. If you receive a frame for a VLAN that's not in the list, you walk off the end of the list. Boom. Submitted by: C. Stephen Gunn <csg@waterspout.com> PR: 15291
* sys/net/if_vlan.c fails to maintain the IFF_RUNNING flag on thejkh1999-12-131-2/+3
| | | | | | | | vlan interfaces it manages. This prevents the interface from actually sending or receiving data. Submitted by: C. Stephen Gunn <csg@waterspout.com> PR: 15290
* Remove NBPF conditionality of bpf calls in most of our network drivers.phk1999-09-251-11/+0
| | | | | | | | | | | | This means that we will not have to have a bpf and a non-bpf version of our driver modules. This does not open any security hole, because the bpf core isn't loadable The drivers left unchanged are the "cross platform" drivers where the respective maintainers are urged to DTRT, whatever that may be. Add a couple of missing FreeBSD tags.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Rename bpfilter to bpf.des1999-07-061-8/+8
|
* Add missing SYSCTL_DECL(_net_link); required by newer sysctl implementation.wpaul1999-04-071-1/+2
| | | | Noticed by: Matthew Dodd <winter@jurai.net>
* Grrr... botched remote commit. Let's try this again: vlan updates,wpaul1999-03-151-1/+2
| | | | take two.
* Updates for vlan stuff:wpaul1999-03-151-25/+228
| | | | | | | | | | | | | - add support for devices that do vlan tag insertion/deletion in firmware - add multicast support - add vlan_unconfig() to complement vlan_config() - update ifconfig(8) to configure vlan interfaces (vlan tag and parent device) Also fix a small bug in ifconfig; sometimes sa_family is overwritten by ioctls. Reviewed by: wollman
* Examine all occurrences of sprintf(), strcat(), and str[n]cpy()archie1998-12-041-3/+3
| | | | | | | | | | | | | | for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc. These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer. Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
* Yow! Completely change the way socket options are handled, eliminatingwollman1998-08-231-3/+3
| | | | | | another specialized mbuf type in the process. Also clean up some of the cruft surrounding IPFW, multicast routing, RSVP, and other ill-explored corners.
* Fix an obvious parameter-order bogon. (Don't know what happened towollman1998-05-151-2/+2
| | | | the warning message before.)
OpenPOWER on IntegriCloud