Commit Graph

1449 Commits

Author SHA1 Message Date
agc dd93d335d3 Fix the spelling of Bill Studenmund's name - noticed from the licences
on the Sony PSP as found in:

	http://www.scei.co.jp/psp-license/pspnet.txt
2005-03-20 07:47:29 +00:00
thorpej 6f219f734d Define IFFBITS and IFCAPBITS here in <net/if.h>. Taken from ifconfig. 2005-03-20 02:51:33 +00:00
yamt 5240b887db add agr(4), a pseudo network device driver for link aggregation. 2005-03-18 11:11:50 +00:00
kleink 513c158344 A couple of <sys/select.h>-related changes:
* Factor out struct selinfo and its header dependencies into its own header,
  <sys/selinfo.h>, to avoid namespace pollution.
* Include <sys/selinfo.h> in user-visible headers where necessary.
2005-03-17 20:39:17 +00:00
yamt 0c03ee5404 vlan_input: add a missing EVL_VLANOFTAG in the case of hw offloading. 2005-03-17 10:33:28 +00:00
tron e561507a1f Add support for changing the MTU to stf(4). 2005-03-11 13:28:25 +00:00
matt 4acc1b7c25 Add beginning of TCP Segment Offload support. 2005-03-06 00:08:30 +00:00
jonathan fba9c4c1b9 Increase default value for IFQ_MAXLEN from 50 to 256.
The value of 50 dates back to 4.3BSD and 10Mbit interfaces.
Gigabit interfaces are 100x faster, and by observation, when heavy
interrupt mitigation is enabled, gigabit interfaces can enqueue 40 packets
or more in a single hardware interrupt.  So IFQ_MAXLEN of 256 is adequate
for at least four gigabit interfaces.

Increasing IFQ_MAXLEN discussed and approved, in priniciple, circa Apr 2004.
The value is sysctl'able, so the default is no longer so critical,
but (imho) best to tune for high-performane systems by default.
2005-02-28 18:44:45 +00:00
perry f07677dd81 nuke trailing whitespace 2005-02-26 22:45:09 +00:00
christos 24db4c5a14 Re-arrange code slightly to avoid code duplication and allow to bail
out faster without doing de-capsulation work. From FreeBSD.
2005-02-21 21:37:22 +00:00
jdolecek 4c60443769 expose the new VLAN macros only within kernel 2005-02-20 15:41:48 +00:00
jdolecek 8b0dfe8d52 add several VLAN tagging related macros, to reduce code duplication
in various ethernet adapter drivers and improve code consistency; mostly
FreeBSD-compatible, with exception of VLAN_OUTPUT_TAG(), which takes
(struct ethercom *) rather than (struct ifnet *) as first parameter
since the information cannot be extracted via (struct ifnet)

also add VLAN_ATTACHED(ec), which tests if any VLAN is attached to the
ethernet device
2005-02-20 15:29:03 +00:00
cube 55dc3e11f4 Add a couple of protocols (from ppp-2.4.3). 2005-02-20 10:23:13 +00:00
cube a8a27dce29 Add MPPE definitions (from ppp-2.4.3). 2005-02-20 10:22:26 +00:00
christos be3704c73f pass the flag to fdclone. 2005-02-12 23:14:03 +00:00
manu 5c217c1a67 Add support for IPsec Network Address Translator traversal (NAT-T), as
described by RFC 3947 and 3948.
2005-02-12 12:31:07 +00:00
he 2a8a7aabd7 Fix "unused local variable" warning/error if compiling without
bridge support by making variable declaration conditional.  Found
while compiling for shark.
2005-02-01 12:13:51 +00:00
kim c9f56c04dc Add RFC 3378 EtherIP support, ported from OpenBSD to NetBSD by
Hans Rosenfeld (rosenfeld at grumpf.hope-2000.org)

This change makes it possible to add gif interfaces to bridges, which
will then send and receive IP protocol 97 packets. Packets are Ethernet
frames with an EtherIP header prepended.
2005-01-31 23:49:36 +00:00
matt 53fdea69cb Switch to using ifa for ifaddr's instead of ia (which are traditionally
used for in_ifaddr's) which could lead to confusion.
2005-01-25 17:22:08 +00:00
tron ed9b5b2073 Fix cut and paste error in last commit. 2005-01-25 11:20:37 +00:00
ragge 9bb19bb2e0 Do not cast simple_lock() to (void). It may be a do { } while() macro,
and then compilation fails.  Found by Håvard Eidnes.
2005-01-25 09:57:15 +00:00
matt 027c11539b Add IFNET_FOREACH and IFADDR_FOREACH macros and start using them. 2005-01-24 21:25:09 +00:00
enami f1b6d58e81 To fix bad pointer dereference on start up when gif is used,
- Allow rn_init() to be called multiple times, but do nothing except the
  first call.
- Include opt_inet.h so that #ifdef INET works.
- Call rn_init() from encap_init() explicitly rather than depending on the
  order of initialization.
2005-01-24 04:46:49 +00:00
matt d341be30f4 Change initialzie of domains to use link sets. Switch to using STAILQ.
Add a convenience macro DOMAIN_FOREACH to interate through the domain.
2005-01-23 18:41:56 +00:00
cube d76d637295 s/PF_LINK/AF_LINK/ because that way it makes sense. 2005-01-22 07:33:56 +00:00
martin 5e83f0d7e8 Remove deleted interfaces from the instance list (inspired by an OpenBSD
change). While there, fix a comment.
2005-01-19 15:05:55 +00:00
cube 755855a1f9 Make this LKM-friendly by using _KERNEL_OPT and having a prototype for the
sysctl setup function.
2005-01-19 10:18:40 +00:00
itojun 5377005da8 ESP AESCTR got an official protocol number
http://www.iana.org/assignments/isakmp-registry
2005-01-14 04:11:55 +00:00
yamt d502f705e1 ifioctl: don't use super user priviledge unless it's needed. 2005-01-09 12:18:46 +00:00
cube da24800d8c Install net/if_tap.h. 2005-01-08 22:28:51 +00:00
cube 0615d0207e Addition of tap(4).
NAME
     tap - virtual Ethernet device

SYNOPSIS
     pseudo-device tap

DESCRIPTION
     The tap driver allows the creation and use of virtual Ethernet devices.
     Those interfaces appear just as any real Ethernet NIC to the kernel, but
     can also be accessed by userland through a character device node in order
     to read frames being sent by the system or to inject frames.

     In that respect it is very similar to what tun(4) provides, but the added
     Ethernet layer allows easy integration with machine emulators or virtual
     Ethernet networks through the use of bridge(4) with tunneling.

``Qui tacet consentire videtur.''
2005-01-08 22:27:54 +00:00
yamt 6292485301 constify broadcastaddr. 2005-01-08 03:18:18 +00:00
yamt d06c4aee84 remove an unused member, enm_ec from ether_multi. 2005-01-08 03:13:09 +00:00
yamt f276045e22 add ETHERTYPE_SLOWPROTOCOLS. (0x8809) 2005-01-07 12:37:55 +00:00
reinoud 486e5e2819 Fixup of bad patch made by me; the #ifdef ought to be also including ISO
rather than being removed. Also fixed a small comment about the scope of
#if's.

This code is a but ugly IMHO but as long as we dont have to change it ....
2004-12-30 15:38:50 +00:00
reinoud 533a9f0186 Remove conditional around label. Its allways used in the code and thus not
explicitly only for the protocols indicated by the #if

Allthough its unlikely a kernel will be build without NET_INET, it will
fail compilation here when NET_INET is not defined.
2004-12-29 17:57:19 +00:00
itojun b97cc48910 whitespace 2004-12-22 05:11:24 +00:00
dyoung a8699ab9a4 As pointed out by Greg Troxel, ifmedia_entrys were allocated with
malloc_type M_IFADDR and freed with malloc_type M_DEVBUF.  This
causes a panic(9) in DIAGNOSTIC kernels.  Add malloc_type M_IFMEDIA
and use it for both malloc'ing and free'ing ifmedia_entrys.
2004-12-08 20:37:43 +00:00
martin 0a72984c77 Factor out softc cleanup after loss of session into pppoe_clear_softc.
Use this when loosing the ethernet interface (when it deataches).
Fixes PR kern/28375.
2004-12-08 07:43:29 +00:00
itojun bc4b33d8be reqid (for unique policy) is u_int16_t quantity. from markus@openbsd 2004-12-06 08:05:26 +00:00
christos 64573a67d7 Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined. 2004-12-06 02:59:23 +00:00
christos 6d413e70c4 pasto: simple_lock -> simple_unlock. 2004-12-05 15:03:13 +00:00
peter 42fc7edb33 Use ANSI function decls, change a few 0 to NULL. 2004-12-05 15:02:30 +00:00
peter cf47c76c1b Don't forget to call bpfdetach in the clone destroy function.
While here, add a missing static and change some spaces to tabs.
2004-12-05 15:00:47 +00:00
he 8194ddc3a5 Fix what must have been an omission: missing brace and a leftover
use of `i', which is no longer defined.  Fixes build problem for ports
not defining __HAVE_GENERIC_SOFT_INTERRUPTS.
2004-12-05 14:56:50 +00:00
he fdd8e7a3e5 Fix an obvious typo: scf -> sc. Discovered while compiling for x68k. 2004-12-05 13:32:03 +00:00
christos d2773f76b5 fix compilation issues. my kernel did not have strip... 2004-12-05 06:53:33 +00:00
christos f08ea58021 clonify strip and sl. 2004-12-05 05:43:04 +00:00
christos 7a05522334 void in arg prototype. 2004-12-05 05:42:19 +00:00
christos f11e795a0f Make ppp a cloning device. Based on the work of Quentin Garnier. 2004-12-05 04:15:16 +00:00
peter e3ceb08f8d Remove redundant conditional; NTUN is always 1 when this file is compiled.
Also remove tun.h include, since it's no longer needed.
2004-12-04 23:22:58 +00:00
peter 4f51481269 Fix a typo in Bill Studenmund's name. 2004-12-04 23:03:33 +00:00
peter b9c49ebff1 Change ifc_destroy to return an int instead of void, so that it
can pass back errors to ifconfig.
2004-12-04 18:31:43 +00:00
peter 396b87b8c2 Convert lo(4) to a clonable device.
This also removes the loif array and changes all code to use the new
lo0ifp pointer which points to the lo0 ifnet structure.

Approved by christos.
2004-12-04 16:10:25 +00:00
christos 0146482549 Clonify bpf. I am not changing /dev/bpfX -> /dev/bpf until all userland
programs have been fixed.
2004-11-30 04:28:43 +00:00
skrll 4979a4d3be Re-order the inclusion of opt_pfil_hooks so PFIL_HOOKS gets set properly. 2004-11-28 17:16:10 +00:00
martin e07d3f82e7 Add a pfil(9) hook to get notified when interfaces detach.
When the ethernet interface of a pppoe pseudo-interface detaches, remove
the association and mark the pppoe interface down.
This should fix PR kern/28375.
2004-11-28 11:44:36 +00:00
wiz 95f9af9926 Apply patch from PR 23990 by Greg Troxel (s/AF_DLI/AF_LINK/ in a comment):
<net/if_dl.h> defines struct sockaddr_dl.  On the line defining member
"sdl_family" (which overlaps "sa_family" in struct sockaddr), the
comment says AF_DLI.

But,
1) AF_DLI is said to be a DEC Direct data link interface
   (sys/socket.h)
2) The kernel actually sends sockaddr_dl structs with AF_LINK.
2004-11-20 00:53:13 +00:00
dsl de3f63a902 Add prototypes for functions that convert media to/from strings.
In libutil/if_media.c (moved from ifconfig.c so that they can be shared
in crunched binaries)
2004-11-11 20:34:30 +00:00
christos fbbeedbe63 PR/27286: Tom Ivar Helbekkmo: Allow RTM_GET to work with RTA_IFA|RTA_IFP set.
Quiting Tom: The problem is the special case of an RTM_GET message
that wants interface information included in the response, and
therefore include the RTA_IFA or RTA_IFP (or both) flags in the
bitmask that says what addresses are supplied in the message.  For
the RTM_GET message, it doesn't make sense to supply addresses
other than the one you're asking about, so those two other bits
are, in that specific case, overloaded with this meaning.

There is code in sys/net/rtsock.c to handle the case, but at some
time, extra sanity checking of the received message was added, that
failed to take this possibility into account.

The patch, is needed for the Asterisk software PBX to work properly
when it has multiple interfaces active: it needs to ask the kernel
for the IP address of the interface that will be used to communicate
with a given host.
2004-10-23 19:13:22 +00:00
dsl 43dde40d82 Put spaces either side of '|' for clarity ('|' looks too much like 'I' or 'l') 2004-10-16 11:11:04 +00:00
tron 8982fe0346 Backout last two revision:
1.) There is objection against this change by at least one developer.
2.) These changes cause repeatable system lockups and crashes for
    at least four people.
2004-10-07 20:06:58 +00:00
bad 2a256a96ac Interfaces that do checksum offloading indicate the checksum status of
received packets in csum_flags in the packet header.  Packets that are
forwarded over the bridge need to have csum_flags cleared before being
put on the output queue.  Do so in bridge_enqueue().

Discussed with Jason Thorpe.

Fixes PR kern/27007 and the first part of PR kern/21831.
2004-10-06 10:01:00 +00:00
itojun 6c66b599bb use ifunit() 2004-10-06 03:49:03 +00:00
itojun dd505f6f10 call dom_ifattach[] at consistent state. before this commit, dom_ifattach[]
was called after interface attach is completely done for non-cloning interface,
and from within if_attach() for cloning interface (which was wrong).
2004-10-06 02:44:32 +00:00
christos 557877d024 Only enable BRIDGE_IPF code if PFIL_HOOKS is enabled. 2004-10-05 03:36:45 +00:00
christos a9703830cd Fix problem in previous commit; we need to create a new sockaddr. 2004-09-30 00:14:05 +00:00
christos efff5f0097 PR/22849: Sean Boudreau: rtrequest() w/ RTM_DELETE not honouring netmask
as it does w/ RTM_ADD.
2004-09-29 21:19:33 +00:00
dyoung e2727a9d0b Add several new DLTs. From tcpdump.org. 2004-09-28 03:34:21 +00:00
yamt 0a9623de9c call PFIL_IFADDR hooks where appropriate. 2004-09-18 16:04:41 +00:00
tron 139c8b8dfc Pass correct "mbuf" pointer to BPF framework. 2004-08-20 07:46:21 +00:00
enami 9e4955fd5e Fix compilation error introduced by prevoius commit. 2004-08-20 00:37:07 +00:00
christos 0f7d471853 Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.
2004-08-19 20:58:23 +00:00
christos 396c380971 - ansify
- remove unnecessary casts
- change caddr_t to void *
- no functional change.
2004-08-19 18:33:24 +00:00
itojun 682ddb0274 initialize max_keylen for ip_encap.c earlier 2004-08-17 07:05:34 +00:00
enami e3ad2a7b68 Don't refuse to attach an interface even if it is down so that one can
capture the very first packet when an interface is up.
2004-08-05 03:58:58 +00:00
yamt 0370fc7128 - rename PFIL_NEWIF to PFIL_IFNET, and handle interface detach events
as well.
- use it for pf(4).

mostly from Peter Postma.  PR/26403.
2004-07-27 12:22:59 +00:00
mycroft 7f1170d9a9 Add ETHERTYPE_PAE. 2004-07-23 05:13:15 +00:00
yamt 7fcbdfb1fe pfil_run_hooks: don't dereference 'mp' unless it's a pointer. 2004-07-18 11:36:04 +00:00
mycroft 7cd90d66b7 If the parent interface is not IFF_RUNNING, do not call its start function.
This prevent a variety of fun panics, and therefore fixes PR 12932, PR 17561,
and PR 18376...

XXX
...however this is most definitely a hack.  The real problem here is that there
is no callback to notify a "client" interface like vlan when a "parent"
interface's status changes, and therefore the vlan interface is always
IFF_RUNNING.  This allows packets to be queued on vlan interface at any time.
We can't simply leave the packets on the vlan interface, either, because there
is no callback to dequeue them.  And last, since it's always IFF_RUNNING, if
we just *toss* the packets, we lose gratuitous ARPs and DAD packets.

"This needs work," but at least it no longer bleeds.
2004-07-08 19:09:12 +00:00
dyoung 225bd76ac3 I changed pppoutput to use M_PREPEND. pppoutput was duplicating
the functionality of M_PREPEND, but with a bug: m_pkthdr.len was
not updated in pppoutput as it is in M_PREPEND.

Also, replace the loop that measures the length of the mbuf chain
with a call to m_length.

This fixes a PR from an anonymous bug reporter.  Thank you, anonymous
bug reporter.  Thanks, Itojun, for bringing the anonymous bug report
to my attention.
2004-07-03 18:11:33 +00:00
jonathan 5249b5a2a5 Rename MBUFTRACE helper function m_claim() to m_claimm(),
for consistency with M_FREE() and m_freem().  Affected files:

sys/mbuf.h
kern/uipc_socket2.c
kern/uipc_mbuf.c
net/if_ethersubr.c
netatalk/ddp_input.c
nfs/nfs_socket.c
2004-06-24 04:15:50 +00:00
itojun ffe2ca6827 fix "includes" for pfvar.h 2004-06-22 14:29:45 +00:00
itojun a225f02f05 foundation for PF 2004-06-22 14:04:04 +00:00
itojun 047170b1cc prepare PF-related hooks. reviewed by matt, perry, christos 2004-06-22 12:50:41 +00:00
wiz e64be32767 Onno van der Linden assigned copyright for his work on this file
to TNF. Change license accordingly. Ok'd by christos for board.
2004-06-18 19:41:25 +00:00
dyoung 8c3cb8f859 Resolve kern/25721 by detaching ethernet(-like) devices from a
bridge in ether_ifdetach.
2004-06-06 04:44:05 +00:00
dyoung eaa20d476a Use bpf_mtap2 in tun(4). 2004-06-06 04:36:29 +00:00
dyoung e80559eec4 Per Matt Thomas' and Darren Reed's suggestions:
Add bpf_deliver prototype.

Rename bpf_measure to m_length and move it to sys/sys/mbuf.h.  I
make m_length an inline function in the header file to preserve
its performance characteristics, for better or for worse.

Optimize m_length: use the length in m_pkthdr.len, if M_PKTHDR.

In bpf_deliver, zero the on-stack mbuf before we do anything else
with it.
2004-06-06 04:35:53 +00:00
darrenr eda7e8d3e3 back out previous change - these diffs aren't what I'd tested. 2004-05-29 14:18:33 +00:00
darrenr 15f2ef8f2c add mmap(2) interface to bpf(4) devices, along with BIOCMMAPINFO ioctl call
for applications to interact with the bpf device for the purpose of using
mmap to examinen captured data.
2004-05-29 08:56:19 +00:00
atatat 4de3747b89 Sysctl descriptions under net subtree (net.key not done) 2004-05-25 04:33:59 +00:00
darrenr 643574e764 reapply a change that got undone with more recent changes to bpf to wakeup
any sleepers _after_ the device info has been updated, not before.
2004-05-19 13:09:11 +00:00
pk 454a5a1188 Fix locking issues noticed by Tom Ivar Helbekkmo on tech-net:
* always acquire the device instance lock at splnet()
	* missing unlocks in various places

Also, since this driver allows its device instances manipulated by two
independent subsystems (character device & interface clone create/destroy),
be careful not to rip away instance data in a clone destroy request if the
instance is still opened as a character device.
2004-05-14 13:23:12 +00:00
tron edadbda9d6 Initialize interface type to IFT_TUNNEL as suggested by Erik Änggård
in PR kern/25555.
2004-05-13 11:31:09 +00:00
tron 7d553415ce Mark gre(4) interfaces as IFT_TUNNEL (Encapsulation interface). 2004-05-13 11:29:40 +00:00
dyoung e0ea6bdc5d Add bpf_mtap2, which taps a packet whose head is in a void *buffer
and whose tail is in an mbuf chain.
2004-04-30 22:07:21 +00:00
matt e06794e93a Remove #else of #if __STDC__ 2004-04-26 01:41:15 +00:00
jonathan 887b782b0b Initial commit of a port of the FreeBSD implementation of RFC 2385
(MD5 signatures for TCP, as used with BGP).  Credit for original
FreeBSD code goes to Bruce M. Simpson, with FreeBSD sponsorship
credited to sentex.net.  Shortening of the setsockopt() name
attributed to Vincent Jardin.

This commit is a minimal, working version of the FreeBSD code, as
MFC'ed to FreeBSD-4. It has received minimal testing with a ttcp
modified to set the TCP-MD5 option; BMS's additions to tcpdump-current
(tcpdump -M) confirm that the MD5 signatures are correct.  Committed
as-is for further testing between a NetBSD BGP speaker (e.g., quagga)
and industry-standard BGP speakers (e.g., Cisco, Juniper).


NOTE: This version has two potential flaws. First, I do see any code
that verifies recieved TCP-MD5 signatures.  Second, the TCP-MD5
options are internally padded and assumed to be 32-bit aligned. A more
space-efficient scheme is to pack all TCP options densely (and
possibly unaligned) into the TCP header ; then do one final padding to
a 4-byte boundary.  Pre-existing comments note that accounting for
TCP-option space when we add SACK is yet to be done. For now, I'm
punting on that; we can solve it properly, in a way that will handle
SACK blocks, as a separate exercise.

In case a pullup to NetBSD-2 is requested, this adds sys/netipsec/xform_tcp.c
,and modifies:

sys/net/pfkeyv2.h,v 1.15
sys/netinet/files.netinet,v 1.5
sys/netinet/ip.h,v 1.25
sys/netinet/tcp.h,v 1.15
sys/netinet/tcp_input.c,v 1.200
sys/netinet/tcp_output.c,v 1.109
sys/netinet/tcp_subr.c,v 1.165
sys/netinet/tcp_usrreq.c,v 1.89
sys/netinet/tcp_var.h,v 1.109
sys/netipsec/files.netipsec,v 1.3
sys/netipsec/ipsec.c,v 1.11
sys/netipsec/ipsec.h,v 1.7
sys/netipsec/key.c,v 1.11
share/man/man4/tcp.4,v 1.16
lib/libipsec/pfkey.c,v 1.20
lib/libipsec/pfkey_dump.c,v 1.17
lib/libipsec/policy_token.l,v 1.8
sbin/setkey/parse.y,v 1.14
sbin/setkey/setkey.8,v 1.27
sbin/setkey/token.l,v 1.15

Note that the preceding two revisions to tcp.4 will be
required to cleanly apply this diff.
2004-04-25 22:25:03 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00