Commit Graph

942 Commits

Author SHA1 Message Date
Maxim Konovalov
21147bea38 Remove duplicated and wrong sc->sc_last_recv setting. It unbreaks
active-filter in pppd(8).

PR:			kern/12281
Submitted by:		Tim Moore <moore@bricoworks.com>
Not objected by:	peter
Reviewed by:		ru
Approved by:		ru
MFC after:		1 week
2002-03-05 10:12:04 +00:00
Crist J. Clark
3174c81c9c Unbreak bridge.ko. Replace an unresolved symbol with the actions it
was meant to take.

Submitted by:	luigi
Approved by:	luigi
MFC after:	3 days
2002-03-05 00:07:17 +00:00
Brooks Davis
3d4ce33dbf Add cloning support to the loopback interface.
Submitted by:	mux
2002-03-04 21:46:00 +00:00
Brooks Davis
b75496fedf Change the network interface cloning API so the destroy function returns
an int errorcode instead of void in preperation for merging cloning of
the loopback device.

Submitted by:	mux
MFC after:	2 weeks
2002-03-04 21:43:49 +00:00
Peter Wemm
777b9faaa4 Fix warnings. 2002-02-28 00:09:17 +00:00
John Baldwin
a854ed9893 Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.
2002-02-27 18:32:23 +00:00
Brooks Davis
6f4ded3a73 Fix warnings in the gif(4) driver so it compiles with -Werror. 2002-02-26 20:11:33 +00:00
Matthew Dillon
b13de3b84f Did someone turn on -Werror or something?
Fix kernel breakage.
2002-02-26 17:11:37 +00:00
Warner Losh
0375947168 minor style(9) fix: return (foo); The file was mostly style(9) before. 2002-02-26 03:00:19 +00:00
Brooks Davis
7a46ec8f63 When using hardware decoding, reconstruct the wire form of the ethernet
header and push it up any attached bpf devices on the parent interface.
This makes hardware vlan decoding more like the normal software path.

Tested by:	cjtt@employees.org
MFC after:	2 weeks
2002-02-26 02:19:33 +00:00
Brooks Davis
872f786a75 Make gif(4) nesting level and parallel tunnel support tunable at runtime
via sysctl's.  The old #defines, MAX_GIF_NEST and XBONEHACK are
currently supported for backwards compatability, but will probably be
removed at some point in the future.
2002-02-26 01:56:56 +00:00
Peter Wemm
c0933269c3 Fix a warning by pulling prototype for arp_ifinit() into scope.
Then fix cast the correct value into an incorrect value, which was not
detected due to the missing prototype (but was harmless anyway).
2002-02-26 01:11:08 +00:00
Seigo Tanimura
f591779bb5 Lock struct pgrp, session and sigio.
New locks are:

- pgrpsess_lock which locks the whole pgrps and sessions,
- pg_mtx which protects the pgrp members, and
- s_mtx which protects the session members.

Please refer to sys/proc.h for the coverage of these locks.

Changes on the pgrp/session interface:

- pgfind() needs the pgrpsess_lock held.

- The caller of enterpgrp() is responsible to allocate a new pgrp and
  session.

- Call enterthispgrp() in order to enter an existing pgrp.

- pgsignal() requires a pgrp lock held.

Reviewed by:	jhb, alfred
Tested on:	cvsup.jp.FreeBSD.org
		(which is a quad-CPU machine running -current)
2002-02-23 11:12:57 +00:00
Luigi Rizzo
b2c08f43d0 When the local link address is changed, send out gratuitous ARPs
to notify other nodes about the address change. Otherwise, they
might try and keep using the old address until their arp table
entry times out and the address is refreshed.

Maybe this ought to be done for INET6 addresses as well but i have
no idea how to do it. It should be pretty straightforward though.

MFC-after: 10 days
2002-02-18 22:50:13 +00:00
Mike Barcroft
fd8e4ebc8c o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
  source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
  Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
  POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
  and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
  complexities associated with having MD (asm and inline) versions, and
  having to prevent exposure of these functions in other headers that
  happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
  third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on:	alpha, i386
Reviewed by:	bde, jake, tmm
2002-02-18 20:35:27 +00:00
Chris D. Faulhaber
efec00ac60 Error handling fixes for inflate. 2002-02-17 17:35:18 +00:00
Luigi Rizzo
e88516c29b Lots of improvement to the bridging code.
In order of importance:

 + each cluster now uses private data structures (filtering and
   local address tables) so you can treat them as fully independent
   switches. This part of the work was supported by:
        Cisco Systems, Inc. - NSITE lab, RTP, NC.

 + cleaned up the handling of configuration, so the system will behave
   much better when real or pseudo devices are dynamically attached
   or detached. It should also not panic anymore on systems with large
   number of devices, closing a few existings PRs on the topic.

 + while at it, add support for VLAN. This means that a FreeBSD box
   can now work as a real VLAN switch, with trunk interfaces etc.
   As an example:
        ifconfig vlan0 vlan 3 vlandev dc0
        ifconfig vlan1 vlan 4 vlandev dc0
        net.link.ether.bridge_cfg="vlan0:3,dc1:3,vlan1:4,dc1:4"
   uses dc0 as a trunk interface, and dc1 and dc3 as ports on vlans 3 and 4
   You get the idea...
   NOTA BENE: by default bridge_cfg is initialised to "" so even if
   you enable bridging, no packets will be bridged until you set the
   list of interfaces on which you want this to happen.

 + large restructuring of the code, moving private vars and types from
   bridge.h to bridge.c.

 + added a lot of comments to the code to explain how to use it.
2002-02-15 05:11:11 +00:00
Luigi Rizzo
cad15830dc Remove useless initialization to 0 of a couple of global variables. 2002-02-15 04:57:18 +00:00
Max Khon
8cfa8f7ec2 remove superflous empty line (in preparation to MFC) 2002-02-13 19:36:14 +00:00
Matthew Dillon
ecde8f7c29 Get rid of the twisted MFREE() macro entirely.
Reviewed by:	dg, bmilekic
MFC after:	3 days
2002-02-05 02:00:56 +00:00
Andrew Gallatin
694ff26473 Prevent the kernel from generating an unaligned sysctl data buffer on
64-bit platforms.  The unaligned access is caused by struct ifa_msghdr
not being a multiple of 8-bytes in size.  If an interface has an odd
number of addresses, this causes the next interface to generate an
unaligned access in the user-level app walking the interfaces (ifconfig).

Submitted by: Bernd Walter <ticso@cicely8.cicely.de>
2002-01-27 20:39:01 +00:00
Crist J. Clark
f7a54d06e5 Have sysctl() return the correct errno(2) as documented in the
sysctl(3) manpage.

Submitted by:	ru
Obtained from:	BSD/OS
2002-01-25 00:50:49 +00:00
Ruslan Ermilov
7b6edd044b Introduce an interface announcement message for the routing
socket so that routing daemons and other interested parties
know when an interface is attached/detached.

PR:		kern/33747
Obtained from:	NetBSD
MFC after:	2 weeks
2002-01-18 14:33:04 +00:00
Jesper Skriver
3cd675111b It turns out that when a broadcast packet is looped back, the checksums
are checked on the way in even if they were not calculated on the
way out.

This fixes rwhod

PR:			31954
Submitted by:	fenner
Approved by:	fenner
MFC after:	1 week
2002-01-11 16:04:47 +00:00
Max Khon
eda6ecb22a - generic Arcnet framework
- device driver for SMC COM90cx6 Arcnet network adapters

Obtained from:	NetBSD
2002-01-08 20:03:13 +00:00
Mike Smith
bedbd47e6a Initialise the intrq_present fields at runtime, not link time. This allows
us to load protocols at runtime, and avoids the use of common variables.

Also fix the ip6_intrq assignment so that it works at all.
2002-01-08 10:34:03 +00:00
Mike Smith
e8783c4d6b Staticise private interface lists. 2002-01-08 10:30:09 +00:00
Joerg Wunsch
ee037f26bc Implement an option to administratively disable the negotiation of
IPv6 on an sppp interface.  In an IPv6-enabled kernel, every IPv6
interface automatically gets an IPv6 address assigned (and IPv6
multicast packets sent at initialization time).  For sppp links where
we know our remote peer wouldn't support IPv6 at all, there's no point
in attempting to negotiate IPV6CP (or to even dial out for an IPv6
packet at all for dial-on-demand interfaces).

I wish there were a more generic way to administratively disable IPv6
on an interface instead.  ume told me there isn't.

While i was at it, converted both, enable_vj and enable_ipv6 into flag
bits in struct sppp (enable_vj used to be an int of its own).

MFC after:	1 month
2001-12-30 20:42:29 +00:00
Joerg Wunsch
909b37a414 Merge last-minute fix from the i4b file made by gj:
Protect mtx_init() invocations with mtx_intialized() checks to avoid a
reported panic.

MFC after:	1 month
2001-12-30 19:02:27 +00:00
Joerg Wunsch
fde5145a62 Bump AUTHNAMELEN to 64. Should probably be made dynamic instead. 2001-12-30 18:40:28 +00:00
Joerg Wunsch
e168d42851 We explicitly close LCP when going to state CLOSED, so we better open
it again when going from INITIAL to STARTING. This has been done for
passive or auto-conecting interfaces always, but not for permanent
ones.

Obtained from:	NetBSD (rev 1.32)
2001-12-30 18:39:38 +00:00
Joerg Wunsch
dda374a24d run IPCP only if we have IPv4 in kernel
Obtained from:	NetBSD (rev 1.19)
MFC after:	1 month
2001-12-30 18:07:26 +00:00
Joerg Wunsch
dd966920a7 Fix a long-standing blatant bug where the operator precedence between
& and && has been botched.  This was likely the cause for some havoc
with various negotiation cases of sppp in the past.

Obtained from:	NetBSD (rev 1.13)
MFC after:	1 week
2001-12-30 17:12:28 +00:00
Joerg Wunsch
d0543e885a Fix compilation without INET (though not really tested yet without
INET).

Obtained from:	NetBSD (rev 1.12)
MFC after:	1 month
2001-12-30 17:00:32 +00:00
Joerg Wunsch
61e3f21a46 Add the `packed' attribute to structures which describe wire protocol
data formats.

Obtained from:	NetBSD (rev 1.6)
MFC after:	1 month
2001-12-30 16:52:40 +00:00
Joerg Wunsch
39b6f10cfb Extend the hack where 0.0.0.1 meant `any address for remote is
acceptable' to addresses 0.0.0.*.  This allows for multiple such
interfaces.

MFC after:	1 month
2001-12-30 16:40:00 +00:00
Joerg Wunsch
64b158ad3c Fix the handling of VJ uncompression. Unfortunately, tcp_uncompress()
makes the implied assumption there were another 128 bytes of space in
front of the packet handed off to it... which is not the case for
sppp.  This could easily end up in corrupting random memory.

This fix is about the same as revs 1.6, 1.8, and 1.9 from our
i4b_ispppsubr.c.

Also fixed IPCP option negotiation to zero out the options when
starting IPCP.  Otherwise, if negotiation parameters change between
various IPCP startups, it could happen that old options would still be
requested (this happened if VJ was turned off, and ended up in half
off the link still negotiating for VJ compression).

IMHO, the base system's sppp is now feature-wise up to date with the
one in the i4b part of the tree, so the latter can be disabled.

MFC after:	1 month
2001-12-30 16:13:35 +00:00
Jake Burkholder
ebffbf8c3e sparc64 needs the same alingment fixes that alpha and ia64 do.
Submitted by:	tmm
2001-12-29 08:45:17 +00:00
Jake Burkholder
b0e00dbacb sparc64 needs the same alignment fixes that ia64 and alpha need.
Submitted by:	tmm
2001-12-29 08:44:08 +00:00
Joerg Wunsch
351fdc3fa9 Convert sppp_params() to use a malloced structure in order to reduce
kernel stack usage.

This effectively merges rev 1.3 of i4b's i4b_ispppsubr.c.

MFC after:	1 month
2001-12-28 23:36:35 +00:00
Joerg Wunsch
47d6b4a644 Fix my breakage to the low-level hardware sync drivers brought by the
inclusion of VJ compression into sppp.

Now, instead of the need to include this and that and everything plus
the kitchensink in each of those drivers, struct sppp uses struct
slcompress as an opaque structure only referenced by a pointer.  The
actual structure is then malloced at initialization time.

While i was at it, also fixed a bug where received VJ packets would only
be recognized if INET6 was defined.
2001-12-28 23:20:12 +00:00
Joerg Wunsch
5450aa1239 Implement timestamps so i4b/driver/i4b_isppp.c can derive the idle
time from the PPP packets sent.  This effectively merges rev 1.2 of
the old i4b_ispppsubr.c, with the exception that i eventually ended up
in debugging and fixing it so the idle time is now really
detected. ;-)  (The version in i4b simply doesn't work right since it
still accounts for incoming LCP echo packets which it is supposed to
ignore for idle time considerations...)

Obtained from:	i4b
MFC after:	1 month
2001-12-28 15:59:54 +00:00
Joerg Wunsch
39cb697c8c Break out the relevant fields from struct sppp into a struct
sppp_parms that are needed for the SPPPIO[GS]DEFS ioctl commands.
This allows it to keep struct sppp inside #ifdef _KERNEL (where it
belongs), and prevents userland programs that wish to include
<net/if_sppp.h> from including the earth, the hell, and the universe
before the are able to resolve all the kernel-internal stuff that's in
struct sppp.

Discussed with:	hm
MFC after:	1 month
2001-12-27 22:38:50 +00:00
Joerg Wunsch
ea77971c6c Make the LCP restart timer configurable.
This (effectively) merges rev 1.36 of i4b's old if_spppsubr.c, albeit
in a slightly different manner (we export the timer in millisecond
values as exposed to tick values from/to userland).

Obtained from:	i4b
MFC after:	1 month
2001-12-27 21:20:05 +00:00
Joerg Wunsch
1a5d6f5e0b Implement VJ header compression for sppp.
This is the logical merge of rev 1.32 of i4b's old if_spppsubr.c (which
was based on PR misc/11767), plus (i4b) rev 1.6 of i4b's if_ispppsubr.c,
albeit with numerous stylistic and cosmetic changes.

PR:		misc/11767
Submitted by:	i4b, Joachim Kuebart
MFC after:	1 month
2001-12-27 16:49:31 +00:00
Joerg Wunsch
64dce2fedb Don't log RXJ+ protocol rejects unless we are in debug mode. (RXJ-
events are always logged.)  This stops sppp from spamming the syslog
files in case the remote peer is not configured to negotiate IPv6.
2001-12-26 22:36:59 +00:00
Joerg Wunsch
10f461e8cb Fix some pseudo-enumeration constants in the IPv6 implementation so
they are unique and thus actually usable as flagbits.  I wonder how
it even worked so far...

MFC after:	1 week
2001-12-26 22:35:10 +00:00
Joerg Wunsch
248f19ee7b Ignore (and silently conf-ack) conf-reqs for an Async-Control-
Character-Map.  RFC 1662 demands it for the sake of async to sync
PPP protocol converters (like Win9* :).

This merges rev 1.26/1.27 of the old i4b sppp changes.
2001-12-26 22:00:13 +00:00
Joerg Wunsch
572310c609 For SIOCSIFADDR, don't call if_up() since it would attempt to add the
route to the destination twice.  Now that brian has fixed route.c to no
longer accept this second route, this long-standing nuisance became a
showstopper bug for sppp users.

In retrospect, this is the same fix as the one in rev 1.78 of if_sl.c;
most likely the original version of sppp has been cloned from SLIP. ;-)
2001-12-26 20:28:41 +00:00
Brian Somers
e20e9426e1 It's no longer necessary to ensure that ``gate'' is set when RTF_GATEWAY
is passed, as subsequent code does that check now anyway.

Submitted by:	ru
2001-12-19 16:05:27 +00:00