summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
Commit message (Collapse)AuthorAgeFilesLines
* Add the kernel side of network interface renaming support.brooks2004-02-041-23/+56
| | | | | | | | | | | | | | | The basic process is to send a routing socket announcement that the interface has departed, change if_xname, update the sockaddr_dl associated with the interface, and announce the arrival of the interface on the routing socket. As part of this change, ifunit() is greatly simplified by testing if_xname directly. if_clone_destroy() now uses if_dname to look up the cloner for the interface and if_dunit to identify the unit number. Reviewed by: ru, sam (concept) Vincent Jardin <vjardin AT free.fr> Max Laier <max AT love2party.net>
* More macro cleanup. Use the system roundup2() macro instead of makingbrooks2004-02-021-3/+1
| | | | | | our own ROUNDUP() macro. Suggested by: bde
* Cleanup malloc() use in if_attach():brooks2004-01-271-22/+20
| | | | | | | - malloc() returns a void* and does not need a cast - when called with M_WAITOK, malloc() can not return NULL so don't check for that case. The result of the check was bogus anyway since it would leave the interface broken.
* Clean up macro usage in if_attach():brooks2004-01-271-2/+2
| | | | | - Use the system offsetof macro rather then making out own. - undef ROUND after we use it rather then polluting the whole file.
* Don't panic if there are more than 255 interfaces in the system.ru2004-01-231-1/+2
|
* Don't truncate the interface name in ifunit(). It's now possible to querygreen2003-12-261-2/+2
| | | | | "very long interface names", e.g.: ndis_atheros0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu 1500
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-20/+30
| | | | | | | | | | | | | 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)
* Replace a couple printfs with if_printfs.brooks2003-10-311-4/+3
|
* Since dp->dom_ifattach calls malloc() with M_WAITOK, we cannotume2003-10-241-2/+21
| | | | | | use mutex lock directly here. Protect ifp->if_afdata instead. Reported by: grehan
* Clean up whitespace, remove "register" keyword, ANSIfy.des2003-10-231-109/+59
| | | | No functional changes.
* protect by IFNET_RLOCK.ume2003-10-221-0/+2
|
* - add dom_if{attach,detach} framework.ume2003-10-171-0/+48
| | | | | | - transition to use ifp->if_afdata. Obtained from: KAME
* AF_LINK sockaddr has to be attached to ifp->if_addrlist until theume2003-10-161-3/+11
| | | | | | | end, as many of the code assumes that TAILQ_FIRST(ifp->if_addrlist) is non-null. Submitted by: itojun
* Locking for updates to routing table entries. Each rtentry gets a mutexsam2003-10-041-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that covers updates to the contents. Note this is separate from holding a reference and/or locking the routing table itself. Other/related changes: o rtredirect loses the final parameter by which an rtentry reference may be returned; this was never used and added unwarranted complexity for locking. o minor style cleanups to routing code (e.g. ansi-fy function decls) o remove the logic to bump the refcnt on the parent of cloned routes, we assume the parent will remain as long as the clone; doing this avoids a circularity in locking during delete o convert some timeouts to MPSAFE callouts Notes: 1. rt_mtx in struct rtentry is guarded by #ifdef _KERNEL as user-level applications cannot/do-no know about mutex's. Doing this requires that the mutex be the last element in the structure. A better solution is to introduce an externalized version of struct rtentry but this is a major task because of the intertwining of rtentry and other data structures that are visible to user applications. 2. There are known LOR's that are expected to go away with forthcoming work to eliminate many held references. If not these will be resolved prior to release. 3. ATM changes are untested. Sponsored by: FreeBSD Foundation Obtained from: BSD/OS (partly)
* I don't know from where the notion that device driver should orphk2003-09-281-1/+1
| | | | | | | | | | | | | | even could call VOP_REVOKE() on vnodes associated with its dev_t's has originated, but it stops right here. If there are things people belive destroy_dev() needs to learn how to do, please tell me about it, preferably with a reproducible test case. Include <sys/uio.h> in bluetooth code rather than rely on <sys/vnode.h> to do so. The fact that some of the USB code needs to include <sys/vnode.h> still disturbs me greatly, but I do not have time to chase that.
* Disabling multicast on vlan interface caused kernel panic.ume2003-07-191-0/+2
| | | | | | PR: kern/40723 Submitted by: Hideki ONO <ono@kame.net> MFC after: 1 week
* Fix some easy, global, lint warnings. In most cases, this meansmarkm2003-04-301-1/+1
| | | | | making some local variables static. In a couple of cases, this means removing an unused variable.
* Use td->td_ucred instead of td->td_proc->p_ucred.jhb2003-03-201-2/+2
|
* Note that MAJOR_AUTO is now the default if d_maj is not initialized. Thisphk2003-03-091-1/+0
| | | | | | | | is more robust and prevents the hijacking of /dev/console for the typical mistake. Remove unneeded MAJOR_AUTO uses, it is only needed explicitly now if the driver source has cross-branch compatibility to old releases.
* Make nokqfilter() return the correct return value.phk2003-03-031-1/+0
| | | | Ditch the D_KQFILTER flag which was used to prevent calling NULL pointers.
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-14/+7
| | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl)
* Make the network /dev entries use MAJOR_AUTO.mux2003-02-281-3/+1
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-7/+7
| | | | Approved by: trb
* - add support for IPX (tested with mount -t nwfs and mars_nwe),fjoe2003-01-241-0/+2
| | | | | | | | | | | IP fast forwarding, SIOCGIFADDR, setting hardware address (not currently enabled in cm driver), multicasts (experimental) - add ARC_MAX_DATA, use IF_HANDOFF, remove arc_sprintf() and some unused variables - if_simloop logic is made more similar to ethernet - drop not ours packets early (if we are not in promiscous mode) Submitted by: mark tinguely (partially)
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-7/+7
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* SMP locking for radix nodes.hsu2002-12-241-0/+2
|
* SMP locking for ifnet list.hsu2002-12-221-0/+20
|
* Lock up ifaddr reference counts.hsu2002-12-181-3/+6
|
* Back out rev 1.150; things are more complicated than this.sam2002-11-151-1/+1
|
* if_attach should not sleep; change malloc's M_WAITOK to M_NOWAITsam2002-11-151-1/+1
|
* Add a new helper function if_printf() modeled on device_printf(). Thebrooks2002-09-241-0/+14
| | | | | | | | function takes a struct ifnet pointer followed by the usual printf arguments and prints "<interfacename>: " before the results of printf. Since this is the primary form of printf calls in network device drivers and accounts for most uses of the ifnet menber if_unit, this significantly simplifies many printf()s.
* Clean up a comment talking about C strings, which are terminated with thejmallett2002-08-191-4/+4
| | | | ASCII NUL character (0, or '\0' in C).
* Implement user-setable promiscuous mode (a new `promisc' flag for ifconfig(8)).sobomax2002-08-191-0/+11
| | | | | | | | | Also, for all interfaces in this mode pass all ethernet frames to upper layer, even those not addressed to our own MAC, which allows packets encapsulated in those frames be processed with packet filters (ipfw(8) et al). Emphatically requested by: Anton Turygin <pa3op@ukr-link.net> Valuable suggestions by: fenner
* Increase size of ifnet.if_flags from 16 bits (short) to 32 bits (int). To avoidsobomax2002-08-181-11/+19
| | | | | | | breaking application ABI use unused ifreq.ifru_flags[1] for upper 16 bits in SIOCSIFFLAGS and SIOCGIFFLAGS ioctl's. Reviewed by: -hackers, -net
* Introduce support for Mandatory Access Control and extensiblerwatson2002-08-011-0/+12
| | | | | | | | | | | | kernel access control. Introduce two ioctls, SIOCGIFMAC, SIOCSIFMAC, which permit user processes to manage the MAC labels on network interfaces. Note that this is part of the user process API/ABI that will be revised prior to 5.0-RELEASE. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Introduce support for Mandatory Access Control and extensiblerwatson2002-07-311-0/+11
| | | | | | | | | | | | | kernel access control. Instrument the interface management code so that MAC labels are properly maintained on network interfaces (struct ifnet). In particular, invoke entry points when interfaces are created and removed. MAC policies may initialized the label interface based on a variety of factors, including the interface name. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Check retifma for NULL before using it.mini2002-07-021-1/+2
| | | | | | PR: kern/9391 Submitted by: Assar Westerlund <assar@sics.se> MFC after: 3 days
* Move all unit number management cloned interfaces into the cloningbrooks2002-05-251-4/+25
| | | | | | | | 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)
* just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD.suz2002-04-191-1/+1
| | | | | | | (based on freebsd4-snap-20020128) Reviewed by: ume MFC after: 1 week
* Add missing 'struct ifreq ifr;' that was forgotten in the last commit.peter2002-04-101-0/+1
|
* fixed a kernel crash when enabling multicast on vlan interfacesuz2002-04-101-4/+9
| | | | | | | owing to a NULL argument to vlan_ioctl() at if_allmulti(). Reviewed by: ume MFC after: 1 week
* Change callers of mtx_init() to pass in an appropriate lock type name. Injhb2002-04-041-2/+3
| | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-9/+9
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Make `route add -inet6 default ::1 -ifp gif0' work actually.ume2002-04-011-5/+1
| | | | | | The change between 1.13 and 1.14 is specific to AF_INET. MFC after: 1 week
* Remove __P.alfred2002-03-191-1/+1
|
* Simplify the interface cloning framework by handling unitmux2002-03-111-4/+59
| | | | | | | | | 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
* Use revoke_and_destroy_dev() instead of destroy_dev() when removing /dev/netgreen2002-03-051-1/+1
| | | | | | | pseudo-devices when an interface goes away. Otherwise, an open /dev/net/foo0 when the interface is removed can cause a crash. Not objected to by: jlemon
* Change the network interface cloning API so the destroy function returnsbrooks2002-03-041-2/+1
| | | | | | | | an int errorcode instead of void in preperation for merging cloning of the loopback device. Submitted by: mux MFC after: 2 weeks
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-2/+2
| | | | reference.
* Fix a warning by pulling prototype for arp_ifinit() into scope.peter2002-02-261-1/+4
| | | | | Then fix cast the correct value into an incorrect value, which was not detected due to the missing prototype (but was harmless anyway).
OpenPOWER on IntegriCloud