Commit Graph

2269 Commits

Author SHA1 Message Date
rmind 2be35e5206 Silence gcc in npf_recache(). 2012-12-24 23:11:25 +00:00
rmind 352f160615 - Rework NPF's nbuf interface: use advancing and ensuring as a main method.
Eliminate unnecessary copy and simplify.  Adapt regression tests.
- Simplify ICMP ALG a little.  While here, handle ICMP ECHO for traceroute.
- Minor fixes, misc cleanup.
2012-12-24 19:05:42 +00:00
rmind 57ff5416fd - Add NPF version check in proplist as well, not only ioctl. Bump the version.
- Fix a bug in table entry lookup.
- Updates/fixes to the man pages.  Misc.
2012-12-23 21:01:03 +00:00
rmind f9e6e88c89 npf_rwrcksum: handle delayed checksums in the network stack; also fix
non-NPF_NAT_PORTS case and add some comments.  PR/47235.
2012-12-10 01:11:13 +00:00
rmind 333cdb0c5a Add NPF "rndblock" extension to randomly drop packets (using a random function
with a percentage or modulo operation).  This is a demo module, although it can
be used for packet loss simulation.  Example of a procedure in npf.conf:

procedure "somedrop" {
	# Drop 1.9% of the traffic
	rndblock: percentage 1.9
}
2012-12-10 00:32:23 +00:00
rmind af7272417a npf_table_list: avoid triggering assert on diagnostic. 2012-12-04 19:28:16 +00:00
mbalmer 9d9e15ed7b Don't check mp for NULL twice. From Michael W. Bomardieri <mb@il.net>
via tech-net@NetBSD.org.  Thanks!
2012-11-25 09:06:43 +00:00
alnsn 85151d38ab Add RCSID and fix -Wsign-compare warnings. 2012-11-10 22:12:31 +00:00
msaitoh c9d920062c Fix a bug that SIOCZIFDATA clears if_lastchage by zero.
Update if_lastchange with getnanotime().
2012-11-01 06:36:30 +00:00
msaitoh bbc956a9be Add SIOCGETHERCAP ioctl.
There was no way to know the setting of ec_capabilities and ec_capenable
other than grepping the source.

See http://mail-index.netbsd.org/tech-kern/2010/07/28/msg008613.html
2012-10-31 10:17:34 +00:00
rmind 64647e51e4 Implement NPF table listing and preservation of entries on reload.
Bump the version.
2012-10-29 02:27:11 +00:00
alnsn 87a1a6c0f7 Comment bd_jitcode member. 2012-10-28 21:12:44 +00:00
alnsn e8c0d6c662 Add bpfjit and enable it for amd64. 2012-10-27 22:36:11 +00:00
chs cbab9cadce split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
2012-10-27 17:17:22 +00:00
msaitoh a9ceb4700c Move the prototype definition of ether_input() from if.h to if_ether.h. 2012-10-25 11:53:14 +00:00
msaitoh 11dd166429 Add 1000baseT-FDX. 2012-10-25 10:59:43 +00:00
christos 202952fb98 PR/47058: Antti Kantee: If the ipv6 flow code modifies the mbuf, pass the
change up to the caller.
2012-10-11 20:05:50 +00:00
rmind f5f72a013e npf_tcp_inwindow: inspect the sequence numbers even if the packet contains no
data, fixing up only the RST to the initial SYN.  This makes off-path attacks
more difficult.  For the reference, see "Reflection Scan: an Off-Path Attack
on TCP" by Jan Wrobel.
2012-10-06 23:50:17 +00:00
rmind 1fb2724b4f npf_packet_handler: drop the packet if IPv6 reassembly did not work. 2012-10-06 23:38:20 +00:00
matt d4732165f0 When setting a link address, don't bring up the interface automatically. 2012-10-05 04:26:06 +00:00
mlelstv b7abe5ff3b ext_ops does not change during the life cycle and can be fetched without
the mutex held. This avoids confusion in the compiler about an uninitialized
variable ext_ops.
ok rmind@
2012-10-03 12:24:56 +00:00
dholland 7bb3c82fdb Requires <net/if.h> to be compilable by itself. 2012-09-30 05:08:08 +00:00
dholland 42222eb321 u_long -> unsigned long, so this header compiles on its own like it
should. (and without adding <sys/types.h>)
2012-09-30 05:02:08 +00:00
alnsn 5c5a76d566 Remove bpf_jit which was ported from FreeBSD recently.
It will soon be replaced with the new bpfjit kernel module.
2012-09-27 18:28:53 +00:00
msaitoh c23ac4227f Add missing "\n" in log(9) 2012-09-24 03:05:53 +00:00
chs d041230792 add entries for AOE and FCOE. 2012-09-23 01:14:19 +00:00
rmind 8c6e21bf5e Implement dynamic NPF extensions interface. An extension consists of
dynamically loaded module (.so) supplementing npfctl(8) and a kernel
module.  Move normalisation and logging functionality into their own
extensions.  More improvements to come.
2012-09-16 13:47:41 +00:00
rmind 0c665aa87f npf_icmp_uniqid: split into npf_icmp_uniqid4() and npf_icmp_uniqid6() parts. 2012-09-16 13:44:14 +00:00
joerg 3a9c89f51f Mark npf_session_worker as __dead. 2012-09-13 21:09:36 +00:00
rmind bea61aedea npf_icmp_uniqid: inspect the correct npc_info for IPv4/v6. 2012-09-10 21:42:53 +00:00
drochner 0065310310 the address expire counter is just a time difference; it can turn
negative after the timer expired until the entry is deleted.
make it signed, so that we don't get output like
"00:1b:78:12:50:46 wm0 18446744073709551349 flags=0<>"
2012-08-23 12:06:32 +00:00
alnsn 1969739699 MINDEX() macro has 'return 0;' statement. It doesn't set *err to
1 before return when invoked from m_xword() and m_xhalf() functions.
The caller doesn't set it to 1 either. So, set *err to 1 before
invoking MINDEX().
2012-08-15 21:31:39 +00:00
alnsn 55f9a36d99 Fix two bugs introduced by recent commit.
- When handling contiguous buffer in _bpf_tap(), pass its real size
   rather than 0 to avoid reading packet data as mbuf struct on
   out-of-bounds loads.
 - Correctly pass pktlen and buflen arguments from bpf_deliver() to
   bpf_filter() to avoid reading mbuf struct as packet data.
   JIT case is still broken.

Also, test pointers againts NULL.
2012-08-15 20:59:51 +00:00
rmind e0cfa502eb Add npf_state_setsampler() for _NPF_TESTING case. This also fixes the build. 2012-08-15 19:47:38 +00:00
rmind 49540518f9 - {npf_mk_rproc,npf_nat_save}: fix the fetching of {rproc-ptr,id_ptr}.
- npf_rproc_setlog: initialise variables to 0, as keys may not exist.

Bugs found by mlelstv@ while testing on Amiga.
2012-08-15 18:44:56 +00:00
rmind 63f44833ba - Extend npftest: add ruleset inspection testing from the config generated
by npfctl debug functionality.  Auto-create npftest interfaces for this.
- NPF sessions: combine protocol and interface into a separate substructure,
  share between the entries and thus fix the handling of them.  Constify.
- npftest: add regression tests for NAT policies.
- npf_build_nat: simplify and fix bi-NAT regression.
- Bump yacc stack size for npfctl.
2012-08-12 03:35:13 +00:00
wiz 9d59cb3dc9 Avoid ambiguity by having only one comment close mark.
PR 46771 by bsiegert.
2012-08-05 21:21:41 +00:00
rmind c6beecf3ad bpf_filter: remove unnecessary memset(), add a comment. 2012-08-02 20:13:24 +00:00
matt cfc228abff Export <net/bpf_jit.h> and add to the set lists. 2012-08-02 01:16:36 +00:00
rmind 41d7966e90 Add struct bpf_insn tag. 2012-08-02 01:05:05 +00:00
rmind 24e587649b Build fix for some ports. 2012-08-02 00:40:51 +00:00
rmind 1f86dc56b4 Add BPF JIT compiler, currently supporting amd64 and i386. Code obtained
from FreeBSD.  Also, make few BPF fixes and simplifications while here.
Note that bpf_jit_enable is false for now.

OK dyoung@, some feedback from matt@
2012-08-01 23:24:28 +00:00
matt b1afbb311c Fix -fno-common found by building i386/conf/ALL 2012-07-28 00:43:22 +00:00
rmind 4ad5029440 - npf_fetch_tcpopts: fix off-by-one when validating TCP option length
against the maximum allowed.
- npf_tcp_inwindow: be more liberal with npf_fetch_tcpopts().
- Few minor improvements to npftest.
2012-07-21 17:11:01 +00:00
spz 7cf84a83d6 teach npf ipv6-icmp
reviewed by rmind@
2012-07-19 21:52:29 +00:00
christos 6f0b8235fe PR/46587: Roger Pau Monne: Prevent panic on shutdown on bridge teardown ->
ifpromisc-> if_ioctl -> if_init. Idea from dyoung.
XXX: Pullup to 6.
2012-07-17 18:08:20 +00:00
rmind a3b239f6f3 - Rework NPF tables and fix support for IPv6. Implement tree table type
using radix / Patricia tree.  Universal IPv4/IPv6 comparator for ptree(3)
  was contributed by Matt Thomas.
- NPF tables: update regression tests, improve npfctl(8) error messages.
- Fix few bugs when using kernel modules and handle module autounloader.
- Few other fixes and misc cleanups.
- Bump the version.
2012-07-15 00:22:58 +00:00
rmind 26e7cf9436 npf_packet_handler: fix gcc unused warning. 2012-07-02 06:55:58 +00:00
rmind 33b678d7e0 NPF improvements:
- Add NPF_OPCODE_PROTO to match the address and/or protocol only.
- Update parser to support arbitrary "pass proto <name/number>".
- Fix IPv6 address and protocol handling (add a regression test).
- Fix few theorethical races in session handling module.
- Misc fixes, simplifications and some clean up.
2012-07-01 23:21:06 +00:00
rmind 3ec265e103 npf_state_tcp: fix for FIN retransmission and out-of-order ACK case. 2012-07-01 18:13:51 +00:00