Commit Graph

107 Commits

Author SHA1 Message Date
itojun ae5a9e211d re-scan all ifnet after domaininit() for if_afdata initialization. 2002-05-27 13:46:45 +00:00
itojun e5aa199677 framework to add af-dependent data structure to struct ifnet.
as discussed at bsd-api-discuss.  sync w/kame
2002-05-27 02:53:49 +00:00
matt 486c7ce727 Add SIOCGIFDATA and SIOCZIFDATA ioctl's to get interface data. (the Z
variant also zeroes the counters after copying them).  In ifunit, add
support for dealing all numeric ifname by treating them as an ifindex
which is used to look up the interface.
2002-05-23 21:34:39 +00:00
matt 2d83d27dfa Eliminate more commons. 2002-05-12 20:40:11 +00:00
simonb dbafd8c6a6 Make the 'ifnet' variable an extern and declare it in if.c. 2002-03-17 10:21:42 +00:00
atatat 9dd8465963 (1) Make if_index "wrap" at USHRT_MAX instead of going above it so
that other parts of the kernel won't lose gratuitously.  There are
places where it's assumed that it won't grow that large.

(2) Avoid accidental reuse of occupied slots in the ifindex2ifnet[]
table.
2002-02-09 05:56:34 +00:00
abs 42ceb2f007 Add an #if defined(INET) ... around if_detach_queues's declaration to match the
one around its definition.
2001-12-02 19:44:25 +00:00
augustss 113024244c Make it compile in the absence of networks. Closes PR 14274 (mine). 2001-11-27 17:32:57 +00:00
lukem 34d65a3414 add RCSIDs 2001-11-12 23:49:33 +00:00
matt b5e785f38d Switch to using queue access macros instead of refering to the member
fields explicitly.
2001-11-05 18:02:15 +00:00
thorpej d679590033 Split the pre-computed ifnet checksum flags into Tx and Rx directions.
Add capabilities bits that indicate an interface can only perform
in-bound TCPv4 or UDPv4 checksums.  There is at least one Gig-E chip
for which this is true (Level One LXT-1001), and this is also the
case for the Intel i82559 10/100 Ethernet chips.
2001-09-17 17:26:59 +00:00
itojun 32c36b5e14 fix logic to free up ifqueue on if_detach(). prev pointer was incorrectly set. 2001-08-02 01:42:38 +00:00
itojun c4a687384b make sure to cleanup software interrupt queues (like ipintrq)
on interface detach, otherwise we will have a dangling pointer
from m->m_pkthdr.rcvif.
2001-07-29 03:28:30 +00:00
itojun 888b31fb38 indent fix 2001-07-28 01:13:56 +00:00
itojun cf7ae5ac15 clear ifindex2ifnet[] on if_detach. 2001-07-24 16:35:29 +00:00
thorpej cbf41a143a bzero -> memset 2001-07-18 16:43:09 +00:00
itojun 4d51fe368b change the meaning of ifnet.if_lastchange to meet RFC1573 ifLastChange.
follows BSD/OS practice and ucd-snmp code (FreeBSD does it for specific
interfaces only).

was: if_lastchange get updated on every packet transmission/receipt.
now: if_lastchange get updated when IFF_UP is changed.
2001-06-14 05:44:23 +00:00
mrg 6b94f57396 make ifioctl() compat lkm friendly. 2001-06-07 13:26:48 +00:00
thorpej ca4d373730 Implement support for IP/TCP/UDP checksum offloading provided by
network interfaces.  This works by pre-computing the pseudo-header
checksum and caching it, delaying the actual checksum to ip_output()
if the hardware cannot perform the sum for us.  In-bound checksums
can either be fully-checked by hardware, or summed up for final
verification by software.  This method was modeled after how this
is done in FreeBSD, although the code is significantly different in
most places.

We don't delay checksums for IPv6/TCP, but we do take advantage of the
cached pseudo-header checksum.

Note: hardware-assisted checksumming defaults to "off".  It is
enabled with ifconfig(8).  See the manual page for details.

Implement hardware-assisted checksumming on the DP83820 Gigabit Ethernet,
3c90xB/3c90xC 10/100 Ethernet, and Alteon Tigon/Tigon2 Gigabit Ethernet.
2001-06-02 16:17:06 +00:00
thorpej bf2dcec4f5 Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
2001-04-13 23:29:55 +00:00
thorpej 4cbf0044c4 Add a PFIL_HOOKS filtering point to every network interface. 2001-04-10 21:45:39 +00:00
thorpej d0abf5db37 Add some missing ALTQ initialization, pointed out by
Kenjiro Cho <kjc@csl.sony.co.jp>.
2001-03-03 03:29:20 +00:00
itojun 1e48b7fbb5 add SIOC[SG]LIFPHYADDR ioctl. greatly simplify tunnel address settings.
sync with kame.  old ioctls are supplied but not recommended for new code.
2001-02-20 15:35:19 +00:00
thorpej 896cba1b56 if_alloc_sadl(): if the interface already has a link name, free
it before assigning a new one.  This is useful for interfaces
that may change their link names in the course of their existence.
2001-01-29 01:49:43 +00:00
itojun 966b95b038 configure sdl_alen properly 2001-01-17 09:34:48 +00:00
itojun df9784d749 pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2 (UCB copyrighted).
have sys/net/route.c:rtrequest1(), which takes rt_addrinfo * as the argument.
pass rt_addrinfo all the way down to rtrequest, and ifa->ifa_rtrequest.
3rd arg of ifa->ifa_rtrequest is now rt_addrinfo * instead of sockaddr *
(almost noone is using it anyways).

benefit: the follwoing command now works.  previously we need two route(8)
invocations, "add" then "change".
# route add -inet6 default ::1 -ifp gif0

remove unsafe typecast in rtrequest(), from rtentry * to sockaddr *.  it was
introduced by 4.3BSD-reno and never corrected.

XXX is eon_rtrequest() change correct regarding to 3rd arg?
eon_rtrequest() and rtrequest() were incorrect since 4.3BSD-reno,
so i do not have correct answer in the source code.
someone with more clue about netiso-over-ip, please help.
2001-01-17 04:05:41 +00:00
thorpej fc5dafc79b Fix a rather annoying problem where the sockaddr_dl which holds
the link level name for the interface (ifp->if_sadl) is allocated
before ifp->if_addrlen is initialized, which could lead to allocating
too little space for the link level address.

Do this by splitting allocation of the link level name out of
if_attach() and into if_alloc_sadl(), which is normally called
by functions like ether_ifattach().  Network interfaces which
don't have a link-specific attach routine must call if_alloc_sadl()
themselves (example: gif).

Link level names are freed by if_free_sadl(), which can be called
from e.g. ether_ifdetach().  Drivers never need call if_free_sadl()
themselves as if_detach() will do it if it is not already done.

While here, add the ability to pass an AF_LINK address to
SIOCSIFADDR in ether_ioctl() (this is what caused me to notice
the problem that the above fixes).
2001-01-17 00:30:49 +00:00
thorpej 831d5b8d43 Add SIOCGIFDLT, which will fetch the data link type (DLT_* constant)
for a given network interface.
2000-12-18 21:05:03 +00:00
thorpej 2663dfcf85 Commit to the ALTQ glue. 2000-12-18 18:54:47 +00:00
thorpej e961c654a8 Change an if_qflush() to an IFQ_PURGE() to deal with ALTQ correctly. 2000-12-14 17:47:26 +00:00
thorpej cdcd4fad5e In if_qflush(), use IFQ_PURGE() rathen than an open-coded version. 2000-12-13 22:06:05 +00:00
thorpej 2a6413983b Only allow superuser to change 802.11 power params. 2000-12-12 17:48:29 +00:00
thorpej 7e2259325b Change the if_reset vector to if_init, and add an if_stop. if_stop
also takes an argument indicating whether or not the interface should
also be disabled (i.e. power removed, resources freed, etc.)
2000-10-11 16:52:34 +00:00
itojun ff01d6f0b1 repair SIOCGIFP{DST,SRC}ADDR. 2000-10-07 03:41:38 +00:00
itojun bb4b4d9e39 ifp->if_ioctl may be NULL, so check it for SIOCSIFPHY*. 2000-10-04 22:37:41 +00:00
thorpej 3ba709aec7 Make sure we're super-user for SIOCSIFPHYADDR, SIOCDIFPHYADDR,
and SIOCSIFPHYADDR_IN6.
2000-10-04 21:12:40 +00:00
thorpej 8dc841aa19 Change the behavior of ifpromisc() slightly. If interface is not IFF_UP,
attempting to enable promisc would result in ENETDOWN.  Change this to
allow the interface to always be placed in promiscuous mode, regardless
of IFF_UP.  When the interface does come up, the IFF_PROMISC flag will
be consulted, and this matches the behavior that disabling promiscuous
mode has.
2000-10-01 23:16:07 +00:00
mellon b58f5e5835 - Figure out how long if list buffer needs to be if it's too short (fixes
PR#10968).
2000-09-29 00:37:37 +00:00
onoe f4aa4a560c add following two ioctls to handle WEP key for IEEE 802.11 wireless
LAN drivers: SIOCS80211NWKEY and SIOCG80211NWKEY.
2000-07-21 04:47:40 +00:00
pk 43b49b2283 Missing increment on ifp->if_pcount. 2000-07-20 22:00:48 +00:00
thorpej 9c881e00cb Add a SIOCGIFCLONERS ioctl, which fetches a list of network
interface cloners from the kernel.
2000-07-20 18:40:26 +00:00
onoe 0ab524f389 moved the check priviledge for SIOCS80211NWID from each driver to ifioctl().
it also fixes the problem that non-priviledged user can change nwid
for wi and ray drivers.
2000-07-19 06:00:39 +00:00
thorpej 445487c8f3 Move ifpromimsc() to if.c 2000-07-04 18:46:49 +00:00
thorpej 464c773f27 Oops, restrict SIOCIF{CREATE,DESTROY} to super-user. 2000-07-04 01:51:22 +00:00
thorpej 1e58f22342 Add the notion of "cloning" of network pseudo-interface (e.g. `gif').
This allows them to be created and destroyed on the fly via ifconfig(8),
rather than specifying the count in the kernel configuration file.
2000-07-02 00:20:48 +00:00
bouyer 4e9473a1e7 ifa_ifwithnet(): for the netatalk case, don't blindly return the first match
but try to find a exact match first. Closes kern/9957.
2000-04-26 13:38:13 +00:00
augustss c1ebd1929a Kill some more register declarations. 2000-03-30 09:45:33 +00:00
simonb 76e291abe4 Delete redundant decls of if_slowtimo and if_null{output,input,start,
ioctl,reset,watchdog,drain} - they're in <net/if.h>.
2000-03-30 02:31:59 +00:00
thorpej fc96443d15 New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
  resource allocation.
- Insertion and removal of callouts is constant time, important as
  this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
2000-03-23 07:01:25 +00:00
itojun c23a76689e remove if_withname, which was merged in by mistake during KAME merge. 2000-03-22 11:34:15 +00:00