Commit Graph

53 Commits

Author SHA1 Message Date
martin
71d020f371 Since we decided "const struct mbuf *" would not do the right thing (tm),
remove ~all const from mbuf pointers.
2005-06-06 06:06:50 +00:00
tron
41dcb3a310 Remove type casts and lint directives which are now longer necessary
because the first argument of m_copydata() is "const struct mbuf *" now.
2005-06-02 10:54:58 +00:00
christos
333e176687 - sprinkle const
- remove unneeded casts
- use more mem*() instead of b*() funcs.
2005-05-29 21:22:52 +00:00
christos
48aa099255 PR/30285: Mile Nordin: incorrect permission check joining/leaving multicast
groups.
2005-05-20 16:23:05 +00:00
perry
f07677dd81 nuke trailing whitespace 2005-02-26 22:45:09 +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
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
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
itojun
d2f1c029b9 kill sprintf, use snprintf 2004-04-21 18:40:37 +00:00
mycroft
a071a627d4 Return a sensible error code in the previous. 2003-10-28 20:13:23 +00:00
christos
125ccd91b1 Fix uninitialized variable warnings 2003-10-25 18:29:12 +00:00
itojun
c8a8326600 make USE_ENCAPCHECK (in netinet*/*gif.c) to global option, GIF_ENCAPCHECK.
#ifdef out unneeded code when possible.
From: Krister Walfridsson <cato@df.lth.se>
2002-11-11 18:35:27 +00:00
itojun
00f97b0202 drop too short IPv6 frame 2002-06-13 05:10:34 +00:00
christos
5c8e181780 We are not guaranteed that we have enough bytes to get a struct ip from our
mbuf. So if we receive a short packet, that looks like gif we would panic.
Reviewed by thorpej, tested by Kimmo Suominen and Andreas Wrede. Thanks for
the help in tracking this down.
2002-03-26 16:05:03 +00:00
itojun
ac36f7cb2c bring in latest ALTQ from kjc. ALTQify some of the drivers. 2002-03-05 04:12:57 +00:00
kleink
67dfac7357 Include <machine/intr.h> unconditionally, instead of only doing so if
__HAVE_GENERIC_SOFT_INTERRUPTS and relying on <sys/param.h> to provide it
otherwise; pointed out by Aymeric Vincent.
2002-01-14 18:19:15 +00:00
lukem
64a432d965 remove unnecessary #if NFOO > 0 .... #endif wrappers 2001-11-13 00:49:35 +00:00
lukem
34d65a3414 add RCSIDs 2001-11-12 23:49:33 +00:00
itojun
6374da40e1 don't softintr_disestablish twice.
previous code panic'ed with the following command sequence:
# ifconfig gif0 create tunnel A B
# ifconfig gif0 deletetunnel
# ifconfig gif0 destroy
2001-09-26 07:54:19 +00:00
itojun
e556ec903d fix ALTQ support. less diff with kame. kjc@csl.sony.co.jp. 2001-08-20 02:18:58 +00:00
itojun
74ad87bc53 gif interface now uses generic software interrupt
(on archs that support it).  also, make gif ALTQ-capable on outgoing.
sync with kame, comments from thorpej.
2001-08-16 17:45:25 +00:00
itojun
39bc63e6b3 raise IFF_UP on SIOCSIFADDR. commented by tv@netbsd, sync with kame 2001-07-30 11:12:58 +00:00
itojun
cad488d032 sync gif interface code with latest kame.
IFF_RUNNING is clearified.  attach/detach logic is more clearner.
the old code mistakenly set IFF_UP by itself, now the behavior is gone.
2001-07-29 05:08:32 +00:00
thorpej
cbf41a143a bzero -> memset 2001-07-18 16:43:09 +00:00
itojun
4d51fe368b change the meaning of ifnet.if_lastchange to meet RFC1573 ifLastChange.
follows BSD/OS practice and ucd-snmp code (FreeBSD does it for specific
interfaces only).

was: if_lastchange get updated on every packet transmission/receipt.
now: if_lastchange get updated when IFF_UP is changed.
2001-06-14 05:44:23 +00:00
itojun
034ca147cb if_up() requires splsoftnet. sync with kame 2001-06-04 23:53:13 +00:00
thorpej
bf2dcec4f5 Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
2001-04-13 23:29:55 +00:00
itojun
45e2b8d54b remove necessary global variable for eon processing. from chopps,
sync with kame
2001-02-21 00:17:09 +00:00
itojun
1e48b7fbb5 add SIOC[SG]LIFPHYADDR ioctl. greatly simplify tunnel address settings.
sync with kame.  old ioctls are supplied but not recommended for new code.
2001-02-20 15:35:19 +00:00
itojun
9968ae668d comment on dispatches (clearify inner/outer) 2001-02-20 08:48:27 +00:00
itojun
56ad92fd11 use u_int32_t, not u_int, for DLT_NULL encapsulation. 2001-02-20 08:33:02 +00:00
itojun
ffc12ee678 explicitly use u_int32_t for DLT_NULL encapsulation.
correct gif address family.  from chopps, sync with kame.
2001-02-20 07:58:16 +00:00
itojun
cda5e3eb96 cosmetic; do not use register variable declaration. sync with kame 2001-02-20 07:53:31 +00:00
thorpej
fc5dafc79b Fix a rather annoying problem where the sockaddr_dl which holds
the link level name for the interface (ifp->if_sadl) is allocated
before ifp->if_addrlen is initialized, which could lead to allocating
too little space for the link level address.

Do this by splitting allocation of the link level name out of
if_attach() and into if_alloc_sadl(), which is normally called
by functions like ether_ifattach().  Network interfaces which
don't have a link-specific attach routine must call if_alloc_sadl()
themselves (example: gif).

Link level names are freed by if_free_sadl(), which can be called
from e.g. ether_ifdetach().  Drivers never need call if_free_sadl()
themselves as if_detach() will do it if it is not already done.

While here, add the ability to pass an AF_LINK address to
SIOCSIFADDR in ether_ioctl() (this is what caused me to notice
the problem that the above fixes).
2001-01-17 00:30:49 +00:00
thorpej
ed7695a765 Fill in if_dlt. 2000-12-18 19:44:33 +00:00
thorpej
c5293456da Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.
2000-12-12 18:00:22 +00:00
martin
4a0283d9f0 Allow changing of settings via ioctl only for the superuser.
Fixes PR security/11524.
2000-11-19 18:48:44 +00:00
itojun
08af3d2f82 validate args to SIOC[SG]IFPHY* better. 2000-10-07 04:18:04 +00:00
itojun
dcfe05e7c1 fix compilation without INET. fix confusion between ipsecstat and ipsec6stat.
sync with kame.
2000-10-02 03:55:41 +00:00
itojun
29251eb71f remove #ifdef __FreeBSD__ or __bsdi__, as netbsd if_gif.c diverged a little
from kame tree
2000-07-06 12:56:26 +00:00
thorpej
f7e579e2f7 Fix a memory leak in the gif_clone_create() error path. 2000-07-05 16:54:19 +00:00
thorpej
b36ce94c6b Convert `gif' to be a cloning interface. 2000-07-02 00:21:42 +00:00
itojun
948e11b707 allow IPv[46]-over-IPv6 setting properly. sync with kame. 2000-06-20 15:59:35 +00:00
itojun
4631e5d720 improve duplicated 'gifconfig" check (fatal typo was there). sync with kame. 2000-05-17 01:14:04 +00:00
itojun
3909133548 introduce sys/netinet/ip_encap.c, to dispatch inbound packets
to protocol handlers, based on src/dst (for ip proto #4/41).
see comment in ip_encap.c for details of the problem we have.
there are too many protocol specs for ip proto #4/41.
backward compatibility with MROUTING case is now provided in ip_encap.c.

fix ipip to work with gif (using ip_encap.c).  sorry for breakage.

gif now uses ip_encap.c.

introduce stf pseudo interface (implements 6to4, another IPv6-over-IPv4 code
with ip proto #41).
2000-04-19 06:30:51 +00:00
augustss
c1ebd1929a Kill some more register declarations. 2000-03-30 09:45:33 +00:00
itojun
3867d18179 we don't need IFF_RUNNING for gif. 2000-01-17 06:29:07 +00:00
itojun
2042e749ad for gif interface, sync IFF_RUNNING with IFF_UP. it does not
make sense to leave IFF_RUNNING during !IFF_UP (it is pseudo interface
so we need to immitate - or is it okay if we don't raise IFF_RUNNING?)
2000-01-17 05:50:12 +00:00
itojun
b3761abef8 remove extra portability #ifdef (like #ifdef __FreeBSD__) in KAME IPv6/IPsec
code, from netbsd-current repository.
#ifdef'ed version is always available from ftp.kame.net.

XXX please do not make too many diff-unfriendly changes, we'll need to take
bunch of diffs on upgrade...
2000-01-06 15:46:07 +00:00