Commit Graph

619 Commits

Author SHA1 Message Date
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
itojun eaeb53372e update comment (analysis on 04 draft) 2000-04-21 02:40:53 +00:00
itojun d300ce3942 add net/if_stf.h and netinet/ip_encap.h (almost noone will include them though) 2000-04-19 06:39:15 +00:00
itojun 3909133548 introduce sys/netinet/ip_encap.c, to dispatch inbound packets
to protocol handlers, based on src/dst (for ip proto #4/41).
see comment in ip_encap.c for details of the problem we have.
there are too many protocol specs for ip proto #4/41.
backward compatibility with MROUTING case is now provided in ip_encap.c.

fix ipip to work with gif (using ip_encap.c).  sorry for breakage.

gif now uses ip_encap.c.

introduce stf pseudo interface (implements 6to4, another IPv6-over-IPv4 code
with ip proto #41).
2000-04-19 06:30:51 +00:00
itojun 5e5941eda1 remove extra memory region kept by "struct pfil_head pfil_head_t;".
it seems totally, unnecessary, or seems to be typo for typedef.
(correct me if i'm wrong)
2000-04-19 04:46:23 +00:00
simonb 450dc64ed8 Remove some routing specific sysctl function declarations from
<sys/sysctl.h> and make them static in net/rtsock.c.
2000-04-15 17:51:27 +00:00
itojun c24f5b5068 add more IPv6 cases. not tested.
TODO: IPv6CP support.  currently IPv6 packet will be generated right
after link up (spec violation)
2000-04-12 10:51:15 +00:00
itojun ecb5f2e56a revisit in6_ifattach().
- be persistent on initializing interfaces, even if there's manually-
  assigned linklocal, multicast/whatever initialization is necessary.
- do not cache mac addr in the kernel.  grab mac addr from existing cards
  (this is important when you swap ethernet cards back and forth)
now ppp6 works just fine!

call in6_ifattach() on ATM PVC interface to assign link-local, using
hardware MAC address as seed.

(the change is in sync with kame tree).
2000-04-12 10:36:38 +00:00
chs 6040f9fa38 remove sunos stuff. 2000-04-12 04:21:22 +00:00
chs b9c0393d3f remove support for sunos and ancient BSDs. 2000-04-12 04:20:47 +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
enami 78d601b7d4 Fix typo in comment. 2000-03-29 04:56:47 +00:00
simonb 0fd09c8496 Don't need to include <sys/conf.h> here. 2000-03-29 03:43:33 +00:00
simonb fe30fe7adf Extern etherbroadcastaddr, ether_ipmulticast_min and ether_ipmulticast_max. 2000-03-29 03:36:32 +00:00
simonb 25b33c13f4 Extern the declarations of ifindex2ifnet and if_index. 2000-03-29 03:27: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 d4eed1a6bf remove bogus comment 2000-03-22 16:51:03 +00:00
itojun c23a76689e remove if_withname, which was merged in by mistake during KAME merge. 2000-03-22 11:34:15 +00:00
itojun 5f74312bd0 beautify 2000-03-22 11:24:59 +00:00
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
itojun dcec402dc9 initialize rn with 0, just to be sure 2000-03-12 11:58:15 +00:00
itojun 8937ddef33 do not touch radix_node with RNF_ROOT on route_output(). this can
cause kernel panic (by non-root invocation of route(8)) on certain
routing table setup.
KAME PR: 217
2000-03-10 14:47:12 +00:00
onoe 85656424da Rename the macro IEEE80211_FC1_RCVFROM_XXX to IEEE80211_FC1_DIR_XXX
and fix the value to be consistent with IEEE 802.11 spec.
The only customer of this macro is if_ray driver for now.
2000-03-10 05:44:23 +00:00
thorpej 57aae5ce02 On second thought, only set a default baudrate for "ethernet" if one
isn't set already.
2000-03-06 21:03:46 +00:00
thorpej b99cf790df - Initialize ifp->if_baudrate to a sensible value when the interface is
attached.
- Add ether_crc32_be() and ether_crc_le(), common functions for computing
  the Ethernet CRC on arbitrary length buffers.  Nothing uses them yet,
  and these should be double-checked and probably re-implemented as
  table-driven functions.
2000-03-06 20:54:41 +00:00
thorpej c2c2f491bc Use the new macros in if.h for setting ifp->if_baudrate. 2000-03-06 20:52:12 +00:00
thorpej 7e0978a583 Initialize ifp->if_baudrate to a sensible value when the interface is
attached.  XXX Need to double-check this one.
2000-03-06 20:51:27 +00:00
thorpej 877704d33e Add ifmedia_baudrate(), which returns a value suitable for ifi_baudrate
given a media word, or 0 for unknown.
2000-03-06 20:50:29 +00:00
thorpej 0f5c059d1f - Add link status to if_data, so that routing daemons and other interested
parties can easily know the state of a link.
- Define an interface announcement message for the routing socket so that
  routing daemons and other interested parties know when an interface
  is attached/detached.
2000-03-06 20:49:00 +00:00
kleink 5d617390f9 Make pre-1.5 compatibility structures being defined conditional on _KERNEL
as well.
2000-03-06 18:55:10 +00:00
soren a4a133213f Add empty token_ifdetach(). 2000-02-27 03:04:09 +00:00
mycroft 6ac2d6c797 For pfil_add_hook(..., PFIL_ALL, ...), if we fail to add the output filter,
make sure to remove the input filter.
2000-02-23 02:35:42 +00:00
darrenr fdf401f582 only call pfil_list_add with one of PFIL_IN or PFIL_OUT defined 2000-02-22 11:30:22 +00:00
darrenr 81069f7a58 return int from pfil_add_hook and pfil_remove_hook to indicate failure
or success, rather than panic'ing
2000-02-22 10:45:47 +00:00
darrenr 4da6dd2324 fix from Mike Pelley to add filters in the reverse order for output
compared with input.
2000-02-22 10:18:49 +00:00
erh 6ac8255360 This is a fragment of the network soft interrupt routine in MD code. DONETISR should be defined to do the appropriate thing for each port before including this. This file is to keep the available NETISRs the same across all ports. 2000-02-21 20:36:14 +00:00
erh fa88d200cf Remove NETISR_IMP. Make NETISR_ARP == AF_ARP, renumber NETISR_PPP to allow this. 2000-02-21 20:31:02 +00:00
darrenr 4b3916780b pass "struct pfil_head *" to pfil_add_hook and pfil_remove hook rather
than "struct protosw *".
2000-02-20 00:56:33 +00:00
sommerfeld a00eb27e1a More 802.11 subtypes: there's also 1MB/s DS
(the BayStack 660 firmware claims to support it).
2000-02-17 21:53:16 +00:00
darrenr fd7edad6c3 Change the use of pfil hooks. There is no longer a single list of all
pfil information, instead, struct protosw now contains a structure
which caontains list heads, etc.  The per-protosw pfil struct is passed
to pfil_hook_get(), along with an in/out flag to get the head of the
relevant filter list.  This has been done for only IPv4 and IPv6, at
present, with these patches only enabling filtering for IPPROTO_IP and
IPPROTO_IPV6, although it is possible to have tcp/udp, etc, dedicated
filters now also.  The ipfilter code has been updated to only filter
IPv4 packets - next major release of ipfilter is required for ipv6.
2000-02-17 10:59:32 +00:00
itojun de10c7425e backout incomplete hack from KAME codebase (originally from bbn).
the hack tries to respect ifa or ifp passed to RTM_ADD.  However, the change
broke certain link-layers.  They include:
- midway ethernet card (en*), which uses sockaddr_dl in gateway portion
  to pass PVC information.  with the patch, the gateway portion will be
  overwritten by empty sockaddr_dl and PVC initialization will fail.
- IPv6, which can't set static ND table with the patch (ndp -s), for the
  similar reason as above.

There may be improved hack coming soon, hope the new one does not break others.
2000-02-17 04:28:00 +00:00
thorpej d87b838524 Fix TMASK to use all 5 lower bits of the media word, and add HomePNA 1.0. 2000-02-16 18:03:14 +00:00
itojun 5d257be455 make assumption in rt_msg1 (len <= MHLEN + MLEN) explicit.
panic if not satisfied.
2000-02-11 06:11:03 +00:00
itojun 541b446bfa for more strict rfc2367 conformance, move netkey/keyv2.h into net/pfkeyv2.h
(net/pfkeyv2.h used to just include netkey/keyv2.h).

netkey/keyv2.h includes #error only for several days, to inform
of file path change.  after that I plan to nuke the file.
2000-02-09 03:27:29 +00:00
thorpej 72ecabeb4d In if_detach(), call PRU_PURGEIF for *every* protocol within a domain
that has a usrreq entry point.  Each protocol may have its own PCB
tables that need to be purged of references to the interface.
2000-02-06 16:43:33 +00:00
itojun 90736ab608 fix include pathname for better rfc2292 compliance. 2000-02-06 12:49:37 +00:00
itojun 1f8497dc18 fix route cleanup on interface removal. (not sure why -Wall did not catch it) 2000-02-05 07:58:54 +00:00
thorpej c1185c1020 PRU_PURGEADDR -> PRU_PURGEIF, per a discussion w/ itojun. In the IPv4
and IPv6 code, also use this to traverse PCB tables, looking for cached
routes referencing the dying ifnet, forcing them to be refreshed.
2000-02-02 23:28:08 +00:00
thorpej 99f19b7139 Wrap a debugging printf in IFAREF_DEBUG. 2000-02-02 18:02:08 +00:00
enami 9cb8699ba1 Revoke bpf device on detach. 2000-02-02 09:03:41 +00:00
enami 983b6de129 Since we are allowed to wait, no need to check the return value. 2000-02-02 08:36:02 +00:00
enami 19bff8f913 Remove duplicated forward declarations. 2000-02-02 07:45:13 +00:00
thorpej d844a3ac41 First-draft if_detach() implementation, originally from Bill Studnemund,
although this version has been changed somewhat:
- reference counting on ifaddrs isn't as complete as Bill's original
  work was.  This is hard to get right, and we should attack one
  protocol at a time.
- This doesn't do reference counting or dynamic allocation of ifnets yet.
- This version introduces a new PRU -- PRU_PURGEADDR, which is used to
  purge an ifaddr from a protocol.  The old method Bill used didn't work
  on all protocols, and it only worked on some because it was Very Lucky.

This mostly works ... i.e. works for my USB Ethernet, except for a dangling
ifaddr reference left by the IPv6 code; have not yet tracked this down.
2000-02-01 22:52:04 +00:00
thorpej 891a2a9719 Implement bpfdetach(). 2000-01-31 23:06:12 +00:00
enami 6e5c754b80 Set the right ethertype in LLC header for PVC interface.
Pointed by onoe@sm.sony.co.jp
2000-01-28 13:27:29 +00:00
thorpej 3302e4f5a2 Add a way to delete all media for a specified instance. 2000-01-26 21:58:17 +00:00
thorpej 52ee0b9f98 IFM_1000_FX -> IFM_1000_SX, like it's supposed to be, and add a few
more gigabit Ethernet tyes from FreeBSD.
2000-01-25 20:18:52 +00:00
thorpej fe58a40561 Define some convenience information and tables related to ifmedia status
bits for ifconfig(8).
2000-01-25 00:58:59 +00:00
augustss 6d0075dcc2 Fix a typo. 2000-01-24 01:20:21 +00:00
chopps 93d5e38d57 Add beginnings of ieee 802.11 generic stuff 2000-01-23 23:50:13 +00:00
chopps 84d74cfd6d add 802.11 media types 2000-01-23 23:49:48 +00:00
itojun 3867d18179 we don't need IFF_RUNNING for gif. 2000-01-17 06:29:07 +00:00
itojun 2042e749ad for gif interface, sync IFF_RUNNING with IFF_UP. it does not
make sense to leave IFF_RUNNING during !IFF_UP (it is pseudo interface
so we need to immitate - or is it okay if we don't raise IFF_RUNNING?)
2000-01-17 05:50:12 +00:00
itojun b3761abef8 remove extra portability #ifdef (like #ifdef __FreeBSD__) in KAME IPv6/IPsec
code, from netbsd-current repository.
#ifdef'ed version is always available from ftp.kame.net.

XXX please do not make too many diff-unfriendly changes, we'll need to take
bunch of diffs on upgrade...
2000-01-06 15:46:07 +00:00
itojun a51908ee11 fix compilation on sun3x.
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
1999-12-22 03:58:12 +00:00
frueauf 176df8913d Make this compile again:
NEWIP6OUTPUT gets no longer defined, revers logic to use OLDIP6OUTPUT.
1999-12-20 20:27:14 +00:00
itojun 0d7c5dfc5a change mbuf trimming.
confirmed that ping -s 1480 (my ip addr) panics before, and works fine now.

possibly fixes PR: 8990
1999-12-15 06:16:05 +00:00
itojun ea861f0183 sync IPv6 part with latest KAME tree. IPsec part is left unmodified
due to massive changes in KAME side.
- IPv6 output goes through nd6_output
- faith can capture IPv4 packets as well - you can run IPv4-to-IPv6 translator
  using heavily modified DNS servers
- per-interface statistics (required for IPv6 MIB)
- interface autoconfig is revisited
- udp input handling has a big change for mapped address support.
- introduce in4_cksum() for non-overwriting checksumming
- introduce m_pulldown()
- neighbor discovery cleanups/improvements
- netinet/in.h strictly conforms to RFC2553 (no extra defs visible to userland)
- IFA_STATS is fixed a bit (not tested)
- and more more more.

TODO:
- cleanup os-independency #ifdef
- avoid rcvif dual use (for IPsec) to help ifdetach

(sorry for jumbo commit, I can't separate this any more...)
1999-12-13 15:17:17 +00:00
itojun 8789e60098 rcsid police 1999-12-02 07:18:44 +00:00
itojun bbb8727584 bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code).  Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
1999-11-30 13:34:47 +00:00
hannken 2a59794a70 Fix typo introduced in rev. 1.55.
It caused IP6 packets to be sent as AF_UNSPEC instead of AF_INET6.
1999-11-27 18:45:08 +00:00
ragge 7e650509f4 Include param.h instead of types.h, to get mem* macros on vax. 1999-11-19 22:07:12 +00:00
thorpej e1ed9178a1 Add the `packed' attribute to structures which describe wire protocol
data formats.
1999-11-19 20:41:19 +00:00
bouyer f86517a031 Update protocoles and interfaces stats counters to 64bit.
RTM_IFINFO is now 0xf, 0xe is RTM_OIFINFO which returns the old (if_msghdr14)
struct with 32bit counters (binary compat, conditioned on COMPAT_14).
Same for sysctl: node 3 is renamed NET_RT_OIFLIST, NET_RT_IFLIST is now node 4.
Change rt_msg1() to add an mbuf to the mbuf chain instead of just panic()
when the message is larger than MHLEN.
1999-11-19 10:41:41 +00:00
thorpej e19c356e76 Make the ifmedia_entry list a TAILQ. This is pretty much for cosmetics
(media added to tail, so that when e.g. the list is run to print out
what media exist, they appear in-order).
1999-11-03 23:06:35 +00:00
thorpej 98109043a9 Expose the ifmedia_match() function. 1999-10-27 17:59:24 +00:00
itojun 9b2cad3aee avoid unnecessary file inclusion. 1999-10-27 14:14:45 +00:00
wrstuden 2f8d442b6a Up the size of the ifa_flags and ifa_refcnt from shorts to ints. Now will
deal correctly with more than 32767 routes out an interface.

Should close PR 7148 regarding problems when ifs_refcnt overflows.

Bump kernel version from 1.4L to 1.4M.
1999-10-26 22:32:44 +00:00
drochner 87568e8d82 defopt the XNS protocol (options NS), clean up the use of related
option headers / defines
1999-10-25 19:18:10 +00:00
matt 8a762f7db3 Fix appletalk over ethernet. 1999-10-12 04:53:45 +00:00
mrg 755a273d97 pass a pointer to the list, rather than passing a copy of it, when removing
functions from the pfil hook lists.  this fixes the "missing function" problem.
also, re-add support for WAITOK that was lost several deltas ago.
1999-10-10 09:07:32 +00:00
sommerfeld 7e72e96529 Fix PR7946 (neighbor discovery tries to block at interrupt level).
stack-allocate a sockaddr_storage for the temporary sockaddr rather
than putting it in an mbuf.

neighbor discovery wants to delete expired ifa's from a timeout
handler.  allowing rtinit(RTM_DELETE, ...) to run at interrupt level
allows this to work.
i think we can afford the extra ~128 bytes of stack depth ..
1999-10-09 18:55:30 +00:00
erh 622b465872 Delay clearing of RTF_UP until after deleting rt_gwroute. Otherwise, if rt_gwroute is the same as the original route it will get freed twice. It can end up the same because of unusual "route" commands (PR4561) or certain icmp redirects (PR4827). 1999-10-09 08:13:00 +00:00
ad 2399291a41 Define ETHERTYPE_VLAN: IEEE 802.1Q VLAN tagging. 1999-09-29 23:00:21 +00:00
thorpej 6f6f873945 const poison ifunit(). 1999-09-29 22:42:02 +00:00
is f546d949b6 Decouple IP mtu for ARCnet devices from interface MTU.
This is important, because for most protocols, link level fragmentation is
used, but with different default effective MTUs. (e.g.: IPv4 default MTU
is 1500 octets, IPv6 default MTU is 9072 octets).
1999-09-25 17:49:27 +00:00
matt 72a3b3a08a Make NETATALK over FDDI. 1999-09-21 22:18:51 +00:00
matt 590b2a675e Add a ifru_value (unsigned int) as a generic value. 1999-09-21 22:16:24 +00:00
is 6a793d8a47 Zeroth version of IPv6 support for ARCnet. Correct MTU handling still needs
to be done.
1999-09-19 21:31:33 +00:00
is f5050d025a We only need the ether_ipmulticast_min and _max addresses if we have INET
compiled in.
1999-09-15 20:48:19 +00:00
itojun 6b9bfc0691 - Call in{,6}_pcbdetach if ipsec initialization is failed during PRU_ATTACH.
This situation happens on severe memory shortage.  We may need more
  improvements here and there.
- Grab IEEE802 address from IFT_ETHER card, even if the card is
  inserted after bootup time.  Is there any other card that can be
  inserted afterwards?  pcmcia fddi card? :-P
- RFC2373 u bit handling suggests that we SHOULD NOT copy interface id from
  ethernet card to pseudo interface, when ethernet card has IEEE802/EUI64
  with u bit != 0 (this means that IEEE802/EUI64 is not universally unique).
  Do not use such address as, for example, interface id for gif interface.
  (I have such an ethernet card myself)
  This may change interface id for your gif interface.  be careful upgrading
  rc files.

(sync with recent KAME)
1999-09-13 12:15:54 +00:00
itojun 65363da25e Merge in NetBSD/sh3 from cvs.kame.net repository.
Tree structure:
- sys/arch/sh3: sh3 generic code
	As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
1999-09-13 10:30:21 +00:00
is 3e419f86dc Move the mtu initialization to arc_storelladdr, so that it will be upped
again when switching link0 on.
XXX This stuff needs to be thought about, especially with the doomming IPv6
support, which uses yet another default mtu.
1999-08-29 20:38:36 +00:00
is df8d07f87e Don't assume PHDS encoding for DIAGNOSE packets... we have to pass them
raw, if used at all.
1999-08-27 19:38:29 +00:00
is d8c7407afe Factor out arc_storelladdr(), and use that instead of arc_ifattach() in
the bah_reset() function.
This makes the last change work without deconnecting all the other interfaces
from the interface list.
1999-08-27 19:23:19 +00:00
thorpej d4d4f37bca packed -> __packed__ 1999-08-27 01:52:26 +00:00
is 8679b79192 Only use ifp->if_addrlen after initializing it.\
Problem detected by Andreas Johansson.
1999-08-26 20:44:50 +00:00
is c7acd44cf0 Eliminate a function call... we know its exactly one byte here 1999-08-26 19:56:08 +00:00
christos ec608f7058 changes from ppp-2.3.9 [synchronous] 1999-08-25 02:04:05 +00:00