summaryrefslogtreecommitdiffstats
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* Fix -Wundef from compiling the amd64 LINT.ru2005-12-041-1/+1
|
* Fix -Wundef.ru2005-12-041-4/+4
|
* The bridge is capable of sending broadcast packets so enable IFF_BROADCASTthompsa2005-11-291-1/+1
| | | | Requested by: des
* Take if_baudrate from the parent. This fixes problem with SNMPglebius2005-11-281-0/+1
| | | | daemons reporting zero speed for vlan(4) interfaces.
* Fix the following bugs:ru2005-11-241-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In ifc_name2unit(), disallow leading zeroes in a unit. Exploit: ifconfig lo01 create - In ifc_name2unit(), properly handle overflows. Otherwise, either of two local panic()'s can occur, either because no interface with such a name could be found after it was successfully created, or because the code will bogusly assume that it's a wildcard (unit < 0 due to overflow). Exploit: ifconfig lo<overflowed_integer> create - Previous revision made the following sequence trigger a KASSERT() failure in queue(3): Exploit: ifconfig lo0 destroy; ifconfig lo0 destroy This is because IFC_IFLIST_REMOVE() is always called before ifc->ifc_destroy() has been run, not accounting for the fact that the latter can fail and leave the interface operating (like is the case for "lo0"). So we ended up calling LIST_REMOVE() twice. We cannot defer IFC_IFLIST_REMOVE() until after a call to ifc->ifc_destroy() because the ifnet may have been removed and its memory has been freed, so recover from this by re-inserting the ifnet in the cloned interfaces list if ifc->ifc_destroy() indicates a failure.
* Purge layer specific mbuf flags on layer crossings to avoid confusingandre2005-11-181-0/+3
| | | | | | upper or lower layers. Sponsored by: TCP/IP Optimization Fundraise 2005
* Fix a second missed case where the refcount is not decremented.thompsa2005-11-131-2/+3
| | | | MFC after: 3 days
* Fix a mbuf and refcnt leak in the broadcast code.thompsa2005-11-131-4/+4
| | | | | | | If the packet is rejected from pfil(9) then continue the loop rather than returning, this means that we can still try to send it out the remaining interfaces but more importantly the mbuf is freed and refcount decremented on exit.
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-1114-65/+46
| | | | | | | | | | rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
* Use the more appropriate ifnet_byindex() instead of ifaddr_byindex().ru2005-11-111-2/+2
|
* Force this interface to be RUNNING.glebius2005-11-111-0/+1
|
* - Make IFP2ENADDR() a pointer to IF_LLADDR() rather than anotherru2005-11-118-44/+18
| | | | | | | | copy of Ethernet address. - Change iso88025_ifattach() and fddi_ifattach() to accept MAC address as an argument, similar to ether_ifattach(), to make this work.
* Use sparse initializers for "struct domain" and "struct protosw",ru2005-11-093-26/+43
| | | | so they are easier to follow for the human being.
* Move the cloned interface list management in to if_clone. For some drivers thethompsa2005-11-0812-125/+63
| | | | | | | | | | softc lists and associated mutex are now unused so these have been removed. Calling if_clone_detach() will now destroy all the cloned interfaces for the driver and in most cases is all thats needed to unload. Idea by: brooks Reviewed by: brooks
* - Do not raise IFF_DRV_OACTIVE flag in vlan_start, because thisglebius2005-11-061-2/+8
| | | | | | | can lead to stalled interface - Explain this fact in a comment. Reviewed by: rwatson, thompsa, yar
* Retire MT_HEADER mbuf type and change its users to use MT_DATA.andre2005-11-021-1/+1
| | | | | | | | | | | | Having an additional MT_HEADER mbuf type is superfluous and redundant as nothing depends on it. It only adds a layer of confusion. The distinction between header mbuf's and data mbuf's is solely done through the m->m_flags M_PKTHDR flag. Non-native code is not changed in this commit. For compatibility MT_HEADER is mapped to MT_DATA. Sponsored by: TCP/IP Optimization Fundraise 2005
* If we have been called from ether_ifdetach() then do not try and clear thethompsa2005-10-231-20/+25
| | | | | | | | | promisc flag from the member interface, this is a no-op anyway since the interface is disappearing. The driver may have already released its resources such as miibus and this is likely to panic the kernel. Submitted and tested by: Wojciech A. Koszek MFC after: 2 weeks
* Before we export network interface data through the ifmibdata structure,csjp2005-10-231-1/+1
| | | | | | OR the flags bits with the driver managed status flags. This fixes an issue where RUNNING flags would not be reported to processes, which conflicts with the flags information provided by ifconfig(8).
* Use new (inline) functions for calls into driver.phk2005-10-162-7/+5
|
* Make four more functions static that were missed in the last commit.thompsa2005-10-141-5/+5
|
* Change most of the bridge and stp funtions to static. This has highlightedthompsa2005-10-142-209/+226
| | | | | | | | | | | that the following funtions are not used, wrap in '#ifdef noused' for the moment. bstp_enable_change_detection bstp_disable_change_detection bstp_set_bridge_priority bstp_set_port_priority bstp_set_path_cost
* Further clean up the bridge hooks in if_ethersubr.c and ng_ether.cthompsa2005-10-144-31/+33
| | | | | | - move the function pointer definitions to if_bridgevar.h - move most of the logic to the new BRIDGE_INPUT and BRIDGE_OUTPUT macros - remove unneeded functions from if_bridgevar.h and sort a little.
* From 101 ways to panic your kernel.thompsa2005-10-132-1/+13
| | | | | | Use bridge_ifdetach() to notify the bridge that a member has been detached. The bridge can then remove it from its interface list and not try to send out via a dead pointer.
* Consolidate two adjacent conditional blocksjulian2005-10-131-5/+1
| | | | | | | I actually believe the code in question should be elsewhere (in the preceding function). MFC after: 1 week
* Remove a stale comment.ru2005-10-131-1/+0
|
* Clean up the if_bridge hooks a bit in if_ethersubr.c and ng_ether.c, movethompsa2005-10-132-14/+10
| | | | | | the broadcast/multicast test to bridge_input(). Requested by: glebius
* Change the reference counting to count the number of cloned interfaces for eachthompsa2005-10-128-101/+61
| | | | | | | | | | | | | | | cloner. This ensures that ifc->ifc_units is not prematurely freed in if_clone_detach() before the clones are destroyed, resulting in memory modified after free. This could be triggered with if_vlan. Assert that all cloners have been destroyed when freeing the memory. Change all simple cloners to destroy their clones with ifc_simple_destroy() on module unload so the reference count is properly updated. This also cleans up the interface destroy routines and allows future optimisation. Discussed with: brooks, pjd, -current Reviewed by: brooks
* Be pedantic here: We're converting from network byte order to hostimp2005-10-121-2/+2
| | | | | | | byte order in these cases. This is a nop in terms of the generated code, but is logically incorrect. PR: 73852
* Do not unconditionally set a spanning tree port to forwarding as the link may bethompsa2005-10-111-1/+1
| | | | | | down when we attach. We wont get updated until a linkstate change happens. Go via bstp_ifupdstatus() which checks the media status first.
* A deja vu of:glebius2005-10-071-1/+4
| | | | | | | | | | | | | | http://lists.freebsd.org/pipermail/cvs-src/2004-October/033496.html The same problem applies to if_bridge(4), too. - Copy-and-paste the if_bridge(4) related block from if_ethersubr.c to ng_ether.c - Add XXXs, so that copy-and-paste would be noticed by any future editors of this code. - Also add XXXs near if_bridge(4) declarations. Silence from: thompsa
* Fixing a boot time panic(when if_fwip is compiled into kernel) by renamingavatar2005-10-061-3/+3
| | | | | | | | | module name to something that wouldn't conflict with sys/dev/firewire/firewire.c. Submitted by: Cai, Quanqing <caiquanqing at gmail dot com> PR: kern/82727 MFC after: 3 days
* Fix KASSERT function name in ether_output, use __func__ while I am here.thompsa2005-10-061-2/+2
|
* - Don't pollute opt_global.h with DEVICE_POLLING and introduceglebius2005-10-051-0/+1
| | | | | | | | | opt_device_polling.h - Include opt_device_polling.h into appropriate files. - Embrace with HAVE_KERNEL_OPTION_HEADERS the include in the files that can be compiled as loadable modules. Reviewed by: bde
* Protect PID initializations for statistics by the bpf descriptorcsjp2005-10-041-2/+6
| | | | | | | locks. Also while we are here, protect the bpf descriptor during knlist_remove{add} operations. Discussed with: rwatson
* Rename net.isr.enable to net.isr.dispatch.rwatson2005-10-041-5/+5
| | | | | | | | No compatibility code is provided, as this will be the production name as of 6.0. MFC after: 3 days Requested by: scottl
* Improve handling flags that must be propagatedyar2005-10-031-37/+84
| | | | | | | | | | to the parent interface, such as IFF_PROMISC and IFF_ALLMULTI. In addition, vlan(4) gains ability to migrate from one parent to another w/o losing its own flags. PR: kern/81978 MFC after: 2 weeks
* Clean up consistency checks in if_setflag():yar2005-10-031-18/+11
| | | | | | . use KASSERT for all checks so that the source of an error can be detected; . use __func__ instead of spelling function name each time; . fix a typo.
* Log a message about entering or leaving permanently promiscuous mode,yar2005-10-031-6/+10
| | | | | | as it is done for usual promiscuous mode already. This info is important because promiscuous mode in the hands of a malicious party can jeopardize the whole network.
* Do not packet filter in the bridge_start() routine, locally generated packetsthompsa2005-10-021-20/+9
| | | | | | | are already filtered by the higher layers. Approved by: mlaier (mentor) MFC after: 3 days
* Big polling(4) cleanup.glebius2005-10-012-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Axe poll in trap. o Axe IFF_POLLING flag from if_flags. o Rework revision 1.21 (Giant removal), in such a way that poll_mtx is not dropped during call to polling handler. This fixes problem with idle polling. o Make registration and deregistration from polling in a functional way, insted of next tick/interrupt. o Obsolete kern.polling.enable. Polling is turned on/off with ifconfig. Detailed kern_poll.c changes: - Remove polling handler flags, introduced in 1.21. The are not needed now. - Forget and do not check if_flags, if_capenable and if_drv_flags. - Call all registered polling handlers unconditionally. - Do not drop poll_mtx, when entering polling handlers. - In ether_poll() NET_LOCK_GIANT prior to locking poll_mtx. - In netisr_poll() axe the block, where polling code asks drivers to unregister. - In netisr_poll() and ether_poll() do polling always, if any handlers are present. - In ether_poll_[de]register() remove a lot of error hiding code. Assert that arguments are correct, instead. - In ether_poll_[de]register() use standard return values in case of error or success. - Introduce poll_switch() that is a sysctl handler for kern.polling.enable. poll_switch() goes through interface list and enabled/disables polling. A message that kern.polling.enable is deprecated is printed. Detailed driver changes: - On attach driver announces IFCAP_POLLING in if_capabilities, but not in if_capenable. - On detach driver calls ether_poll_deregister() if polling is enabled. - In polling handler driver obtains its lock and checks IFF_DRV_RUNNING flag. If there is no, then unlocks and returns. - In ioctl handler driver checks for IFCAP_POLLING flag requested to be set or cleared. Driver first calls ether_poll_[de]register(), then obtains driver lock and [dis/en]ables interrupts. - In interrupt handler driver checks IFCAP_POLLING flag in if_capenable. If present, then returns.This is important to protect from spurious interrupts. Reviewed by: ru, sam, jhb
* Remove bridge(4) from the tree. if_bridge(4) is a full functionalmlaier2005-09-273-1447/+2
| | | | | | | | replacement and has additional features which make it superior. Discussed on: -arch Reviewed by: thompsa X-MFC-after: never (RELENG_6 as transition period)
* Fix an alignment panic my preserving the 2byte padding (ETHER_ALIGN) on ourthompsa2005-09-221-1/+1
| | | | | | | | | copied mbuf, which keeps the IP header 32-bit aligned. This copied mbuf is reinjected back into ether_input and off to the IP routines. Reported and tested by: Peter van Dijk Approved by: mlaier (mentor) MFC after: 3 days
* Several fixes to rt_setgate(), that fix problems with route changing:glebius2005-09-211-35/+30
| | | | | | | | | | | | | | | - Rearrange code so that in a case of failure the affected route is not changed. Otherwise, a bogus rtentry will be left and later rt_check() can recurse on its lock. [1] - Remove comment about protocol cloning. - Fix two places where rtentry mutex was recursed on, because accessed via two different pointers, that were actually pointing to the same rtentry in some cases. [1] - Return EADDRINUSE instead of bogus EDQUOT, in case when gateway uses the same route. [2] Reported & tested by: ps, Andrej Zverev <az inec.ru> [1] PR: kern/64090 [2]
* Use monotonic 'time_uptime' instead of 'time_second' as timebaseandre2005-09-191-1/+1
| | | | for rt->rt_rmx.rmx_expire.
* Use monotonic time_uptime instead of 'time_second' as timebaseandre2005-09-193-14/+14
| | | | for timeouts.
* Drop current rtentry lock before calling rt_getifa(). This fixes a LORglebius2005-09-191-3/+3
| | | | | | | and a possible recursive use of rtentry mutex. PR: kern/69356 Reviewed by: sam
* Take a first cut at cleaning up ifnet removal and multicast socketrwatson2005-09-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | panics, which occur when stale ifnet pointers are left in struct moptions hung off of inpcbs: - Add in_ifdetach(), which matches in6_ifdetach(), and allows the protocol to perform early tear-down on the interface early in if_detach(). - Annotate that if_detach() needs careful consideration. - Remove calls to in_pcbpurgeif0() in the handling of SIOCDIFADDR -- this is not the place to detect interface removal! This also removes what is basically a nasty (and now unnecessary) hack. - Invoke in_pcbpurgeif0() from in_ifdetach(), in both raw and UDP IPv4 sockets. It is now possible to run the msocket_ifnet_remove regression test using HEAD without panicking. MFC after: 3 days
* The arguments to printf() were swapped.ru2005-09-161-2/+2
|
* Do assorted nitpicking in diagnostics while I'm here:yar2005-09-161-9/+9
| | | | | | - Use __func__ consistently instead of copying function name to message strings. Code tends to migrate around source files. - DIAGNOSTIC is for information, INVARIANTS is for panics.
* It's nice to have relevant comments both in if {} and else {},yar2005-09-161-1/+4
| | | | not in just one of them.
OpenPOWER on IntegriCloud