Commit Graph

61 Commits (720b99215da295a2e7b4acdef30b58bec6acedc2)

Author SHA1 Message Date
Felix Fietkau 720b99215d treewide: clean up download hashes
Replace *MD5SUM with *HASH, replace MD5 hashes with SHA256

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Jo-Philipp Wich 2daab45cae firewall3: drop support for automatic NOTRACK rules
Update to current HEAD in order to drop automatic generation of per-zone
NOTRACK rules.

The NOTRACK rules used to provide a little performance improvement but the
later introduction of the netfilter conntrack cache made those rules largely
unnecessary. Additionally, those rules caused various issues which broke
stateful firewalling in some scenarios.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
Jo-Philipp Wich 113544dccf firewall: update to fix FS#31, FS#73, FS#154, FS#248
Update to latest Git head in order to import several fixes and enhancements.

- Disable drop invalid by default (FS#73, FS#154)

  Instead of dropping packets with conntrack state INVALID, only allow streams
  with explicit NEW or UNTRACKED conntrack state.

  This change gives user defined rules the chance to accept traffic like ICMPv6
  multicast which would be filtered away by the very early ctstate INVALID drop
  rule otherwise.

  The old behaviour can be restored by explicitely setting "drop_invalid" to 1
  in the global firewall config section.

- Fix re-initialization of loadable iptables extensions on musl (FS#31)

  Since musl does not implement actual dlclose() semantics, it is impossible to
  re-run initializers on subsequent dlopen() calls.

  The firewall3 executable now intercepts the extension registration calls
  instead in order to be able to re-call them when needed.

  This also allowed us to switch to libxtables' builtin extension loader as a
  positive side-effect.

- Fix masquerade rules for multiple negated IP addresses (FS#248)

  When building MASQUERADE rules for zones which specify multiple negated
  addresses in masq_src or masq_dest, emit -j RETURN rules which jump out of
  the masquerading chain instead of creating multiple rules with inverted "-s"
  arguments.

- Tag own rules using comments

  Instead of relying on the nonstandard xt_id match, use the xt_comment match
  to mark own rules. Existing comments are prefixed with "!fw3: " while
  uncommented rules are marked with a sole "!fw3" string.

  This allows removing the xt_id match entirely in a later commit.

- Make missing ubus connection nonfatal

  Technically, firewall3 is able to operate without ubus just fine as long as
  the zones are declared using "option device" or "option subnet" instead of
  "option network" so do not abort execution if ubus could not be connected or
  of no network namespace is exported in ubus.

  This allows running firewall3 on ordinary Linux systems.

- Fix conntrack requirement detection for indirectly connected zones

  The current code fails to apply the conntrack requirement flag recursively to
  zones, leading to stray NOTRACK rules which break conntrack based traffic
  policing.

  Change the implementation to iteratively reapply the conntrack fixup logic
  until no more zones had been changed in order to ensure that all directly and
  indirectly connected zones receive the conntrack requirement flag.

- Add support for iptables 1.6.x

  Adds support for the xtables version 11 api in order to allow building
  against iptables 1.6.x

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
Daniel Engberg 9edfe7dd13 source: Switch to xz for packages and tools where possible
* Change git packages to xz
* Update mirror checksums in packages where they are used
* Change a few source tarballs to xz if available upstream
* Remove unused lines in packages we're touching, requested by jow- and blogic
* We're relying more on xz-utils so add official mirror as primary source, master site as secondary.
* Add SHA256 checksums to multiple git tarball packages

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
8 years ago
John Crispin 74766f4c4f firewall3: update to latest git HEAD
Signed-off-by: John Crispin <john@phrozen.org>
8 years ago
John Crispin 62dc9831d3 package/*: update git urls for project repos
Signed-off-by: John Crispin <john@phrozen.org>
8 years ago
Jo-Philipp Wich 4076d863bd firewall3: fix mark rules for local traffic, fix race condition
Update to latest HEAD in order to fix MARK rule generation for local traffic,
also fix a possible race condition during firewall start.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
Jo-Philipp Wich 6064710b90 firewall: drop invalid by default, remove chain indirection, fix invert flags (#21738)
* Enable drop_invalid by default to catch unnatted packets (#21738)
* Fix processing of inversions for -i, -o, -s, -d and -p flags
* Remove delegate_* chain indirection but rely on xt_id to identify own rules

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 48551
8 years ago
Felix Fietkau 614ebec4d2 firewall: add CONFIG_IPV6 to PKG_CONFIG_DEPENDS to fix a rebuild error
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48315
8 years ago
Felix Fietkau 9632c00435 firewall: move to git.openwrt.org
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48128
8 years ago
Jo-Philipp Wich f2a19350fd firewall: depend on kmod-ipt-conntrack (#20542)
Our ruleset requires kernel support for conntrack state matching, therfore
depend on the require kmod. Fixes #20542.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 46990
9 years ago
Steven Barth 6831883100 firewall: fix typo in ESP rule
Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 46506
9 years ago
Steven Barth f6abd042c2 firewall: comply with REC-22, REC-24 of RFC 6092
Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 46478
9 years ago
Jo-Philipp Wich 35497a0400 firewall: link iptables extensions dynamically
Use shared libipt{,4,6}ext.so libraries instead of statically linking
the userspace matches into the fw3 executable.

As a side effect the match initialization is extremely simplified
compared to the weak function pointer juggling performed before.

This also fixes the initialization of the multiport match.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 45764
9 years ago
Steven Barth 0f365e4cb9 firewall: fix some more null-pointer accesses
thanks to Hans Dedecker

Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 44540
9 years ago
Jo-Philipp Wich a6a142caf6 firewall: respect src_dip option for reflection (#18544)
Also fix wrong IPv4 netmask calculation on x86-64, thanks Ulrich Weber.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 43874
9 years ago
John Crispin 74a3a77bcd license info - revert r43155
turns out that r43155 adds duplicate info.

Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 43167
10 years ago
John Crispin c10d97484a Add more license tags with SPDX identifiers
Note, that licensing stuff is a nightmare: many packages does not clearly
state their licenses, and often multiple source files are simply copied
together - each with different licensing information in the file headers.

I tried hard to ensure, that the license information extracted into the OpenWRT's
makefiles fit the "spirit" of the packages, e.g. such small packages which
come without a dedicated source archive "inherites" the OpenWRT's own license
in my opinion.

However, I can not garantee that I always picked the correct information
and/or did not miss license information.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>

SVN-Revision: 43155
10 years ago
Steven Barth bec9d38fa4 Add a few SPDX tags
Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 43151
10 years ago
Jo-Philipp Wich 68147004e2 firewall: allow '*' as synonym for any / all in family and proto options
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 42620
10 years ago
Jo-Philipp Wich 36e2179c10 firewall: fix heap corruption in fw3_bitlen2netmask() with IPv6 addresses
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 42610
10 years ago
Jo-Philipp Wich cbf50a0ffd firewall: fix invalid memory access when processing /128 IPv6 addresses from ubus, properly emit REDIRECT rules for local port forwards
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 42604
10 years ago
Jo-Philipp Wich aa9e69908e firewall: fix potential NULL pointer access
Properly skip struct ifaddr entries with NULL ifa_addr, thanks Kostas Papadopoulos for reporting.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 42138
10 years ago
Jo-Philipp Wich fa37594f50 firewall: implement selective conntrack flushing (#10225)
Utilize the new selective conntrack flushing facility to clear
out active conntrack entries referring to old IP addresses after
a firewall reload.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 42114
10 years ago
Jo-Philipp Wich 2dd087ccee firewall: implement support for abritary netmasks
Properly parse and pass arbritary netmasks to iptables, this allows
specifying ranges like '::c23f:eff:fe7a:a094/::ffff:ffff:ffff:ffff' to
match the host part of an IPv6 address regardless of the currently active
IPv6 prefix.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 41760
10 years ago
Jo-Philipp Wich f4781cae6d firewall: fix segfault introduced by latest update
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 41558
10 years ago
Jo-Philipp Wich 8b0650838d firewall: fix regressions introduced after latest ubus rework
The commit 92281eb747b56e748b7c3d754055919c23befdd4 broke fw3_ubus_addresses() so that
no addresses where returned at all, this caused fw3 to not emit NAT reflection rules
anymore.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 41556
10 years ago
Jo-Philipp Wich b321f718c2 firewall: fix issue with parsing network options
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 41491
10 years ago
Felix Fietkau 2b274eb719 firewall: update to the latest version, adds support for fetching firewall rules from procd
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 41480
10 years ago
Steven Barth 2ad9907cd5 firewall3: add fw3 zone function to enumerate devices
SVN-Revision: 41349
10 years ago
Steven Barth daf69ee1da firewall: add support for nat-rules and netifd-proto-originating rules
Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 40510
10 years ago
Felix Fietkau 66393168d3 firewall: update to latest version, fixes a musl build error
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 39965
10 years ago
Jo-Philipp Wich 21f4cf1a73 firewall: fix several ipset integration issues (#15016)
- Do not consider bitmap storage for IPv6 family sets
	- Move ipset family parameter before any additional option
	- Only emit family parameter for hash sets
	- Do not allow IPv6 iprange for IPv4 sets and vice versa

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 39647
10 years ago
Jo-Philipp Wich de5ebc19c0 firewall: fix handling of tcp_ecn parameter
The firewall3 implementation as well as the shell implementation predating it
used to process the tcp_ecnoption as boolean while it actually is an integer.

Change the code to parse tcp_ecn as integer.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 39122
11 years ago
Jo-Philipp Wich bc9043cc53 firewall: optimize DNAT rules and skip invalid rules and redirects (#14485)
- instead of writing one (or more) ACCEPT rules in the filter table
	  for each redirect install a global ctstate DNAT accept rule per zone

	- discard rules and redirects which have invalid options set instead
	  of silently skipping the invalid values

SVN-Revision: 38849
11 years ago
Steven Barth bb699867e0 firewall: Improve ubus support
* Use network.interface dump call instead of individual status calls
  to reduce overall netifd lookups and invokes to 1 per fw3 process.

* Allow protocol handlers to assign a firewall zone for an interface
  in the data section to allow for dynamic firewall zone assignment.

SVN-Revision: 38504
11 years ago
Jo-Philipp Wich db3013852a firewall: small improvements in nat reflection
- do not insert duplicate rules when setting up reflection to a zone containing multiple interfaces
	- set up reflection for any protocol, not just TCP and UDP

SVN-Revision: 38361
11 years ago
Jo-Philipp Wich 2864fb107f firewall: update to git head
- uses "-j CT --notrack" instead of deprecated "-j NOTRACK"
	- fixes support for rule sections with target "NOTRACK"

SVN-Revision: 37777
11 years ago
Jo-Philipp Wich d6e8047f83 firewall: update to git head
- handles redirects as port relocations if the dest_ip points to the router itself

SVN-Revision: 37374
11 years ago
Felix Fietkau f98f69adc9 firewall: add missing dependencies
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37224
11 years ago
Jo-Philipp Wich 4aa82d07a6 firewall: allow routed lan<->lan traffic by default
SVN-Revision: 37171
11 years ago
Jo-Philipp Wich 2d506f46fb firewall: update to git head
- uses custom formatting for mac addresses to ensure leading zeroes, required for older iptables mac match parser

SVN-Revision: 37082
11 years ago
Jo-Philipp Wich 65f82e2311 firewall: update to git head
- fixes misprocessing of unknown symbolic protocol names

SVN-Revision: 36963
11 years ago
Jo-Philipp Wich 37ae268729 firewall: update to git head
- fixes calculation of IPv4 netmasks derived from 0.0.0.0/0 CIDRs

SVN-Revision: 36960
11 years ago
Jo-Philipp Wich 36d3fafd77 firewall: update to git head
- properly process intermediate "!" options in argument list (fixes negated ipsets)

SVN-Revision: 36935
11 years ago
Jo-Philipp Wich 0db38adf1c firewall: update to git head
- fixes handling of reject target for rule sections with specific destination zone

SVN-Revision: 36933
11 years ago
Jo-Philipp Wich e7b15446a8 firewall: udpate to git head (#13652, #13654, #13658)
- optimizes chain usage for ingress rules
  - adds limit match support for redirect rules
  - fixes automatic redirect dest detection on little endian systems
  - leaves base chains in place on reload to allow user rules to target e.g. "reject"

SVN-Revision: 36871
11 years ago
Jo-Philipp Wich 5cf06bd17b firewall: copy libext*.a from staging dir and drop kernel.mk includes, solves problem with colliding CONFIG_IPV6 symbols
SVN-Revision: 36868
11 years ago
Jo-Philipp Wich ecc95dcba8 firewall: update to git head (#13652)
- simplifies using ipsets for rules and redirects, match direction can be specified in-place like option ipset 'setname src dst dst'
  - uses zone_name_src_ACTION chains for input rules, this fixes logging with log enabled src zones

SVN-Revision: 36854
11 years ago
Jo-Philipp Wich 0a74d9d5c3 firewall3: fix accidentally changed install directive
SVN-Revision: 36840
11 years ago