Commit Graph

1441 Commits

Author SHA1 Message Date
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
simonb 9bc855a931 s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).
2004-04-23 02:58:27 +00:00
matt e50668c7fa Constify protosw arrays. This can reduce the kernel .data section by
over 4K (if all the network protocols) are loaded.
2004-04-22 01:01:40 +00:00
matt 7cf8938ddd ANSI-fy and some additional de-__P and constification. 2004-04-21 21:03:43 +00:00
itojun d6c33e0ef5 kill a sprintf 2004-04-21 19:10:31 +00:00
itojun d2f1c029b9 kill sprintf, use snprintf 2004-04-21 18:40:37 +00:00
itojun d66a0005a1 sprintf -> snprintf 2004-04-21 17:45:38 +00:00
christos fced18d9f6 fix constification botch. (hi gimpy) 2004-04-21 15:51:22 +00:00
matt e3b919c754 Constify if.c radix.c and route.c (and fix related fallout). 2004-04-21 04:17:28 +00:00
darrenr 2466d2e86c If we timeout waiting for data on the bpf device, allow data in the current
storage buffer (bd_sbuf) to indicate that there is data present.
2004-04-20 10:51:09 +00:00
darrenr 12d715a3ee don't use u_long in an ioctl, rather, u_int64_t so there are no long 32/64
bit compatibility problems.  bump kernel version like it should have been.
2004-04-15 15:17:11 +00:00
darrenr 4800529c7e Add a count of the number of packets that match the bpf filter applied to a
particule device.  In doing this, make a new the bpf_stat structure with
members that are u_long rather than u_int, matching the counters in the bpf_d.
the original bpf_stat is now bpf_stat_old and so to the original ioctl
is preserved as BIOCGSTATSOLD.
2004-04-15 14:56:57 +00:00
darrenr 6cfa637a10 * from bpf 1.2a1, use the IO_NDELAY flag in bpfread() to indicate whether or
not a read operation should be allowed to sleep.  This allows the use of
  bd_rtout with a value of "-1" to be eliminated (signed comparison and
  assignment to an unsigned long.)
* in 1.91, a change was introduced that had bpfpoll() returning POLLRDNORM
  set when the timeout expired.  This impacted poorly on performance as well
  as causing select to return an fd available for reading when it wasn't.
  Change the behaviour here to only allow the possibility of POLLIN being
  returned as active in the event of a timeout.
2004-04-14 21:34:26 +00:00
darrenr c4acd0486b from freebsd's kern/36219, the if expression in deciding whether or not
to return something check the value of bd_state in the wrong place.
2004-04-11 01:41:01 +00:00
darrenr eee3190c06 Fix bpf so that select will return for a timeout (from FreeBSD.)
Fix the behaviour of BIOCIMMEDIATE (fix from LBL BPF code via FreeBSD.)

In bpf_mtap(), optimise the calling of bpf_filter() and catchpacket()
based on whether or not the entire packet is in one mbuf (based on
similar change FreeBSD but fixes BIOC*SEESENT issue with that.)

Copy the implementation of BIOCSSEESENT, BIOCGSEESENT by FreeBSD.

Review Assistance: Guy Harris

PRs: kern/8674, kern/12170
2004-04-10 23:31:51 +00:00
thorpej 15921b5f23 De-__P'ify. 2004-04-09 20:44:57 +00:00
thorpej 13357b24dd Add flow control-related media bits / descriptions.
From HITOSHI Osada.
2004-04-09 20:30:28 +00:00
martin 8133a23a7e Be more paranoid about data a non-root user may query.
Fixes PR kern/25099 by Christian Biere.
2004-04-08 09:26:59 +00:00
oki 1ced25841d fixed mbuf leak if up pppoe but not connected an ether i/f. 2004-03-30 06:00:13 +00:00
is 6de8cab7db UCB no longer requires the advertising clause. 2004-03-25 10:53:46 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
matt 3a04cc5c7f Update my copyright to not include advertising clause. 2004-03-22 18:02:12 +00:00
keihan 2ece851d2e Add 10GBASE-LR to IFM_10G_LR. 2004-03-10 14:42:10 +00:00
tron a188d6072b Don't leak memory if a copyin fails. 2004-03-01 13:54:02 +00:00
ragge 9a3ec25f87 Add media type 10GbaseLR. Change ifmb_baudrate and ifmedia_baudrate()
to u_quad_t instead of int (common speed today exceeds 2Gbit).
2004-02-19 11:58:30 +00:00
jdc 99807188f8 Use m_copydata(), m_adj() and M_PREPEND() to manipulate mbuf's in
bridge_ipf().  Fixes kernel memory corruption that occured when using
m_split() and m_cat().
Idea from OpenBSD.
2004-01-31 20:11:13 +00:00
drochner ce20d083dc make it compile with !(INET || INET6) 2004-01-29 16:33:14 +00:00
jonathan 638afbfe26 Make bpf_maxbufsize writable via sysctl, as written by Andrew Brown. 2004-01-22 00:32:41 +00:00
jonathan 9369f19096 Fix an Emacs finger-glitch (missing semicolon#). 2004-01-21 23:59:12 +00:00
jonathan b0a71dcaf5 Update bpf buffer parameters, as per recent discussion on tech-net.
Increase the default bpf buffer size used by naive apps that don't do
BIOCSBLEN, from 8k to 32k.  The former value of 8192 is too small to
hold a normal jumbo Ethernet frame (circa 9k), 16k is a little small
for Large-jumbo (~16k) frames supported by newer gigabit
Ethernet/10Gbe, so (somewhat arbitrarily) increase the default to 32k.

Increase the upper limit to which BIOSBLEN can raise bpf buffer-size
drastically, to 1 Mbyte.  State-of-the-art for packet capture circa
1999 was around 256k; savvy NetBSD developers now use 1 Mbyte.
Note that libpcap has been updated to do binary-search on BIOCSBLEN
values up to 1 Mbyte.

Work is in progress to make both values sysctl'able. Source comments
note that consensus on tech-net is that we should find some heuristic
to set the boot-time default values dynamically, based on system memory.
2004-01-21 22:15:16 +00:00
atatat b81e36a907 Remove redundant prototypes 2004-01-19 16:12:51 +00:00
atatat b1c111a62a Sysctl functions called for "generic" nodes should forward "query"
requests (where possible), rather than returning errors.
2003-12-28 22:36:37 +00:00
martin d59fb7b8a3 Add a new ioctl SPPPGETSTATUSNCP to query the PPP phase and check wether
any NCP is UP.
2003-12-26 23:39:23 +00:00
itojun 235e090dea gi_len is ip_len, so it has to be network byteorder. markus friedl 2003-12-11 00:22:29 +00:00
itojun aa8a6718f0 use if_indexlim (instead of if_index) and ifindex2ifnet[x] != NULL
to check if interface exists, as (1) if_index has different meaning
(2) ifindex2ifnet could become NULL when interface gets destroyed,
since when we have introduced dynamically-created interfaces.  from kame
2003-12-10 11:46:33 +00:00
augustss e58307e458 Fix spelling mistake in a comment. 2003-12-09 19:33:22 +00:00
scw a9760a89e4 To cater for VLAN-aware layer 2 ethernet switches which may need to strip
the tag before forwarding the packet, make sure the packet+tag is at least
68 bytes long.

This is necessary because our parent will only pad to 64 bytes (ETHER_MIN_LEN)
and some switches will not pad by themselves after deleting a tag.
2003-12-05 19:35:43 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
keihan 6979203302 s/netbsd.org/NetBSD.org/g 2003-11-28 08:56:48 +00:00
dyoung 23d8f48692 Add data-link type DLT_IEEE802_11_RADIO to wi and atw. DLT_IEEE802_11_RADIO
lets you monitor radio stats like received signal strength, which
diversity antenna was used, channel/frequency, modulation, and data
rate.
2003-11-16 09:02:42 +00:00
jonathan fa24e6f3f8 Add m_tag_delete_nonpesrsistent(), for deleting all packet tags on
mbuf chains which are recycled (e.g., ICMP reflection, loopback
interface).  A consensus was reached that such recycled packets should
behave (more-or-less) the same way if a new chain had been allocated
and the contents copied to that chain.

Some packet tags may in future be marked as "persistent" (e.g., for
mandatory access controls) and should persist across such deletion.
NetBSD as yet hos no persistent tags, so m_tag_delete_nonpersistent()
just deletes all tags. This should not be relied upon.
2003-11-13 01:48:12 +00:00
cl e6bcfbd5e0 catch up with in_ifaddr -> in_ifaddrhead rename 2003-11-12 13:40:16 +00:00
drochner 14332cf998 fix interface address list traversal in if_detach():
The code was assuming that interface addresses are removed one-by-one.
With IPv6 and multicasts, removal of one address can remove other
addresses as side effect, which caused accesses of free()d memory.
2003-11-11 20:33:46 +00:00
jonathan 88ba77e705 Make per-protocol network input queue stats visible to userland via
sysctl. Add a protocol-independent sysctl handler to show the per-protocol
"struct ifq' statistics. Add IP(v4) specific call to the handler.
Other protocols can show their per-protocol input statistics by
allocating a sysclt node and calling sysctl_ifq() with their own struct ifq *.

As posted to tech-kern plus improvements/cleanup suggested by Andrew Brown.
2003-11-10 20:03:29 +00:00
wiz ee1b406595 Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.
2003-11-10 08:51:51 +00:00
briggs 953bcec0ab ifmedia_set() should not panic, nor can it really fail. So if there is
some problem setting the media to the requested value (usually IFM_AUTO),
we now force the media selection to IFM_NONE.
This addresses PR/14029 ``panic("ifmedia_set") a little too brutal''
and may address to some degree PR/19504 and PR/23341.
2003-11-03 14:43:32 +00:00
simonb a2facef339 Remove some assigned-to but otherwise unused variables. 2003-10-30 01:43:08 +00:00
mycroft 8785679414 Mark this initializer in the canonical way so it can be found later. 2003-10-28 22:31:12 +00:00
mycroft a72eae7293 Fix previous differently. 2003-10-28 20:21:44 +00:00
mycroft 8655a8eb83 Also, if we're going to bail, we should free the memory we just allocated... 2003-10-28 20:16:28 +00:00
mycroft 52beeea9f1 Previous patch created a dead break. 2003-10-28 20:15:19 +00:00
mycroft a071a627d4 Return a sensible error code in the previous. 2003-10-28 20:13:23 +00:00
christos 82653d230d Fix uninitialized variable warnings.` 2003-10-26 19:09:44 +00:00
christos 125ccd91b1 Fix uninitialized variable warnings 2003-10-25 18:29:12 +00:00
dyoung 5cea02e6fe Complete replacement of the old 802.11 layer with the new. 2003-10-13 08:34:15 +00:00
dyoung 690ab87058 Use new 802.11 header files. 2003-10-13 08:02:02 +00:00
dyoung dd813020b9 Add constants and strings for 802.11 radios with OFDM PHY (802.11a,
802.11g).

Add constants and strings for multi-mode devices (a/b/g).

From FreeBSD/Sam Leffler.
2003-10-13 05:06:44 +00:00
itojun 98d5598feb when dropping M_PKTHDR, need to free m_tag associated with it. 2003-10-03 20:56:11 +00:00
oki 59c580bc38 Correct debug message, mine is myauth, not hisauth. 2003-10-03 10:29:05 +00:00
itojun 2cc4a6b1a7 need to use m_freem(), not m_free(). from iij seil team 2003-10-02 07:13:57 +00:00
itojun 269a200e21 minor KNF 2003-10-02 01:27:20 +00:00
itojun ae7fc0a7d4 fix out-of-bounds access to ifindex2ifnet[]. found by iij seil team. 2003-10-01 04:22:33 +00:00
christos 36b4e0b6e7 Fix off-by-one in PRC_NCMDS check. From FreeBSD via OpenBSD 2003-09-30 00:01:18 +00:00
wiz cff5e477ad Process has only one c. From miod@openbsd. 2003-09-26 22:23:58 +00:00
cl c49d4a7e55 pass signo to fownsignal #ifdef ALTQ 2003-09-22 20:49:39 +00:00
christos 6edc0e184e - pass signo to fownsignal [ok by jd]
- make urg signal handling use fownsignal
- remove out of band detection in sowakeup
2003-09-22 12:59:55 +00:00
jdolecek 1fda9a87e7 kill unused variable in #ifdef ALTQ part, to make this compile
with ALTQ configured in
2003-09-22 03:29:34 +00:00
jdolecek 7cea8a1389 cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
  the owner of descriptor, according to appropriate sematics
  of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
  these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
  properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
  in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
  pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
2003-09-21 19:16:48 +00:00
martin 392a465bb8 Tell copyinstr about the real buffer size (not one byte to few). Add more
error checking. Noticed by Quentin Garnier.
2003-09-16 20:59:04 +00:00
jdc 3fc943e207 Adapt to account for bridge_enqueue()'s extra parameter. 2003-09-16 17:39:12 +00:00
jdc 7454db32b4 Add filter/no filter flag parameter to bridge_enqueue(). 2003-09-16 17:38:24 +00:00
jdc 32263965e2 Add a flag parameter to bridge_enqueue() to tell it whether to run the
filter or not.  We only need to run the filter for bridge_forward() and
bridge_broadcast().  If we also run it for bridge_output(), we will run
the filter twice outbound per packet, so don't.

In bridge_ipf(), make sure we don't run m_cat() on a single mbuf chain
by checking to see (and remembering) if we need to m_split() the mbuf.
This fixes bridge + ipfilter on sparc.

Fixes PR kern/22063.
2003-09-16 17:37:27 +00:00
martin 9e7359685b Fix copy & pasto (luckily, for most archs the structs had the same size,
so this went unnoticed for quite some time now). Noticed by Thomas Bieg.
2003-09-11 18:04:51 +00:00
drochner 1face2cc7a Fix vlan tag sending in the ETHERCAP_VLAN_HWTAGGING case.
Makes my "txp" work and fixes "bge" -- PR kern/20363 by Scott Ellis.
2003-09-09 14:22:19 +00:00
martin 6dd20a92b2 Fix copy & pasto. 2003-09-05 23:13:15 +00:00
itojun 9636351c96 u_short -> u_int16_t 2003-09-05 23:02:40 +00:00
christos a0e952bddb bump the buffer size from 15 to 63 bytes. 2003-09-04 07:46:47 +00:00
martin 965fbb9f63 If the peer cares to send us error messages, actually display them. 2003-09-03 21:36:31 +00:00
martin 6f2d2eefc7 Rearange dead link detection slightly:
As long as we receive data from the peer, don't worry. When we have not
received anything within the "max_noreceive" period, we start sending LCP
echo requests and count them, until we receive an answer (or some data)
or the "maxalive" count of not answered echo requests is reached.
All this is checked at a global 10 seconds interval for all interfaces.
The "max_noreceive" period and the "maxalive" count are configurable per
interface.
2003-09-03 20:48:46 +00:00
christos ab661a6a58 Add a new ioctl PPPIOCGRAWIN to get the last characters we got from the
remote site.
2003-09-01 16:51:25 +00:00
martin f5a54fd742 When trying to (re-)establish a session cope with intermediate output
failures of the underlying ethernet interface - just keep trying.
2003-08-23 16:42:41 +00:00
itojun 82eb4ce914 change the additional arg to be passed to ip{,6}_output to struct socket *.
this fixes KAME policy lookup which was broken by the previous commit.
2003-08-22 21:53:01 +00:00
jonathan f4c2260f8a Make if_loop MTU settable via SIOCSFMTU/ifconfig. Useful for testing,
and for regression-testing performance at various MTUs.

NB: route MTU may not track MTU changes, which may cause problems for
AF_ISO if loopback MTU is decreased. I've never seen problems with IP,
in various tests going back to around NetBSD 1.3.
2003-08-15 19:22:08 +00:00
jonathan 28b5f5dfab (fast-ipsec): Add hooks to pass IPv4 IPsec traffic into fast-ipsec, if
configured with ``options FAST_IPSEC''.  Kernels with KAME IPsec or
with no IPsec should work as before.

All calls to ip_output() now always pass an additional compulsory
argument: the inpcb associated with the packet being sent,
or 0 if no inpcb is available.

Fast-ipsec tested with ICMP or UDP over ESP. TCP doesn't work, yet.
2003-08-15 03:42:00 +00:00
itojun 230da08946 correct number range handling. David Young 2003-08-14 07:39:22 +00:00
itojun 25e6c004c4 fix INT_MAX check in if_clone_lookup 2003-08-14 00:19:43 +00:00
itojun 326e7bdf59 correct if_clone_lookup(). based on diff from Quentin Garnier 2003-08-14 00:13:34 +00:00
wrstuden 2d11b64df0 Include correct file for defopt. 2003-08-13 19:44:12 +00:00
itojun 497e73e9cf rm extra blank line 2003-08-11 15:14:16 +00:00
itojun bdbf60398b minor knf 2003-08-11 15:13:59 +00:00
christos 27ffe34f72 Fix problem with OSIOCIFCONF where it tried to copyout addresses that
did not fit in struct osockaddr. Fixes linux emulation issue where bogus
addresses where returned for the interfaces [AF_LINK, AF_INET6]. While
I am here, change ioctl, so if the ifconf buffer passed is NULL, then it
computes how much space is needed and returns it in ifc_len.
2003-08-09 18:13:03 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
christos 9a1168a5bf Avoid DOS attack by setting ifm->ifm_media to a high number and running the
kernel out of memory. Thanks to Andreas Oman.
2003-07-25 19:35:57 +00:00
itojun 1270423572 add AH/ESP algorithms: hmac-ripemd160 (AH), AES XCBC MAC (AH),
AES counter mode (ESP)
2003-07-25 10:00:49 +00:00
itojun d64e1c8d6a add hmac-sha2 support. various cleanups (like avoid hardcoding '16').
from kame
2003-07-22 03:24:23 +00:00
itojun 7e053b8b90 decnetintrq is still in fddi/tokenring (is it needed?). 2003-07-15 06:24:38 +00:00
jdc e8e38ce54c Include opt_inet.h to get INET6 definition.
Now, bridged ipv6 packets are passed through ipfilter.
However, some v6 packets still do not get transmitted when ipf is enabled.
Partial fix for PR kern/22063.
2003-07-13 08:51:36 +00:00
martin 2951cb8e99 We should use IFQ_DEQUEUE to get packets from the send queue, not IF_DEQUEUE.
Hopefully this will fix ALTQ for ISDN and PPPoE interfaces.

While there remove an unsued function which contained dubious code
(accessing interface queue internals w/o the proper macros).
2003-07-09 20:12:53 +00:00
itojun 91b11e1eba prototype must not have variable name 2003-07-08 07:13:50 +00:00
dyoung 4451fcd003 From Sam Leffler/FreeBSD: AP scanning code, for forthcoming ADM8211
driver (and for eventual synchronization w/ Sam's enhancements to
FreeBSD).

From dyoung@netbsd.org, factor ieee80211_create_ibss and
ieee80211_match_bss out of ieee80211_end_scan for re-use in the
forthcoming ADM8211 driver.
2003-07-06 20:54:24 +00:00
dyoung 07a1dea78b A straggler in the 802.11 media-handling consolidation. 2003-07-06 20:24:51 +00:00
dyoung 6e3daf0a07 Still more consolidation of 802.11 media-handling, moving moving
common code from awi and wi into the 802.11 framework. Inspired by
Sam Leffler's patches to FreeBSD.
2003-07-06 20:01:17 +00:00
dyoung 9311a1d632 Move the logic to find out what channel to transmit a packet on
into ieee80211_get_channel, rather than duplicate it in ieee80211_ioctl
and in the ADM8211 driver.
2003-07-06 08:39:59 +00:00
dyoung 868fc8b800 Bug fix: an ad-hoc node's SSID can change at any time, so record
a change of SSID (provided it changes to a non-empty SSID) regardless
of whether it comes in a probe response or a beacon.
2003-07-06 08:27:04 +00:00
dyoung 6f114d314a With the IEEE80211_HEADER_LEN macro, accomodate hardware whose
"native" 802.11 header is a 4-address header, not the 3-address
header.
2003-07-06 08:21:41 +00:00
dyoung 725bfbdab7 More 802.11 media-handling consolidation. ieee80211_media_status
and ieee80211_media_change are factorizations of the media
status/change functions for wi and awi. Inspired by Sam Leffler/FreeBSD.
2003-07-06 08:06:20 +00:00
dyoung 030634087a Prepare to consolidate 802.11 media handling (which is handled in
code duplicated by each driver, now) into the 802.11 framework.
2003-07-06 07:54:43 +00:00
dyoung 321cda0a59 In debug messages, tell on which channel we send a mgmt frame. 2003-07-06 07:33:57 +00:00
dyoung a068a2bdcd In debug messages, use the right MAC address to report which client
turned off power-saving mode.
2003-07-06 07:18:38 +00:00