Commit Graph

1004 Commits

Author SHA1 Message Date
itojun a262f7cc76 remove #ifdef for freebsd 2001-05-08 11:06:21 +00:00
itojun 1bec764d78 correct faith prefix determination. use sys/netinet/if_faith.c:faithprefix()
to determine.  sync with kame.
(without this change, non-faith socket may mistakenly accept for-faith traffic)
2001-05-08 10:15:13 +00:00
lukem a4845ebfa1 delint to c89; use #define instead of static const int for an array size 2001-05-07 10:15:46 +00:00
martin b5b75a7d19 Add an in-kernel PPPoE (ppp over ethernet, RFC 2516) implementation,
based on the existing net/if_spppsubr.c stuff.

While there are completely userland (bpf based) implementations available,
those have a vastly larger per packet overhead thus causing major CPU
overhead and higher latency. On an i386 base router, running a 486DX at 50MHz
my line (768kBit/s downstream) was limited to something (varying) between 10
and 20 kByte/s effective download rate. With this implementation I get full
bandwidth (~85kByte/s).

This is client side only. Arguably the right way to add full PPPoE support
(including server side) would be a variation of the ppp line discipline and
appropriate modifications to pppd. I promise every help I can give to anyone
doing that - but I needed this realy fast. Besids, on low memory NAT boxes
with typically a single PPPoE connection, this implementation is more
lightweight than a pppd based one, which nicely fits my needs.
2001-04-29 09:50:36 +00:00
itojun fce23b0ae4 correct outbound outer IPv4 destination address selection.
IFF_LINK0 disables inbound path, removes security worries.
more examples in manpage.
2001-04-29 03:56:06 +00:00
marcus 9bcf84f72a STDC cleanup: label not allowed just before end of block. 2001-04-27 00:14:02 +00:00
augustss 81ece2d4bf Only dispatch slnetisr & co if we don't have generic soft interrupts. 2001-04-14 13:54:38 +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 d7333fb163 splimp -> splnet 2001-04-12 17:53:48 +00:00
itojun e366844be7 need to declare NULL for inline function. 2001-04-11 14:44:55 +00:00
thorpej 8dc1d7cbac Add bridge netisr glue (only used if no __HAVE_GENERIC_SOFT_INTERRUPTS). 2001-04-11 03:55:16 +00:00
thorpej f62e94272e Add hooks for bridging. 2001-04-11 03:47:24 +00:00
enami fe247cae7a fix possible typo in comment. 2001-04-10 22:58:55 +00:00
thorpej 4702254396 Process pfil hooks for Ethernet input and output. 2001-04-10 21:47:36 +00:00
thorpej 4cbf0044c4 Add a PFIL_HOOKS filtering point to every network interface. 2001-04-10 21:45:39 +00:00
thorpej f41aa15500 Add 802.1D (Spanning Tree) LSAP code. 2001-04-10 19:30:41 +00:00
martin 8f8dc65f89 Add another option for encapsulation: PP_NOFRAMING.
In this mode, the PPP packets start with the protocol identifier and don't
have any explicit framing (which may be added by the lower level driver).

Make input/output statistics a little bit more correct by adding a hardware
driver adjustable framing length for each packet (instead of the constant
value "3" used before).

While there, bump authentication name length from 32 to 48 (I have a
connection where I need more than 32). XXX - this should not be artificialy
limited at all.
2001-04-09 19:33:01 +00:00
thorpej 5cbdcc502b Add ALTQ support (both for the VLAN interface itself, as well as for
being a VLAN on a ALTQ'ified interface).
2001-04-07 18:41:42 +00:00
thorpej c28f672aee Add altq_etherclassify(), a slight hack modified from the kame/freebsd4
tree, which allows a packet with Ethernet headers already present to
run through the ALTQ packet classifier.  This is needed in order to
suport ALTQ on VLAN and bridge devices.
2001-04-07 18:01:48 +00:00
thorpej 98c9d8b5c6 ether_*() functions belong in if_ether.h, not if.h. 2001-04-07 04:24:31 +00:00
enami 2ceebb6c0e Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.
2001-03-31 00:35:21 +00:00
martin f7f12c9b64 Make the 'cmd' argument to ioctl an unsigned long, as it is everywhere
else.
2001-03-25 19:39:20 +00:00
enami d189c89a19 - lineup comment.
- fix typo in comment.
2001-03-08 03:22:28 +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
wiz 1651c2430f Fix pasto reported in kern/12241 by Michael van Elst. 2001-02-28 14:08:35 +00:00
joda 7c1106ddf8 when changing to an unsupported media type, return EINVAL instead of
ENXIO
2001-02-26 09:42:00 +00:00
christos d8dd082e78 change CCP maxlen to 64 to accomodate mschap-2. 2001-02-23 21:16:19 +00:00
itojun e79a9123a3 use u_quad_t for rtstat.
not sure if it really matters, but short (32K) looks way too small given
recent fat pipes connecting *BSD boxes, and our great uptime :-).
2001-02-21 05:45:11 +00:00
itojun 45e2b8d54b remove necessary global variable for eon processing. from chopps,
sync with kame
2001-02-21 00:17:09 +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
itojun 9968ae668d comment on dispatches (clearify inner/outer) 2001-02-20 08:48:27 +00:00
itojun 56ad92fd11 use u_int32_t, not u_int, for DLT_NULL encapsulation. 2001-02-20 08:33:02 +00:00
itojun ffc12ee678 explicitly use u_int32_t for DLT_NULL encapsulation.
correct gif address family.  from chopps, sync with kame.
2001-02-20 07:58:16 +00:00
itojun cda5e3eb96 cosmetic; do not use register variable declaration. sync with kame 2001-02-20 07:53:31 +00:00
itojun 9df62246e7 update comment to meet 6to4 RFC. sync with kame 2001-02-17 04:29:59 +00:00
itojun 5e32defa9b sync comment with latest kame 2001-02-08 12:36:06 +00:00
chs 09cb38f22b expose the definitions of MIN() and MAX() in sys/param.h to the kernel
and use those in favor of a dozen copies scattered around the source tree.
2001-02-05 10:42:40 +00:00
thorpej 53c23f549a Start out with a link name that says "802.1Q VLAN", and inherit the
parent interface's as usual once we attach to the parent.  When we
detach from the parent, reset our link name to the "802.1Q VLAN" name.
2001-01-29 01:51:05 +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 32024e8a3d call if_alloc_sadl(). without it the following operation causes kernel panic:
# ifconfig vlan0 create
# ifconfig vlan0
2001-01-28 10:41:44 +00:00
itojun f38fdf081e change non-intuitive function name. s/rtflushit/rtflushclone1/ 2001-01-27 11:07:59 +00:00
itojun 02adaaf197 cleanup cloned route when parent route (RTF_CLONING) goes away.
adds rt_parent to link parent from child (like NRL did, ours do refcnt
rt_refcnt properly).

bsdi rt_walkbranch would speedup the processing, but since the code will not
be visited too frequently, the current code (with rt_walktree) should be okay.
2001-01-27 10:39:33 +00:00
itojun fee00b1a78 mark cloned routes with RTF_CLONED. present it with netstat -r by "c".
let static routes overwrite cloned routes, as cloned routes can come back again
if necessary.  behavior same as freebsd/bsdi, code partially from bsdi42.
(NRL rt->rt_parent was not added)
should fix PR 11916 and maybe some other PRs with ARP behavior.

recompilation of usr.sbin/route6d is suggested.
2001-01-27 04:49:31 +00:00
itojun a836499e32 make it possible to turn off ingress filter on gif/stf tunnel egress,
by using IFF_LINK2.  (part of) PR 11163 from Ken Raeburn.
2001-01-22 07:51:01 +00:00
jdolecek 34c8ae80da constify 2001-01-18 20:28:15 +00:00
thorpej 8debdb1fee Correct last commit. 2001-01-17 19:08:59 +00:00
jdolecek fd0f688850 make local const stuff as static const, so that it's pushed to text segment 2001-01-17 19:04:03 +00:00
jdolecek 03cec6311e mark local constant stuff as const, so that it's pushed to text segment 2001-01-17 18:52:41 +00:00
jdolecek 384bb56925 move local variable sdl from ieee1394_ifdetach() to ieee1394_ifattach(), so that
this file is compilable after previous change
XXX not tested
2001-01-17 18:44:14 +00:00
thorpej a4ecde8c5e If no link level name is assigned, return EADDRNOTAVAIL on
SIOCGIFADDR.
2001-01-17 15:53:43 +00:00
itojun 50f4458f06 move forward decl of rt_addrinfo upwards. 2001-01-17 15:07:07 +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 f64af41401 No need to reference ifnet_addrs[]. 2001-01-16 21:18:56 +00:00
itojun 72f7f224db run IPCP only if we have IPv4 in kernel 2001-01-16 15:28:27 +00:00
thorpej 569e9a31e2 For SLIP/STRIP/PPP, use generic soft interrupts, if available. 2001-01-15 16:33:30 +00:00
martin 89e8f275be Don't peek at part of a structure via fuword. Does not work well on
64bit architectures. XXX - have to check other changes in the I4B
distribution, this had been fixed there a long time ago.
2001-01-15 13:40:35 +00:00
thorpej 1cdefa9f66 Fix a comment. 2001-01-12 19:38:46 +00:00
thorpej ba4e91812d After freeing the input buffer, set the pointer to it to NULL. 2001-01-12 19:27:32 +00:00
thorpej acd96e1307 Don't use splimp() to block both net and tty interrupts. Instead,
block both interrupt levels as appropriate.
2001-01-12 19:26:48 +00:00
thorpej 6f85104748 Sync with if_sl.c,v 1.67:
Defer output processing to the software interrupt.

Note, that in the process of doing this, I discovered several
very broken things about this driver, which are not fixed with
this commit.  It should work as well as it previously did, but
this code could be seriously improved.  As soon as I can find
my second Metricom radio, I'll give it a proper shakedown.
2001-01-12 19:03:24 +00:00
thorpej 455e3228dd Sync if if_sl.c,v 1.66:
Move the VJ uncompress code into the software interrupt.
2001-01-11 22:56:51 +00:00
thorpej c292853354 Plug a memory leak. 2001-01-11 22:43:02 +00:00
thorpej 7c1a1a3ae8 Process STRIP software interrupts. 2001-01-11 22:32:21 +00:00
thorpej 1ce7cbc90b Sync with if_sl.c,v 1.65:
Once we have a complete frame, schedule a STRIP software interrupt,
and manipulate ipintrq from there.  This will allow us to clean up
the use of splimp() in this file later.
2001-01-11 22:31:49 +00:00
thorpej a5ee0c0a19 Sync with if_sl.c,v 1.64:
Make the buffer management in STRIP just a little less evil.
2001-01-11 22:23:11 +00:00
thorpej 7c5fe175c0 Defer output processing to the software interrupt. 2001-01-11 21:15:58 +00:00
thorpej 4c9cb837ba Move the VJ uncompress code into the software interrupt. 2001-01-10 23:29:42 +00:00
itojun ea2d93c355 fix indentation 2001-01-10 01:16:59 +00:00
thorpej f5428a0a17 Fix oversight in slip softintr changes. 2001-01-09 20:20:13 +00:00
thorpej efed547b78 Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there.  This will allow us to clean up
the use of splimp() in this file later.
2001-01-09 05:04:23 +00:00
thorpej 30be6aa8b6 Add NETISRs for SLIP and STRIP. (Geez, I wish we had the softintr
API everywhere...)
2001-01-09 05:03:10 +00:00
thorpej 692a2bc939 Make the buffer management in SLIP just a little less evil. 2001-01-09 04:42:48 +00:00
thorpej c5acd6aad5 Fix a typo in the ALTQ changes. 2001-01-08 23:43:34 +00:00
martin 6b82e7fe42 64bit police.
Rumors say there are archs without ISA busses, so avoid including
(uneccesarily) isa bus headers in MI files.
XXX this is the minimal solution, layer interface calls will have
XXX to be revisited later
2001-01-07 21:47:24 +00:00
enami 0e081e1b48 Missing newline in log messsage. 2001-01-04 00:17:52 +00:00
thorpej d2bbed89e7 Fix non-blocking BPF reads, from Guy Harris, kern/11836. 2000-12-29 01:55:49 +00:00
thorpej ad5b855ef0 Back out the sledgehammer damage applied by wiz while I was out for
the holiday.
2000-12-28 21:40:59 +00:00
augustss 79431d7824 Simplify case statement a tiny bit. 2000-12-26 23:54:34 +00:00
wiz 32e20d8993 Back out previous change. It causes NAT to fail, and was CLEARLY
NOT TESTED before it was committed.
2000-12-25 02:00:46 +00:00
thorpej f9fd00d8e7 Fix a silly bug in the ALTQ version of IFQ_DEQUEUE(). 2000-12-23 19:00:18 +00:00
thorpej d0357bdb4f Slight adjustment to how pfil_head's are registered. Instead of a
"key" and a "dlt", use a "type" (PFIL_TYPE_{AF,IFNET} for now) and
a val/ptr appropriate for that type.  This allows for more future
flexibility with the pfil_hook mechanism.
2000-12-22 20:01:17 +00:00
thorpej 8a56f72a7c Oops, make this build without ALTQ again. 2000-12-18 21:13:14 +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 0b541534c5 Add an "ifr_dlt" alias for the union in struct ifreq. 2000-12-18 21:03:34 +00:00
thorpej 192e2774b3 Always pull in DLT_* constants. 2000-12-18 20:58:41 +00:00
thorpej 023adb3093 Use IFQ_PURGE(). 2000-12-18 20:50:36 +00:00
thorpej 5363e5eed4 ALTQ'ify. 2000-12-18 20:47:10 +00:00
thorpej 541812a992 ALTQ'ify. 2000-12-18 20:41:44 +00:00
thorpej ed7695a765 Fill in if_dlt. 2000-12-18 19:44:33 +00:00
thorpej 23df92e38d Small cosmetic change. 2000-12-18 19:36:41 +00:00
thorpej 6484f81abc We now support hw vlan tag support in network interfaces, so remote it
from the TODO list.
2000-12-18 19:32:20 +00:00
thorpej 00d64bedbc Add a if_dlt member, used so that userland can query the DLT_* of an
interface without having to first attach it to a bpfdesc.
2000-12-18 19:25:57 +00:00
thorpej db9fd3e536 Add ALTQ support. This is used for testing/debugging ALTQ only. It
is triggered only on loopback interfaces, and not simplex interfaces
(which also use looutput()).
2000-12-18 19:18:33 +00:00
thorpej 66539b9373 Add ALTQ support. 2000-12-18 18:57:21 +00:00
thorpej 2663dfcf85 Commit to the ALTQ glue. 2000-12-18 18:54:47 +00:00
thorpej 721139924d Add a version of the 802.11 frame header that includes the 4th address. 2000-12-18 18:00:23 +00:00
itojun 60fa2b29af fix typo in function name (rn_satsifies_leaf -> satisfies). indent.
split rn_inithead() into two function - i'm putting some hook around here.
2000-12-17 10:23:19 +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 fb2688c12f Fix braino in IF_PURGE(). 2000-12-14 00:19:42 +00:00
thorpej dce7e1a85b Oops, forgot IFQ_POLL() in the ALTQ case. 2000-12-14 00:07:35 +00:00
thorpej 3dc1664f57 Add ALTQ glue. 2000-12-13 22:07:50 +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 df303090c2 First step at integrating ALTQ -- IFQ_*() glue macros that select
old-style queueing or ALTQ based on a compile time option.
2000-12-13 22:05:12 +00:00
thorpej 173c0bb9d7 Include BPF headers as necessary (feh, too many changes to try and
merge...)
2000-12-12 18:22:39 +00:00
thorpej bb1175954d Use <net/dlt.h> 2000-12-12 18:03:25 +00:00
thorpej c5293456da Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.
2000-12-12 18:00:22 +00:00
thorpej bfaf37d464 Use <net/dlt.h> to get the DLT_* constants. Also change bpfattach()
and bpf_change_type() to take just a pointer to the ifnet, rather than
a pointer to the ifnet and a pointer to a member of the ifnet (the bpf
pointer).

We'll let this ride on the Dec 12 1.5N version bump.
2000-12-12 17:55:21 +00:00
thorpej 00052cdc53 Put the BPF DLT_* constants into their own header file so that things
that reference them don't have to slurp in all of the BPF headers.

Define a new generic RAWAF type that is like DLT_RAW, but isn't specific
to IP (the macro takes an AF_* constant as an argument to generate the
actual type).
2000-12-12 17:53:00 +00:00
thorpej 2a6413983b Only allow superuser to change 802.11 power params. 2000-12-12 17:48:29 +00:00
thorpej 589bc762b7 Add a way to manipulate the power management parameters specified in
802.11.
2000-12-12 04:03:38 +00:00
itojun 93292b8aaa do not touch region after free 2000-12-11 07:52:48 +00:00
itojun 5eae50d991 update icmp6 too big validation. the change is necessary since pmtud is
mandatory for IPv6 (so we can't just validate by using connected pcb - we need
to allow traffic from unconnected pcb to do pmtud).
- if the traffic is validated by xx_ctlinput, allow up to "hiwat" pmtud
  route entries.
- if the traffic was not validated by xx_ctlinput, allow up to "lowat" pmtud
  route entries (there's upper limit, so bad guys cannot blow up our routing
  table).
sync with kame

XXX need to think again about default hiwat/lowat value.
XXX victim selection to help starvation case
2000-12-09 01:29:45 +00:00
onoe 2819c7b688 Use DMA from mbuf instead of copy in transmit.
Still use memcpy in receiving because we must use buffer fill mode
	and many packets may share single receive buffer.

XXX: Workaround(?) for CXD3222: it fails to DMA for selfid packet according
to code placement. I'm not sure about the reason (cache? timing? bug?).

Fixed the bug: transmitter sometimes stop and OACTIVE bit of if_fw
never be cleared.
Fixed the bug: freeing free buffer.

Enable ieee1394_drain and ieee1394_watchdog for loss of fragment.
2000-11-20 12:12:18 +00:00
martin 4a0283d9f0 Allow changing of settings via ioctl only for the superuser.
Fixes PR security/11524.
2000-11-19 18:48:44 +00:00
bouyer 6e08061c2a Supports hardware 802.1q VLAN tagging, per discussion on tech-net. The tag is
stored in a m_aux mbuf defined by AF_LINK, ETHERTYPE_VLAN.
Thanks to Jason & Itojun for the feedback.
2000-11-17 19:21:53 +00:00
bouyer 0d0fd7718e Per discussion with Jason, change flags filter to
(IFF_UP | IFF_BROADCAST | IFF_RUNNING | IFF_ALLMULTI | IFF_SIMPLEX)
Also, put the ifp->if_opackets++ at the rigth place so that the counter is
incremented even when the parent is OACTIVE.
Fix a bug in vlan_input where the ethernet src and dst addrs would not be
correct because we only memmove() only ifv->ifv_encaplen instead of
sizeof(struct ether_header).
2000-11-15 18:15:11 +00:00
thorpej b84f740be0 Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach(). 2000-11-15 01:02:11 +00:00
onoe f1c77e81db Add support for link fragmentation and reassemble for IEEE-1394.
XXX: drain is still not yet implemented, thus memory leak will occur
    in case of any of fragment lost.
2000-11-14 11:14:55 +00:00
bouyer 3659b305e5 In vlan_config(), filter flags inherited from parent interface to
(IFF_UP | IFF_BROADCAST | IFF_RUNNING | IFF_ALLMULTI | IFF_SIMPLEX)
Without this, if the parent is OACTIVE of PROMISC at config time, we
loose.
2000-11-12 19:39:42 +00:00
thorpej 65fd25ea82 Restructure the PFIL_HOOKS mechanism a bit:
- All packets are passed to PFIL_HOOKS as they come off the wire, i.e.
  fields in protocol headers in network order, etc.
- Allow for multiple hooks to be registered, using a "key" and a "dlt".
  The "dlt" is a BPF data link type, indicating what type of header is
  present.
- INET and INET6 register with key == AF_INET or AF_INET6, and
  dlt == DLT_RAW.
- PFIL_HOOKS now take an argument for the filter hook, and mbuf **,
  an ifnet *, and a direction (PFIL_IN or PFIL_OUT), thus making them
  less IP (really, IP Filter) centric.

Maintain compatibility with IP Filter by adding wrapper functions for
IP Filter.
2000-11-11 00:52:36 +00:00
thorpej ecf191df62 Pull in <sys/time.h>, since we use timevals here. 2000-11-11 00:11:04 +00:00
enami 7d3b20fb20 Don't require the size of sockaddr to be rounded up if it was the last one
and was netmask.
2000-11-10 03:37:42 +00:00
enami d93a3cbc40 Don't return uninitialized value. 2000-11-10 02:31:53 +00:00
enami f52dd5bd61 Don't unlink and deallocate ether_multi here. ether_ifdetach will do it. 2000-11-10 02:29:44 +00:00
enami 17707b76db Define struct member correctly. This fixes a panic due to overwrite of stack. 2000-11-10 02:27:19 +00:00
thorpej c1e8f10429 Implement promiscuous mode. 2000-11-09 05:57:38 +00:00
itojun ad037eb274 avoid namespace pollution by radix.h. the #ifndef _KERNEL portion was to
use radix.c in userland compilation, however, noone is using it.
(routed has its own radix.c)
2000-11-06 11:07:37 +00:00
onoe e83458422f First Prototype implementation of network interface part for IEEE1394 (if_fw).
Current status:
	Only OHCI chip is supported (fwohci).
	ping (IPv4) works with Sony's implementation (SmartConnect) on Win98.
	sometimes works but not stable.
Not implemented yet:
	IRM (Isochronous Resource Manager) functionality.
	Link layer fragmentation.
	Topology map.
More to do:
	clean ups
	MCAP
	charactor device part
	dhcp

There is no entry in GENERIC config file yet.
Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw.
2000-11-05 17:17:12 +00:00
eeh 16bbba0a23 Fix bug w/previous. 2000-11-02 16:50:17 +00:00
eeh 746166e492 Fix sparc64 LP64 issues. 2000-11-02 16:14:05 +00:00
itojun d36abffc92 sync with struct tty change (does it look correct?) 2000-11-02 15:51:18 +00:00
itohy 344f9b7b00 Set the default line discipline to t_linesw, rather than just NULL it. 2000-11-02 12:00:49 +00:00
itohy 486a58959c Adapt to the new line discipline scheme. 2000-11-02 11:00:53 +00:00
onoe 226930604b Add new numbers from IANA: 0x83 - 0xbd 2000-10-26 06:51:31 +00:00
wiz 75311ca708 Fix typo (thinko?), which didn't allow MRU to be set below the default
value (instead of the minimum value). Patch supplied by Stephen Degler
in PR #9945, and reviewed by Ignatios Souvatzis.
2000-10-26 01:26:15 +00:00
itojun 27fcf101a1 prevent stack overwrite due to bzero() arg mistake. from msaitoh. 2000-10-19 01:07:42 +00:00
matt cf67b6ff59 When discarding oversized frame, say how long it was. 2000-10-15 19:49:55 +00:00
itojun d7a216bb96 suppress warning on nd6_storelladdr failure. the failure could happen
easily when we have routing table with too many entries.  sync with kame.
2000-10-15 15:39:11 +00:00
bouyer 29fdeefaff Don't try to handle SIOCSIFADDR/SIOCADDMULTI/SIOCDELMULTI if a vlan/vlanif
hasn't been configured (prevent a panic in arp_ifinit when setting an
IP addr with no vlan/vlanif).
2000-10-15 11:58:26 +00:00
thorpej fabbb33a60 Implement ether_ioctl(), ioctl operations common to all Ethernet
interfaces.
2000-10-11 16:53:41 +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 014e2a97b5 fix comment (s/IPv6/IP/) 2000-10-10 11:43:51 +00:00
ad 04e67112d6 Remove defunct bpfdetach()/ether_ifdetach() calls. 2000-10-10 10:07:35 +00:00
itojun 4eb5250694 fix operator precedence (& and &&). do not transmit too much message
from LCP layer to NCP layer.  PR 11161.
2000-10-08 02:37:42 +00:00
itojun 08af3d2f82 validate args to SIOC[SG]IFPHY* better. 2000-10-07 04:18:04 +00:00
itojun ff01d6f0b1 repair SIOCGIFP{DST,SRC}ADDR. 2000-10-07 03:41:38 +00:00
onoe 3ec2a62f74 unique #include opt_inet.h 2000-10-06 04:49:53 +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
enami d86752997f Free mbuf when dropping VLAN frame due to no configured vlan interface. 2000-10-04 07:01:52 +00:00
enami b817ce40cb Cosmetic changes. 2000-10-04 06:51:12 +00:00
enami bc50cb2cae Remove redundant assignment. 2000-10-04 06:20:05 +00:00
itojun 6b9793517d need opt_inet.h for #ifdef INET 2000-10-04 02:51:18 +00:00
thorpej 9f76a74e1e Pop one off the TODO list. 2000-10-03 23:52:39 +00:00
thorpej efbead5055 When an Ethernet interface detaches, unconfigure any VLANs associated
with it.
2000-10-03 23:50:52 +00:00
thorpej 96375e93ea Improve the VLAN support, in particular, handling of MTU:
- Add a macro to compute the max frame length based on Ethertype
  and presence of FCS, and use it to validate the packet size
  in ether_input().
- Add capabilites to struct ethercom, and allow hardware drivers
  to specify that they can handle the larger hardware MTU that
  VLANs require in order to strictly conform to 802.1Q.
- Make ether_ifdetach() clear out the link address and free all of
  the Ethernet multicast structures.

Also, rearrange the VLAN driver itself in preparation to supporting
other hardware types, including FDDI (which has 802.1Q VLAN capability).
2000-10-03 23:33:38 +00:00
itojun 2fe73fd967 typo 2000-10-03 22:46:21 +00:00
itojun 6653c1a74d forgot to update maximum number of algorithms 2000-10-03 22:43:52 +00:00
itojun 553ce2a5e7 add official # for AES (12), and make it equal to rijndael.
Note that:
- IANA assignment was made for AES
- we still have some time window till AES gets finalized, so until it gets
  finalized, we are not certain if AES == rijndael
but it should now be okay.
2000-10-03 21:45:44 +00:00
itojun 05d1b41473 get rid of RC5 algorithm # completely (#if 0'ed for a long time)
sync with kame.
2000-10-03 06:36:31 +00:00
ad 3a739b04a0 htons -> ntohs. From Alan Barrett <apb@cequrux.com>. 2000-10-02 14:41:26 +00:00
itojun dcfe05e7c1 fix compilation without INET. fix confusion between ipsecstat and ipsec6stat.
sync with kame.
2000-10-02 03:55:41 +00:00
itojun dd859d3462 enable VJC only with INET 2000-10-02 03:54:10 +00:00
itojun b8453a0291 fix compilation without INET 2000-10-02 03:53:47 +00:00
itojun 1af3d80bce fix compilation without INET. 2000-10-02 03:53:07 +00:00
itojun 412b3abb5f fix IPv6 packet manipulation. (use ip6intrq) 2000-10-02 03:52:10 +00:00
itojun 253515cca1 cosmetic; repair indentation 2000-10-02 03:51:18 +00:00
thorpej 4a66a476e9 Make the previous code path simpler (and possible easier for the
compiler to optimize), based on fddi_input().
2000-10-01 23:43:44 +00:00
thorpej 7ca3fb9ef0 Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
2000-10-01 23:32:39 +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
ad d74621ea64 Add an item to the TODO list. 2000-09-28 10:02:09 +00:00
enami a5028df36d Don't unconfigure if it is already unconfigured. 2000-09-28 08:28:56 +00:00
enami 177a258793 Fix think-o in previous; don't do the same test twice. 2000-09-28 07:35:36 +00:00
enami 8e1cd4f341 Port the multicast handling to NetBSD correctly. 2000-09-28 07:20:56 +00:00
enami bf888fcd19 Factor out and give a name to the common functionality to translate
sockaddr which represents a multicast address into an Ethernet address
or range of Etherenet addresses.
2000-09-28 07:15:27 +00:00
enami dcf72a770a s/6/ETHER_ADDR_LEN/ 2000-09-28 07:01:41 +00:00
enami 63b56285cd Remove unnecessary test. 2000-09-28 07:00:53 +00:00
enami 2c4a718932 Remove unnecessary function decl. 2000-09-28 06:13:35 +00:00
enami b531012315 Install if_vlanvar.h. 2000-09-28 06:06:50 +00:00
erh d921f48d7a When grabbing address structures out of a character array make sure that the number of addresses and length of each match up with the size of the data we're handed. Fixes arp on the alpha. 2000-09-28 01:14:06 +00:00
thorpej 77efca7976 Glue VLANs into ether_input(). 2000-09-27 22:58:21 +00:00
thorpej 00746cb0d6 Support for 802.1Q Virtual LANs. Derived and cleaned up by
Andy Doran <ad@netbsd.org> from the FreeBSD/OpenBSD implementation.
A few minor changes to how it all hooks into the system by me.
2000-09-27 22:40:54 +00:00
thorpej 5bd1b19b29 Don't use MALLOC() for variable-sized allocations. 2000-08-25 21:22:16 +00:00
mjl 8358c07048 Add bpf tap to gre interface. 2000-08-25 00:51:20 +00:00
itojun cabceaa265 - icmp6 nodeinfo: remove possibility of unaligned pointer access.
- jumbo payload output: fix incorrect mbuf manipulation
- pedant: align issues, mbuf assumption
(sync with kame)
2000-08-19 08:15:53 +00:00
jhawk b70721109d Add kernel counters for arp events, displayable with netstat -s -f arp 2000-08-15 20:24:57 +00:00
ad 19fd9da968 Define SIOC[SG]IFGENERIC in <sys/sockio.h>, as FreeBSD and OpenBSD do. 2000-08-10 11:48:41 +00:00
kleink 079b94ad72 Avoid recursion with traditional cpp. 2000-07-28 12:13:32 +00:00
matt 5aba2fd87f Add a missing include when using this in user space. 2000-07-22 05:11:27 +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
itojun 65d37eff7f correct RFC2367 PF_KEY conformance (SADB_[AE]ALG_xx values and namespaces).
sync from kame.

WARNING: need recompilation of setkey(8) and pkgsrc/security/racoon.
(no ipsec-ready netbsd was released as official release)
2000-07-18 14:56:42 +00:00
thorpej 5cae63e123 NetBSD -> __NetBSD__ in an #ifdef, and nuke sc_bpf; there's one in
the ifnet already.
2000-07-12 23:02:38 +00:00
itojun 29251eb71f remove #ifdef __FreeBSD__ or __bsdi__, as netbsd if_gif.c diverged a little
from kame tree
2000-07-06 12:56:26 +00:00
thorpej 9c86b65a92 Fix an omission in the gre cloning changes. 2000-07-05 22:45:25 +00:00
thorpej 4ec021cecf Make gre(4) a cloning network pseudo-device. 2000-07-05 18:14:13 +00:00
thorpej 7f86d18846 stf(4) is now a cloning network interface (although, only one is allowed
to be created).
2000-07-05 17:08:18 +00:00
thorpej f7e579e2f7 Fix a memory leak in the gif_clone_create() error path. 2000-07-05 16:54:19 +00:00
onoe 807a12c8cd change the argument of SIOCS80211NWID and SIOCG80211NWID ioctls from
u_int8_t array to struct ieee80211_nwid to prepend length field.
The length field is necessary because IEEE 802.11 spec doesn't prohibit
even '\0' for SSID.
Though the name and the value of SIOC... macro is unchanged, this change
breaks binary compatibility.  The only affected userland program on the
tree is ifconfig(8).
As Jason suggested on tech-net, it is better than live with problems
since there are no releases for this ioctls yet.
2000-07-05 02:35:53 +00:00
thorpej 83e31f15b2 faith(4) is now a cloning pseudo-device. 2000-07-04 20:02:46 +00:00
thorpej 920e0d4a44 Don't allow IFF_PROMISC to be changed directly by userspace. It
interferes with the reference counting done by ifpromisc(), and is
essentially impossible to get the semantics correct if we allow this
flag to be directly toggled.

No programs should really be affected by this; IFF_PROMISC is basically
useless without bpf, anyway, and bpf still provides a way to set
promiscuous mode on an interface (which uses ifpromisc()).
2000-07-04 19:09:17 +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
cgd 116f7a6983 don't include the config-generated headers if _LKM defined 2000-07-03 02:16:07 +00:00
cgd ca8479389a oops! include arp.h and ppp.h even if _LOCORE defined 2000-07-02 19:58:31 +00:00
sommerfeld 4cc38b65e0 Reduce namespace pollution from netcciitt-land 2000-07-02 17:40:18 +00:00
sommerfeld c93db19567 Merge if_spppsubr.c PPP protocol declarations list with the one found
in ppp_defs.h, and have if_spppsubr.c include ppp_defs.h rather than
duplicate its definitions.

[This is a stopgap measure to clean up build lossage.]
2000-07-02 17:38:09 +00:00
cgd a5c13f9ad4 Kwality control:
* put #includes of opt headers and headers to get protos used by
  net/netisr_dispatch.h in net/netisr.h (if !defined(_LOCORE)) (rather than
  in netisr_dispatch.h itself, and potentially nowhere, respectively).
* require netisr.h to be included before netisr_dispatch.h.
* minor additional cleanup of both netisr.h and netisr_dispatch.h.
* clean up uses to remove now-unnecessary header file inclusions, and
  local prototypes of the fns.
* convert netisr dispatch implementations which didn't use
  netisr_dispatch.h (pc532) to use it.
2000-07-02 04:40:33 +00:00
thorpej b36ce94c6b Convert `gif' to be a cloning interface. 2000-07-02 00:21:42 +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
itojun d407c7e3ec nuke sadb_x_ident_id, wihich violates pfkey standard.
correct get/set SA handling.
(from kame)
2000-07-01 01:01:34 +00:00
mrg 8e3207b69a <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-28 02:53:49 +00:00
kleink 5de786e04a Define sa_family_t and use it for sdl_family. 2000-06-26 15:59:20 +00:00
itojun 948e11b707 allow IPv[46]-over-IPv6 setting properly. sync with kame. 2000-06-20 15:59:35 +00:00
matt 215470b24c Ansify before committing my next change. 2000-06-17 20:57:20 +00:00
mycroft fbb147f69b Check the multicast bit in the header mbuf while interrupts are still blocked.
Otherwise we can run off into space if the packet was sent immediately and the
mbuf freed.
Pointed out by Boris Popov (not on our lists).
2000-06-14 05:10:27 +00:00
itojun 92e64a4a0d sync with almost-latest KAME IPsec. full changelog would be too big
to mention here.  notable changes are like below.

kernel:
- make PF_KEY kernel interface more robust against broken input stream.
  it includes complete internal structure change in sys/netkey/key.c.
- remove non-RFC compliant change in PF_KEY API, in particular,
  in struct sadb_msg.  we cannot just change these standard structs.
  sadb_x_sa2 is introduced instead.
- remove prototypes for pfkey_xx functions from /usr/include/net/pfkeyv2.h.
  these functions are not supplied in /usr/lib.

setkey(8):
- get/delete does not require "-m mode" (ignored with warning, if you
  specify it)
- spddelete takes direction specification
2000-06-12 10:40:37 +00:00
itojun 3fff705c2a update i-d #. (sync with kame) 2000-06-10 08:02:20 +00:00
onoe 4da3935bae cleanup haeders.
add opt_awi.h to define AWI_DEBUG, AWI_WEP_ARC4.
show the firmware version at attach.
create a framework to support WEP (encryption code is not included for now).
a new wiconfig compatible ioctl interface replaced the awictl interface.
fix memory leak in selecting AP
fix bugs in ESSID selection
changes from FreeBSD-current by Warner Losh:
  revision 1.2
  date: 2000/04/17 22:58:15;  author: imp;  state: Exp;  lines: +16 -1
  Provide mem* for compat with NetBSD to fix LINT
fixes from FreeBSD-current by Guido van Rooij:
  revision 1.4
  date: 2000/05/29 19:58:10;  author: guido;  state: Exp;  lines: +5 -2
  Fix a panic resulting from an obvious null pointer deref.
  Apparently some other panics still exist in this driver, but with
  this fix, it was at least possible to run the Nokia card at SANE 2000.
2000-06-09 05:31:15 +00:00
jhawk 8a49d6bd31 Ensure that all callers of pfind() can deal with pfind(0) returning
a real procp* rather than NULL.
2000-05-28 18:17:07 +00:00
matt 5108d90ce5 Fix bpf output on fddi to actually work. Make it compatible with ULTRIX
and Tru64.
2000-05-28 02:49:35 +00:00
itojun 4631e5d720 improve duplicated 'gifconfig" check (fatal typo was there). sync with kame. 2000-05-17 01:14:04 +00:00
itojun 3c67584219 propose better IPv6 ifid alternative to the peer, when ifid collides
during IPv6CP negotiation.  it is very rare to see collision.
2000-05-16 05:45:27 +00:00
itojun 3a44ebc43c backout previous (packed attribute to struct ifreq) 2000-05-15 16:59:37 +00:00
itojun 3df6dbc4c7 add packed attribute to struct ifreq. this should avoid unaligned access
while parsing SIOCGIFCONF, on alignment-picky archs.
2000-05-15 16:45:50 +00:00
itojun 2e9df64fa3 sync IPv4 rogue address filter with RFC1122. (sync with kame) 2000-05-14 03:44:02 +00:00
thorpej 5e6bec6a7e - Fix a bug in the double-loop version of ether_crc32_le() -- we're not't
supposed to bubble carry through.
- Disable the double-loop version of ether_crc32_le() and add a
  table-driven version of ether_crc32_le() -- the table-driven
  version is faster.
2000-05-12 16:22:36 +00:00
jonathan c35d2c43a6 Make BPF_BUFSIZE overridable: 8192 is smaller than MTU of some devices.
TODO: defopt, or make sysctl'able (c.f. FreeBSD).
2000-05-12 05:58:01 +00:00
ragge 8a9c114515 Change rt_refcnt from short to int, to allow more than 32k routes thru
one interface without unexpected side effects.
2000-05-04 17:33:03 +00:00
itojun aee9bb5b5f IPv6CP support. if IPv6 link-local address is configured to the interface,
the interface tries to negotiate ifid with the other end by using IPv6CP.

other changes:
- do not share ppp sequence number across protocols.
- if LCP proto-rej is received, drop the protocol mentioned by the message.
  this is to be friendly with non-IPv6 peer (if the peer complains due to
  lack of IPv6CP, drop IPv6CP).  this basically implements "RXJ+" state
  transition in the RFC.
- cleanup debugging message.  always print blank just before message.

CAVEAT:
- if the peer uses the same MAC address as our side (pretty unlikely)
  the code may go into req-rej loop.
- even though we negotiate ifid, we don't configure destination address
  onto the interface.  it is not really necessary to do so (IMHO).
- I've tested this code on a NetBSD 1.4.2 node, which was with fair amount
  of modifications.  not sure if the committed code does it right... (please
  test and send reports)
2000-05-02 12:43:16 +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
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