summaryrefslogtreecommitdiffstats
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* When removing ifnets, we should first remove the reference to ifnetglebius2011-04-041-9/+10
| | | | | | | | | | | from the interface index, then decrease refcount, not vice versa. Otherwise there is a race (reproducible) when if_free_internal() contests on IFNET_WLOCK(), and we got a zero-refed ifnet in the index for a long time. It may be picked by some other thread, that runs ifnet_byindex_ref(), who takes the ifnet from index, and bumps refcount. When reader drops the lock, if_free_internal() proceeds with free. Then reader tries to free it a second time.
* - Merge changes to the base system to support OFED. These includejeff2011-03-217-65/+232
| | | | | a wider arg2 for sysctl, updates to vlan code, IFT_INFINIBAND, and other miscellaneous small features.
* Remove dead code.dchagin2011-03-201-17/+0
| | | | MFC after: 1 Week
* ouch, newrt is used on the return path, my fault.dchagin2011-03-191-1/+1
| | | | | | Partialy revert the previous change. MFC after: 1 Week.
* A bit rearranged rtalloc1_fib() code.dchagin2011-03-191-6/+6
| | | | | | | Initialize a variable when it is really needed. To avoid code duplication move the miss label to line up and jump on it. MFC after: 1 Week
* Remove a now unused variable.dchagin2011-03-191-2/+1
| | | | MFC after: 1 Week
* Fix a panic that can happen when trying to destroy a lagg(4) with scheduler ↵eri2011-03-041-1/+2
| | | | | | | set to none. Approved by: thompsa(mentor) MFC after: 1 week
* Hide the outer IP addresses of a tunnel interfaces (gif(4), gre(4))bz2011-03-022-0/+26
| | | | | | | | | from processes inside jails if the addresses do not belong to the jail. Originally reported by: Pieter de Boer via remko PR: kern/151119 Tested by: Piotr KUCHARSKI (nospam 42.pl) [gif] MFC after: 1 week
* Fix typos - remove duplicate "the".brucec2011-02-212-2/+2
| | | | | | PR: bin/154928 Submitted by: Eitan Adler <lists at eitanadler.com> MFC after: 3 days
* Mfp4 CH=177274,177280,177284-177285,177297,177324-177325bz2011-02-161-15/+34
| | | | | | | | | | | | | | | | | | | | | | VNET socket push back: try to minimize the number of places where we have to switch vnets and narrow down the time we stay switched. Add assertions to the socket code to catch possibly unset vnets as seen in r204147. While this reduces the number of vnet recursion in some places like NFS, POSIX local sockets and some netgraph, .. recursions are impossible to fix. The current expectations are documented at the beginning of uipc_socket.c along with the other information there. Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH Reviewed by: jhb Tested by: zec Tested by: Mikolaj Golub (to.my.trociny gmail.com) MFC after: 2 weeks
* Mfp4 CH=177255:bz2011-02-111-3/+12
| | | | | | | | | | | | | | Resort the CURVNET_SET* macros in the non-VNET_DEBUG case to match the call order of the VNET_DEBUG case. Add the VNET_ASSERT() to the non-VNET_DEBUG case as well so that INVARIANTS will still catch problems. Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH Reviewed by: jhb MFC after: 2 weeks
* Mfp4 CH=177255:bz2011-02-113-15/+24
| | | | | | | | | | | | | | | | | Make VNET_ASSERT() available with either VNET_DEBUG or INVARIANTS. Change the syntax to match KASSERT() to allow more flexible panic messages rather than having a printf with hardcoded arguments before panic. Adjust the few assertions we have to the new format (and enhance the output). Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH Reviewed by: jhb MFC after: 2 weeks
* Mfp4 CH=177255:bz2011-02-111-2/+2
| | | | | | Use __func__ rather than __FUNCTION__. MFC after: 2 weeks
* As info.rti_info[RTAX_DST] can point inside of rtm we must not free the rtmmlaier2011-02-101-1/+3
| | | | | | | until rt_dispatch is done with the sockaddr. Found by: memguard MFC after: 3 days
* Fix a LOR by dropping the global ifnet locks while allocating a new ifnetjhb2011-01-241-6/+20
| | | | | | | | table in if_grow(). The order of the SYSINIT's for ifnet state were swapped so that the various locks were initialized before being used. Reviewed by: pluknet, bz MFC after: 2 weeks
* sysctl(8) should use the CTLTYPE to determine the type of data whenmdf2011-01-192-4/+5
| | | | | | | | | | | reading. (This was already done for writing to a sysctl). This requires all SYSCTL setups to specify a type. Most of them are now checked at compile-time. Remove SYSCTL_*X* sysctl additions as the print being in hex should be controlled by the -x flag to sysctl(8). Succested by: bde
* sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.mdf2011-01-123-7/+7
| | | | Commit the net* piece.
* Remove unneeded includes of <sys/linker_set.h>. Other headers that usejhb2011-01-111-1/+0
| | | | | | it internally contain nested includes. Reviewed by: bde
* MfP4 CH=185246 [1]:bz2011-01-091-0/+2
| | | | | | | Add FEATURE() to announce optional VIMAGE. MFC after: 3 days [1] for the moment put it in vnet.c.
* - Restore dropping the priority of syncer down to PPAUSE when it is idle.jhb2011-01-061-0/+5
| | | | | | | | | This was lost when it was converted to using a condition variable instead of lbolt. - Drop the priority of flowtable down to PPAUSE when it is idle as well since it is a similar background task. MFC after: 2 weeks
* Teach ifconfig(8) the handy shared option shortcut aliases the NetBSDmarius2011-01-051-0/+9
| | | | | | | | counterpart also takes, i.e. "fdx" for "full-duplex", "flow" for "flowcontrol", "hdx" for "half-duplex" as well as "loop" and "loopback" for "hw-loopback". MFC after: 1 week
* Fix whitespace.marius2011-01-051-37/+35
| | | | MFC after: 1 week
* Use NULL rather than 0 to invalidate a pointer.bz2010-12-311-9/+2
| | | | | | | | | | | Rather than duplicating the LLE_FREE_LOCKED() macro code in LLE_FREE(), call it directly (like we do for the RT_* macros). Sponsored by: ISPsystem [1] Reviewed by: julian [1] MFC After: 1 week [1] Early 2010.
* Print the vnet pointer under DDB when iterating over flowtables of eachbz2010-12-311-0/+3
| | | | | | | | | | virtual network stack instance. Sponsored by: ISPsystem [1] Reviewed by: julian [1] MFC after: 1 week [1] Early 2010.
* Move the increment operation under the lock and split the conditionbz2010-12-311-8/+10
| | | | | | | | | | | | | | | variable into two so that we can see on which one we are waiting. This might also more properly propagate the update of the flowclean_cycles flag and avoid "hangs" people were seeing. Suggested by: rwatson [1] Sponsored by: ISPsystem [1] Reviewed by: julian [1] Updated by: Mikolaj Golub (to.my.trociny gmail.com) Tested by: Mikolaj Golub (to.my.trociny gmail.com) MFC After: 1 week [1] Early 2010, initial version.
* Introduce and use a new VM interface for temporarily pinning pages. Thisalc2010-12-251-6/+2
| | | | | | | new interface replaces the combined use of vm_fault_quick() and pmap_extract_and_hold() throughout the kernel. In collaboration with: kib@
* Adds IFF_CANTCONFIG to IFF_CANTCHANGE that it shouldn't happen throughweongyo2010-12-071-1/+1
| | | | ioctl(2).
* Introduces IFF_CANTCONFIG interface flag to point that the interfaceweongyo2010-12-071-1/+1
| | | | | | | | | isn't configurable in a meaningful way. This is for ifconfig(8) or other tools not to change code whenever IFT_USB-like interfaces are registered at the interface list. Reviewed by: brooks No objections: gavin, jkim
* o Swap descriptions for net.bpf.bufsize and net.bpf.maxbufsize.maxim2010-11-241-2/+2
| | | | | PR: misc/152531 MFC after: 1 week
* Allow for vlan(4) ifnets to have overlapping unit numbers if they arezec2010-11-221-0/+42
| | | | | | | | | | | | | | | | created in separated vnets. As a side-effect of having a separated if_cloner instance for each vnet, all vlan ifnets created in a vnet will be automatically destroyed when vnet teardown is initiated. Disallow SIOCSETVLAN and SIOCGETVLAN ioctls on vlan ifnets which are associated with physical ifnets residing in parent vnets. This is an interim vlan-specific solution which will be superseded by a more generic if_cloner V_irtualization change from p4. For nooptions VIMAGE builds, this should be a no-op change. Discussed with: bz MFC after: 3 days
* After some off-list discussion, revert a number of changes to thedim2010-11-2210-36/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various people working on the affected files. A better long-term solution is still being considered. This reversal may give some modules empty set_pcpu or set_vnet sections, but these are harmless. Changes reverted: ------------------------------------------------------------------------ r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines Instead of unconditionally emitting .globl's for the __start_set_xxx and __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined. ------------------------------------------------------------------------ r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout the tree. ------------------------------------------------------------------------ r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE.
* Add a missing ';' and change the debugging sysctl from xint to int.bz2010-11-211-2/+2
| | | | | Submitted by: Mikolaj Golub (to.my.trociny gmail.com) MFC after: 3 days
* Instead of unconditionally emitting .globl's for the __start_set_xxx anddim2010-11-141-3/+4
| | | | | __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined.
* Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughoutdim2010-11-149-23/+23
| | | | the tree.
* Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE.dim2010-11-141-6/+9
|
* o Flesh out the generic IEEE 802.3 annex 31B full duplex flow controlmarius2010-11-141-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | support in mii(4): - Merge generic flow control advertisement (which can be enabled by passing by MIIF_DOPAUSE to mii_attach(9)) and parsing support from NetBSD into mii_physubr.c and ukphy_subr.c. Unlike as in NetBSD, IFM_FLOW isn't implemented as a global option via the "don't care mask" but instead as a media specific option this. This has the following advantages: o allows flow control advertisement with autonegotiation to be turned on and off via ifconfig(8) with the default typically being off (though MIIF_FORCEPAUSE has been added causing flow control to be always advertised, allowing to easily MFC this changes for drivers that previously used home-grown support for flow control that behaved that way without breaking POLA) o allows to deal with PHY drivers where flow control advertisement with manual selection doesn't work or at least isn't implemented, like it's the case with brgphy(4), e1000phy(4) and ip1000phy(4), by setting MIIF_NOMANPAUSE o the available combinations of media options are readily available from the `ifconfig -m` output - Add IFM_FLOW to IFM_SHARED_OPTION_DESCRIPTIONS and IFM_ETH_RXPAUSE and IFM_ETH_TXPAUSE to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so these are understood by ifconfig(8). o Make the master/slave support in mii(4) actually usable: - Change IFM_ETH_MASTER from being implemented as a global option via the "don't care mask" to a media specific one as it actually is only applicable to IFM_1000_T to date. - Let mii_phy_setmedia() set GTCR_MAN_MS in IFM_1000_T slave mode to actually configure manually selected slave mode (like we also do in the PHY specific implementations). - Add IFM_ETH_MASTER to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so it is understood by ifconfig(8). o Switch bge(4), bce(4), msk(4), nfe(4) and stge(4) along with brgphy(4), e1000phy(4) and ip1000phy(4) to use the generic flow control support instead of home-grown solutions via IFM_FLAGs. This includes changing these PHY drivers and smcphy(4) to no longer unconditionally advertise support for flow control but only if the selected media has IFM_FLOW set (or MIIF_FORCEPAUSE is set) and implemented for these media variants, i.e. typically only for copper. o Switch brgphy(4), ciphy(4), e1000phy(4) and ip1000phy(4) to report and set IFM_1000_T master mode via IFM_ETH_MASTER instead of via IFF_LINK0 and some IFM_FLAGn. o Switch brgphy(4) to add at least the the supported copper media based on the contents of the BMSR via mii_phy_add_media() instead of hardcoding them. The latter approach seems to have developed historically, besides causing unnecessary code duplication it was also undesirable because brgphy_mii_phy_auto() already based the capability advertisement on the contents of the BMSR though. o Let brgphy(4) set IFM_1000_T master mode on all supported PHY and not just BCM5701. Apparently this was a misinterpretation of a workaround in the Linux tg3 driver; BCM5701 seem to require RGPHY_1000CTL_MSE and BRGPHY_1000CTL_MSC to be set when configuring autonegotiation but this doesn't mean we can't set these as well on other PHYs for manual media selection. o Let ukphy_status() report IFM_1000_T master mode via IFM_ETH_MASTER so IFM_1000_T master mode support now is generally available with all PHY drivers. o Don't let e1000phy(4) set master/slave bits for IFM_1000_SX as it's not applicable there. Reviewed by: yongari (plus additional testing) Obtained from: NetBSD (partially), OpenBSD (partially) MFC after: 2 weeks
* Use 'z' modifier for size_t printing.kib2010-11-131-1/+1
|
* Similar to r212647, remove the workaround in sys/net/vnet.h for an lddim2010-11-121-9/+0
| | | | | | | | | bug (incorrect placement of __start_SECNAME in some cases) that was fixed in r210245. There is already an UPDATING entry about needing a recent ld. MFC after: 1 month
* Add a queue to hold packets while we await an ARP reply.gnn2010-11-122-4/+22
| | | | | | | | | | | | | | | | | | | | | | When a fast machine first brings up some non TCP networking program it is quite possible that we will drop packets due to the fact that only one packet can be held per ARP entry. This leads to packets being missed when a program starts or restarts if the ARP data is not currently in the ARP cache. This code adds a new sysctl, net.link.ether.inet.maxhold, which defines a system wide maximum number of packets to be held in each ARP entry. Up to maxhold packets are queued until an ARP reply is received or the ARP times out. The default setting is the old value of 1 which has been part of the BSD networking code since time immemorial. Expose the time we hold an incomplete ARP entry by adding the sysctl net.link.ether.inet.wait, which defaults to 20 seconds, the value used when the new ARP code was added.. Reviewed by: bz, rpaulo MFC after: 3 weeks
* Use the same treatment as in linker_set.h for the __start and __stopdim2010-11-111-0/+2
| | | | | | | | | | | symbols of the set_vnet and set_pcpu sections, so those symbols will always be emitted in kernel modules, if they use vnet.h or pcpu.h. Also, for pcpu.h, make the __(start|stop)_set_pcpu declarations, and associated macros invisible to userland, to prevent it picking up these symbols. Reviewed by: kib
* Sync DLTs with the latest pcap version.rpaulo2010-10-291-0/+137
|
* Factor out DDB commands from r204145, r204279 into if_debug.c for furtherbz2010-10-252-82/+126
| | | | | | | | | | | enhancements (1). Switch to a standard 2-clause BSD license for this (2). Unfortunately we have to un-static the ifindex_table for this but do not publicly export it. Suggested by: rwatson (1) a while back. Approved by: thompsa (2) for the change from r204279. MFC after: 6 days
* Reshuffle SIOCGIFCONF32 handler from r155224.pluknet2010-10-212-27/+29
| | | | | | | | | | | | | - move all the chunks into one file, which allows to hide SIOCGIFCONF32 global definition as well. - replace __amd64__ with proper COMPAT_FREEBSD32 around. - handle 32bit capacity before going into the handler itself instead of doing internal 32bit specific changes within it (e.g. as it's done for SIOCGDEFIFACE32_IN6). - use explicitely sized types for ABI compat. Approved by: kib (mentor) MFC after: 2 weeks
* Close a race acquiring the IF_ADDR_LOCK() for each entry while iteratingbz2010-10-161-0/+4
| | | | | | | | | over all interfaces to make sure the address will neither change nor be freed while we are working on it. PR: kern/146250 Submitted by: Mikolaj Golub (to.my.trociny gmail.com) MFC after: 1 week
* lltable_drain() has never been used so far, thus #if 0 it for now.bz2010-10-162-0/+6
| | | | | | | While touching it add the missing locking to the now disabled code for the time when we'll resurrect it. MFC after: 3 days
* Only hide the ifa and not the tp under #ifdef INET as the tp is neededbz2010-10-011-1/+1
| | | | | | for locking evenwhen there is no INET. MFC after: 3 days
* - Expand scope of tun/tap softc locks to cover more softc fields andjhb2010-09-222-145/+97
| | | | | | | | | | | | | | | | | driver-maintained ifnet fields (such as if_drv_flags). - Use soft locks as the mutex that protects each interface's knote list rather than using the global knote list lock. Also, use the softc for kn_hook instead of the cdev. - Use mtx_sleep() instead of tsleep() when blocking in the read routines. This fixes a lost wakeup race. - Remove D_NEEDGIANT now that the cdevsw routines use the softc lock where locking is needed. - Lock IFQ when calculating the result for FIONREAD in tap(4). tun(4) already did this. - Remove remaining spl calls. Submitted by: Marcin Cieslak saper of saper|info (3) MFC after: 2 weeks
* Fix a typo in a comment.jkim2010-09-161-1/+1
| | | | Submitted by: afiveg
* Replace sbuf_overflowed() with sbuf_error(), which returns any errormdf2010-09-101-2/+2
| | | | | | code associated with overflow or with the drain function. While this function is not expected to be used often, it produces more information in the form of an errno that sbuf_overflowed() did.
* MFp4 CH=183259:bz2010-09-021-2/+2
| | | | | | | No reason to use if_free_type() as we don't change our type. Just if_free() is fine. MFC after: 3 days
OpenPOWER on IntegriCloud