Commit graph

198 commits

Author SHA1 Message Date
Sam Leffler 588523fae3 use ETHER_IS_MULTICAST instead of explicit check 2003-08-19 17:04:13 +00:00
Robert Watson 533d8562e4 Move the MAC entry point to label ethernet-sourced mbufs with a MAC label
from the network interface earlier in ether_input().  At some point
(no fingers pointed), things were restructured and the labeling operation
moved later.  This wasn't a problem as BPF_MTAP() relies on the ifnet
label not the mbuf label, but there might have been other problems.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-07-13 20:32:58 +00:00
David E. O'Brien 824eb9dc1b Back out rev 1.146 -- it broke the LINT build.
We are about to enter the 5.1 code freeze and things must be buildable.
2003-05-05 09:15:50 +00:00
Mark Murray 51da11a27a Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.
2003-04-30 12:57:40 +00:00
Archie Cobbs c1404dc060 Tweak to previous commit: increment ifp->if_iqdrops if the m_copy() fails.
Suggested by:	Neelkanth Natu <neelnatu@yahoo.com>
2003-04-23 23:45:57 +00:00
Archie Cobbs 79db6ff316 Fix a case where the return value from m_copy() was not being checked
for NULL before proceeding, causing a crash if mbufs were exhausted.

MFC after:	3 days
Reported by:	Mark Gooderum <mark@verniernetworks.com>
2003-04-23 18:35:40 +00:00
Matthew N. Dodd 868d8b6286 - Use if_broadcastaddr from struct ifnet rather than relying on
extern 'etherbroadcastaddr'.
- Make 'etherbroadcastaddr' static.

Reviewed by:	 imp
2003-03-21 17:53:16 +00:00
Matthew N. Dodd 06f684b004 Reduce code differences. 2003-03-15 19:37:44 +00:00
Matthew N. Dodd 40811c1473 Add module data and version. 2003-03-15 15:38:02 +00:00
Peter Wemm 3c6b084e96 Finish driving a stake through the heart of netns and the associated
ifdefs scattered around the place - its dead Jim!

The SMB stuff had stolen AF_NS, make it official.
2003-03-05 19:24:24 +00:00
Jonathan Lemon 1cafed3941 Update netisr handling; Each SWI now registers its queue, and all queue
drain routines are done by swi_net, which allows for better queue control
at some future point.  Packets may also be directly dispatched to a netisr
instead of queued, this may be of interest at some installations, but
currently defaults to off.

Reviewed by: hsu, silby, jayanth, sam
Sponsored by: DARPA, NAI Labs
2003-03-04 23:19:55 +00:00
Matthew N. Dodd 797f247b51 sizeof(struct llc) -> LLC_SNAPFRAMELEN
sizeof(struct ether_header) -> ETHER_HDR_LEN
 sizeof(struct fddi_header) -> FDDI_HDR_LEN
2003-03-03 05:04:57 +00:00
Matthew N. Dodd 098a8c3b64 De-register. 2003-03-03 00:21:52 +00:00
Matthew N. Dodd 7f760c4890 Reduce code duplication. This adds the function rt_check() to route.c.
Approved by:	 sam (in principle)
2003-03-02 21:34:37 +00:00
Warner Losh a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Sam Leffler 0bbd84e2d0 remove stray debugging printf
Noted by:	Kasper Steensgaard <steensgaard@person.dk>
2003-02-18 06:25:46 +00:00
Alfred Perlstein 44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Bosko Milekic 86fea6be59 o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and
the mbuf allocator flags {M_TRYWAIT, M_DONTWAIT}.
o Fix a bpf_compat issue where malloc() was defined to just call
  bpf_alloc() and pass the 'canwait' flag(s) along.  It's been changed
  to call bpf_alloc() but pass the corresponding M_TRYWAIT or M_DONTWAIT
  flag (and only one of those two).

Submitted by: Hiten Pandya <hiten@unixdaemons.com> (hiten->commit_count++)
2002-12-19 22:58:27 +00:00
Luigi Rizzo 97850a5dd9 Move fw_one_pass from ip_fw2.c to ip_input.c so that neither
bridge.c nor if_ethersubr.c depend on IPFIREWALL.
Restore the use of fw_one_pass in if_ethersubr.c

ipfw.8 will be updated with a separate commit.

Approved by: re
2002-11-20 19:07:27 +00:00
Sam Leffler c1d93b0588 o change input packet handling to eliminate the pointer to the struct
ether_header; instead drivers are to leave the Ethernet header at the
  front of the packet
o add declarations for netgraph and vlan hooks that were removed from ethernet.h
o change various in-file calling conventions to track change in input API
o fixup bridge support to handle Ethernet header no longer being stripped
o add consistency checks to ether_input to catch problems with the change
  in the API; some of these may want to be moved to #ifdef DIAGNOSTIC at a
  later time (though they are not too expensive to leave as is)
o change ether_demux to eliminate the passing of the Ethernet header; it is
  now expected at the front of the packet a la ether_input
o add ether_sprintf compatibility shim
o change ether_ifattach API to remove "bpf supported param" and add a pointer
  to the MAC address to be installed for the LL address (this is for future
  changes to divest struct arpcom from struct ifnet)
o change ether_ifdetach API to remove "bpf support param"

Reviewed by:	many
Approved by:	re
2002-11-14 23:35:06 +00:00
Brooks Davis 29e1b85f97 Use if_printf(ifp, "blah") instead of
printf("%s%d: blah", ifp->if_name, ifp->if_xname).
2002-10-21 02:51:56 +00:00
Poul-Henning Kamp c694310048 FIx misindentation.
Spotted by:	FlexeLint.
2002-10-16 09:00:53 +00:00
Crist J. Clark 232a880278 Unconditionally restore the pointer to the saved Ethernet header after
going to bridge.c:bdg_forward(). The header can be munged even if the
mbuf does not /appear/ to change.

PR:		kern/42465
MFC after:	4 days
2002-10-14 05:27:00 +00:00
Poul-Henning Kamp 8d3574c7a4 Fix some harmless mis-indents.
Spotted by:	FlexeLint
2002-10-01 15:48:31 +00:00
Poul-Henning Kamp 37c841831f Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by:    FlexeLint warning #512
2002-09-28 17:15:38 +00:00
Poul-Henning Kamp afbe3a0f81 Add the "Monitor" interface flag.
Setting this flag on an ethernet interface blocks transmission of packets
and discards incoming packets after BPF processing.

This is useful if you want to monitor network trafic but not interact
with the network in question.

Sponsored by:	http://www.babeltech.dk
2002-09-27 18:57:47 +00:00
Poul-Henning Kamp a6ddbff039 Be a bit more technical:
Technically junk may have low entropy.
2002-09-26 14:01:50 +00:00
Poul-Henning Kamp 2201e1b039 Optimize the way we call BPF a tiny bit: If we chop the ether-header off
ourselves, call bpf before we do so, rather than re-construct the entire
thing afterwards.

Sponsored:	http://www.babeltech.dk/
2002-09-18 19:50:48 +00:00
David E. O'Brien 5908354455 Fix the GENERIC build. Don't refer to the non-existant fw_one_pass. 2002-09-12 15:36:13 +00:00
Luigi Rizzo 015d72e0c9 Make bridging and layer2-ipfw obey net.inet.ip.fw.one_pass.
I should have committed this ages ago.

The MFC for if_ethersubr.c could be done in the usual few days (only
ipfw2 uses it), the one for bridge.c should probably wait until
after 4.7 because it changes an existing though mostly undocumented
behaviour (on which i hope nobody relies). All in all, i'll wait for
both things unless there is demand.

MFC after: 35 days
2002-09-12 01:05:46 +00:00
Maxim Sobolev 25faf49d12 Fix a silly typo in user-setable promisc mode code.
Pointed out by:	Yann Berthier <yb@sainte-barbe.org>
MFC after:	1 day
2002-08-30 13:37:13 +00:00
Maxim Sobolev ffb079be0c Implement user-setable promiscuous mode (a new `promisc' flag for ifconfig(8)).
Also, for all interfaces in this mode pass all ethernet frames to upper layer,
even those not addressed to our own MAC, which allows packets encapsulated
in those frames be processed with packet filters (ipfw(8) et al).

Emphatically requested by:	Anton Turygin <pa3op@ukr-link.net>
Valuable suggestions by:	fenner
2002-08-19 15:16:38 +00:00
Luigi Rizzo c939f1aee7 Extend the interface to ether_input(): a NULL eh pointer means that
the mbuf contains the ethernet header (eh) as well, which ether_input()
will strip off as needed.

This permits the removal (in a backward compatible way) of the
header removal code which right now is replicated in all drivers,
sometimes in an inconsistent way. Also, because many functions
called after ether_input() require the eh in the mbuf, eventually
we can propagate the interface and handle outdated drivers just
in ether_input().

Individual driver changes to use the new interface will follow as
we have a chance to touch them.

NOTE THAT THIS CHANGE IS FULLY BACKWARD COMPATIBLE AND DOES NOT BREAK
BINARY COMPATIBILITY FOR DRIVERS.

MFC after: 3 days
2002-08-04 23:55:06 +00:00
Robert Watson 43b2936963 Introduce support for Mandatory Access Control and extensible
kernel access control.

Label mbufs received via ethernet-based interfaces by invoking
appropriate MAC framework entry points.

Perform access control checks on out-going mbufs delivered via
ethernet-based interfaces by invoking appropriate MAC entry
points.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-07-31 16:22:02 +00:00
Luigi Rizzo 9961e27d73 Remove one useless variable. 2002-06-30 08:02:38 +00:00
Luigi Rizzo 2f8ebbf49f fix indentation, whitespace and a few comments. 2002-06-23 11:19:53 +00:00
Luigi Rizzo 2b25acc158 Remove (almost all) global variables that were used to hold
packet forwarding state ("annotations") during ip processing.
The code is considerably cleaner now.

The variables removed by this change are:

        ip_divert_cookie        used by divert sockets
        ip_fw_fwd_addr          used for transparent ip redirection
        last_pkt                used by dynamic pipes in dummynet

Removal of the first two has been done by carrying the annotations
into volatile structs prepended to the mbuf chains, and adding
appropriate code to add/remove annotations in the routines which
make use of them, i.e. ip_input(), ip_output(), tcp_input(),
bdg_forward(), ether_demux(), ether_output_frame(), div_output().

On passing, remove a bug in divert handling of fragmented packet.
Now it is the fragment at offset 0 which sets the divert status of
the whole packet, whereas formerly it was the last incoming fragment
to decide.

Removal of last_pkt required a change in the interface of ip_fw_chk()
and dummynet_io(). On passing, use the same mechanism for dummynet
annotations and for divert/forward annotations.

option IPFIREWALL_FORWARD is effectively useless, the code to
implement it is very small and is now in by default to avoid the
obfuscation of conditionally compiled code.

NOTES:
 * there is at least one global variable left, sro_fwd, in ip_output().
   I am not sure if/how this can be removed.

 * I have deliberately avoided gratuitous style changes in this commit
   to avoid cluttering the diffs. Minor stule cleanup will likely be
   necessary

 * this commit only focused on the IP layer. I am sure there is a
   number of global variables used in the TCP and maybe UDP stack.

 * despite the number of files touched, there are absolutely no API's
   or data structures changed by this commit (except the interfaces of
   ip_fw_chk() and dummynet_io(), which are internal anyways), so
   an MFC is quite safe and unintrusive (and desirable, given the
   improved readability of the code).

MFC after: 10 days
2002-06-22 11:51:02 +00:00
Luigi Rizzo 4b9840932d Add ipfw hooks to ether_demux() and ether_output_frame().
Ipfw processing of frames at layer 2 can be enabled by the sysctl variable

	net.link.ether.ipfw=1

Consider this feature experimental, because right now, the firewall
is invoked in the places indicated below, and controlled by the
sysctl variables listed on the right.  As a consequence, a packet
can be filtered from 1 to 4 times depending on the path it follows,
which might make a ruleset a bit hard to follow.

I will add an ipfw option to tell if we want a given rule to apply
to ether_demux() and ether_output_frame(), but we have run out of
flags in the struct ip_fw so i need to think a bit on how to implement
this.

		to upper layers
	     |			     |
	     +----------->-----------+
	     ^			     V
	[ip_input]		[ip_output]	net.inet.ip.fw.enable=1
	     |			     |
	     ^			     V
	[ether_demux]      [ether_output_frame]	net.link.ether.ipfw=1
	     |			     |
	     +->- [bdg_forward]-->---+		net.link.ether.bridge_ipfw=1
	     ^			     V
	     |			     |
		 to devices
2002-05-13 10:37:19 +00:00
Luigi Rizzo 7d3e4c6e71 Fix a couple of incorrect m_free() vs. m_freem() usages and related issues.
Reviewed-by: brooks
2002-04-04 05:42:09 +00:00
Bruce Evans 34fe62c776 Fixed some style bugs in the removal of __P(()). The main ones were
not removing tabs before "__P((", and not outdenting continuation lines
to preserve non-KNF lining up of code with parentheses.  Switch to KNF
formatting and/or rewrap the whole prototype in some cases.
2002-03-24 09:34:04 +00:00
Alfred Perlstein 929ddbbb89 Remove __P. 2002-03-19 21:54:18 +00:00
Luigi Rizzo cad15830dc Remove useless initialization to 0 of a couple of global variables. 2002-02-15 04:57:18 +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
Jonathan Lemon 64b15424e4 minor style fix. 2001-12-14 19:28:06 +00:00
David Greenman 05463bb58d Moved the updating of if_ibytes from ether_demux() to ether_input() to fix
a bug where the interface input bytes count wasn't updated when bridging
is enabled.

MFC after:	3 days
2001-12-14 04:41:07 +00:00
David E. O'Brien 6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
Brooks Davis 437e48e931 Don't pass an interface pointer to VLAN_INPUT{,_TAG}. Get it from the
mbuf instead.

Suggested by:	fenner
2001-12-03 17:28:27 +00:00
Luigi Rizzo 7b109fa404 MFS: sync the ipfw/dummynet/bridge code with the one recently merged
into stable (mostly , but not only, formatting and comments changes).
2001-11-04 22:56:25 +00:00
Max Khon 322dcb8d3d bring in ARP support for variable length link level addresses
Reviewed by:	jdp
Approved by:	jdp
Obtained from:	NetBSD
MFC after:	6 weeks
2001-10-14 20:17:53 +00:00
Jonathan Lemon cfeff1b693 Set if_type and if_addrlen before calling if_attach(), so the values are
available for the routine to use.
2001-10-11 05:37:59 +00:00
Paul Saab db69a05dce Make it so dummynet and bridge can be loaded as modules.
Submitted by:	billf
2001-10-05 05:45:27 +00:00
Peter Wemm 8cdfefbd0c Remove/comment tokens after #endif (#endif NETATALK) 2001-09-10 01:33:03 +00:00
Jonathan Lemon f9132cebdc Wrap array accesses in macros, which also happen to be lvalues:
ifnet_addrs[i - 1]  -> ifaddr_byindex(i)
        ifindex2ifnet[i]    -> ifnet_byindex(i)

This is intended to ease the conversion to SMPng.
2001-09-06 02:40:43 +00:00
Brooks Davis 9d4fe4b2b0 Make vlan(4) loadable, unloadable, and clonable. As a side effect,
interfaces must now always enable VLAN support.

Reviewed by:	jlemon
MFC after:	3 weeks
2001-09-05 21:10:28 +00:00
Jonathan Lemon 08aadfbb98 Do not perform arp send/resolve on an interface marked NOARP.
PR: 25006
MFC after: 2 weeks
2001-06-15 21:00:32 +00:00
Bill Fenner 26e3096360 Get IP multicast working on VLAN devices:
- Allocate zeroed memory in ether_resolvemulti() to prevent equal() from
  comparing garbage and determining that two otherwise-equal sockaddr_dls
  are different.
- Fill in all required fields of the sockaddr_dl
- Actually copy the multicast address into the sockaddr_dl when calling
  if_addmulti()
- Don't claim that we don't have a way to resolve layer 3 addresses into
  layer 2 addresses; use the ethernet way.
2001-05-02 16:12:58 +00:00
Bosko Milekic fef5fd2315 Plug several mbuf leaks in error cases (in nd6)
Submitted by: jhay
2001-03-11 05:31:45 +00:00
Mark Murray 10b1fde07f Insert entropy harvesting calls for network traffic. By
default, no entropy will be harvested.
2001-02-18 17:54:52 +00:00
Luigi Rizzo 7e1cd0d23d Sync with the bridge/dummynet/ipfw code already tested in stable.
In ip_fw.[ch] change a couple of variable and field names to
avoid having types, variables and fields with the same name.
2001-02-10 00:10:18 +00:00
Archie Cobbs cb24f323d0 When we receive an incoming Ethernet frame that was unicast to a
different hardware address, we should drop it (this should only
happen in promiscuous mode). Relocate the code for this check
from before ng_ether(4) processing to after ng_ether(4) processing.
Also fix a compiler warning.

PR:		kern/24465
2001-02-08 17:56:49 +00:00
Luigi Rizzo 507b4b5432 MFS: bridge/ipfw/dummynet fixes (bridge.c will be committed separately) 2001-02-02 00:18:00 +00:00
Luigi Rizzo 02a282ac01 Comment the interface to ether_input() and the way is normally
used by most ethernet drivers.
2001-01-25 23:56:13 +00:00
Bosko Milekic 2a0c503e7a * Rename M_WAIT mbuf subsystem flag to M_TRYWAIT.
This is because calls with M_WAIT (now M_TRYWAIT) may not wait
  forever when nothing is available for allocation, and may end up
  returning NULL. Hopefully we now communicate more of the right thing
  to developers and make it very clear that it's necessary to check whether
  calls with M_(TRY)WAIT also resulted in a failed allocation.
  M_TRYWAIT basically means "try harder, block if necessary, but don't
  necessarily wait forever." The time spent blocking is tunable with
  the kern.ipc.mbuf_wait sysctl.
  M_WAIT is now deprecated but still defined for the next little while.

* Fix a typo in a comment in mbuf.h

* Fix some code that was actually passing the mbuf subsystem's M_WAIT to
  malloc(). Made it pass M_WAITOK instead. If we were ever to redefine the
  value of the M_WAIT flag, this could have became a big problem.
2000-12-21 21:44:31 +00:00
Jonathan Lemon 4851f97cf1 Remove unused variable, spl() manipulation isn't done for the ifq now. 2000-11-25 07:50:27 +00:00
Jonathan Lemon df5e198723 Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue.  Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.

IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue.  An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.

Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.
2000-11-25 07:35:38 +00:00
Boris Popov 2a7e8ece75 Properly setup link level header length for 802.2 and SNAP frames. 2000-09-30 14:33:53 +00:00
Bosko Milekic ddacb30f2d Get rid of a panic that occurs in ether_demux() by dereferencing a NULL mbuf
pointer, when bridging and bridge_ipfw are enabled, and when bdg_forward()
happens to free the packet and make our pointer NULL. There may be
more similar problems like this one with calls to bdg_forward().

PR: Related to kern/19551
Reviewed by: jlemon
2000-09-24 04:08:38 +00:00
Nick Sayer 82902fa3d8 Make the bridge_refresh operation automatic when ethernet interfaces
are attached or detached.
2000-07-29 02:00:12 +00:00
Archie Cobbs 21b8ebd926 Make all Ethernet drivers attach using ether_ifattach() and detach using
ether_ifdetach().

The former consolidates the operations of if_attach(), ng_ether_attach(),
and bpfattach(). The latter consolidates the corresponding detach operations.

Reviewed by:	julian, freebsd-net
2000-07-13 22:54:34 +00:00
Jun-ichiro itojun Hagino 595b8a1cdd repair IPV6_JOIN_GROUP to IPv6 all multi.
From: ume
2000-07-09 11:17:17 +00:00
Jun-ichiro itojun Hagino 686cdd19b1 sync with kame tree as of july00. tons of bug fixes/improvements.
API changes:
- additional IPv6 ioctls
- IPsec PF_KEY API was changed, it is mandatory to upgrade setkey(8).
  (also syntax change)
2000-07-04 16:35:15 +00:00
Archie Cobbs 6ec86086e7 Fix kernel build breakage when 'device ether' was not included. 2000-06-29 19:14:28 +00:00
Archie Cobbs e1e1452d61 Make the ng_ether(4) node type dynamically loadable like the rest.
This means 'options NETGRAPH' is no longer necessary in order to get
netgraph-enabled Ethernet interfaces. This supports loading/unloading
the ng_ether.ko and attaching/detaching the Ethernet interface in any
order.

Add two new hooks 'upper' and 'lower' to allow access to the protocol
demux engine and the raw device, respectively. This enables bridging
to be defined as a netgraph node, if so desired.

Reviewed by:	freebsd-net@freebsd.org
2000-06-26 23:34:54 +00:00
Boris Popov 425f741b1d Do not perform any opeartion with mbuf after it placed into
interface queue.

Tested by:	Bosko Milekic <bmilekic@dsuper.net>
2000-06-14 05:56:53 +00:00
Archie Cobbs 06a429a3c8 Just need to pass the address family to if_simloop(), not the whole sockaddr. 2000-05-24 21:16:56 +00:00
Archie Cobbs 2e2de7f23f Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by:	freebsd-net
2000-05-14 02:18:43 +00:00
Julian Elischer 0beebe3a2e OOps forgot to check in this one...
API chage for netgraph.
2000-04-28 17:43:04 +00:00
Boris Popov 5accfb8c14 Fix support for 802.2 and SNAP frames. Bug was introduced during
initial import.

Tested by:	Jorge P Vasquez <jorge@acron.ind.br>
2000-04-27 10:13:52 +00:00
Peter Wemm 242c5536ea Clean up some loose ends in the network code, including the X.25 and ISO
#ifdefs.  Clean out unused netisr's and leftover netisr linker set gunk.
Tested on x86 and alpha, including world.

Approved by:	jkh
2000-02-13 03:32:07 +00:00
Brian Feldman d25f3712b7 M_PREPEND-related cleanups (unregisterifying struct mbuf *s). 1999-12-19 01:55:37 +00:00
Boris Popov 4f93599fba Bring up an if_ef driver which allows support for four ethernet
frame types. Currently it supports only IPX protocol and doesn't
affect existing functionality when not loaded.

Reviewed by:	Ollivier Robert <roberto@keltia.freenix.fr>
1999-12-13 16:24:22 +00:00
Yoshinobu Inoue cfa1ca9dfa udp IPv6 support, IPv6/IPv4 tunneling support in kernel,
packet divert at kernel for IPv6/IPv4 translater daemon

This includes queue related patch submitted by jburkhol@home.com.

Submitted by: queue related patch from jburkhol@home.com
Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-07 17:39:16 +00:00
Archie Cobbs f8307e1233 Add two new generic control messages, NGM_ASCII2BINARY and
NGM_BINARY2ASCII, which convert control messages to ASCII and back.
This allows control messages to be sent and received in ASCII form
using ngctl(8), which makes ngctl a lot more useful.

This also allows all the type-specific debugging code in libnetgraph
to go away -- instead, we just ask the node itself to do the ASCII
translation for us.

Currently, all generic control messages are supported, as well as
messages associated with the following node types: async, cisco,
ksocket, and ppp.

See /usr/share/examples/netgraph/ngctl for an example of using this.

Also give ngctl(8) the ability to print out incoming data and
control messages at any time.  Eventually nghook(8) may be subsumed.

Several other misc. bug fixes.

Reviewed by:	julian
1999-11-30 02:45:32 +00:00
Yoshinobu Inoue 82cd038d51 KAME netinet6 basic part(no IPsec,no V6 Multicast Forwarding, no UDP/TCP
for IPv6 yet)

With this patch, you can assigne IPv6 addr automatically, and can reply to
IPv6 ping.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-11-22 02:45:11 +00:00
Julian Elischer ecf33d87b2 YUCK!
m_prepend doesn't fix m_pkthdr.len, use M_PREPEND instead, which does..
(Netgraph only)
1999-11-15 03:49:35 +00:00
Julian Elischer 2b75f79579 Fix screwup on synthesising incoming ethernet header in Netgraph mode.
Submitted by: brian@freebsd.org
1999-11-14 10:16:40 +00:00
Julian Elischer e03b02a346 Oops forgot to put the source MAC address on outgoing packets! 1999-11-11 22:23:58 +00:00
Julian Elischer ae5a83bcb5 Use typedefs for node methods. 1999-11-01 10:18:36 +00:00
Julian Elischer 021823c35c Minor hack in the netgraph interface to ethernets. 1999-10-26 11:40:23 +00:00
Julian Elischer 4cf49a4355 Whistle's Netgraph link-layer (sometimes more) networking infrastructure.
Been in production for 3 years now. Gives Instant Frame relay to if_sr
and if_ar drivers, and PPPOE support soon. See:
ftp://ftp.whistle.com/pub/archie/netgraph/index.html
for on-line manual pages.

Reviewed by: Doug Rabson (dfr@freebsd.org)
Obtained from:  Whistle CVS tree
1999-10-21 09:06:11 +00:00
Mike Smith 114ae644b5 Implement pseudo_AF_HDRCMPLT, which controls the state of the 'header
completion' flag.  If set, the interface output routine will assume that
the packet already has a valid link-level source address.  This defaults
to off (the address is overwritten)

PR:		kern/10680
Submitted by:	"Christopher N . Harrell" <cnh@mindspring.net>
Obtained from:	NetBSD
1999-10-15 05:07:00 +00:00
Peter Wemm c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Doug Rabson ce02431ffa * Change sysctl from using linker_set to construct its tree using SLISTs.
This makes it possible to change the sysctl tree at runtime.

* Change KLD to find and register any sysctl nodes contained in the loaded
  file and to unregister them when the file is unloaded.

Reviewed by: Archie Cobbs <archie@whistle.com>,
	Peter Wemm <peter@netplex.com.au> (well they looked at it anyway)
1999-02-16 10:49:55 +00:00
Julian Elischer 4c8e8c05fd Slight cleanups. There were 2 ways of getting the arpcom from the ifp.
Both equally bogus. Make it a macro so that we can pretend it's not
bogus and maybe make it less so some time in the future.
1999-01-31 08:17:16 +00:00
Eivind Eklund 1db59ce607 Remove unused variable & clean up a couple of style issues. 1999-01-12 12:07:00 +00:00
Luigi Rizzo fb5fbe465a Bridging support. Wait for LINT to be updated before trying it. 1998-12-14 17:58:05 +00:00
Julian Elischer 84dd0fd0bb fix broken loopback code for ddp (again)
Submitted by: Stefan Bethke <stb@hanse.de>
1998-08-04 23:17:05 +00:00
Julian Elischer 201c2527a9 Try narrow down the culprit sending undefined packet types through the loopback 1998-06-14 20:58:17 +00:00
Julian Elischer 9d3f194df3 Allow a protocol to specify that it does NOT want to be looped back
even if it looks like it should (backwards compatibility with
old broken code) should get rid of some annoying messags.
1998-06-13 02:27:10 +00:00
Julian Elischer ed7509ace4 Go through the loopback code with a broom..
Remove lots'o'hacks.
looutput is now static.

Other callers who want to use loopback to allow shortcutting
should call the special entrypoint for this, if_simloop(), which is
specifically designed for this purpose. Using looutput for this purpose
was problematic, particularly with bpf and trying to keep track
of whether one should be using the charateristics of the loopback interface
or the interface (e.g. if_ethersubr.c) that was requesting the loopback.
There was a whole class of errors due to this mis-use each of which had
hacks to cover them up.

Consists largly of hack removal :-)
1998-06-12 03:48:19 +00:00