Commit Graph

105 Commits (1634461bd208f4bd108ea5c3d3f1cf9eb56d4a7e)

Author SHA1 Message Date
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 d534883a52 firewall: Allow IGMP and MLD input on WAN
The WAN port should at least respond to IGMP and MLD queries as
otherwise a snooping bridge/switch might drop traffic.

RFC4890 recommends to leave IGMP and MLD unfiltered as they are always
link-scoped anyways.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>

SVN-Revision: 45613
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
10 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
John Crispin 2ae05c57f8 package/*: remove useless explicit set of function returncode
somebody started to set a function returncode in the validation
stuff and everybody copies it, e.g.

myfunction()
{
	fire_command

	return $?
}

a function automatically returns with the last returncode,
so we can safely remove the command 'return $?'. reference:

http://tldp.org/LDP/abs/html/exit-status.html
"The last command executed in the function or script determines the exit status."

Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com>

SVN-Revision: 42278
10 years ago
John Crispin b9ea44f947 firewall: the firewall did not start properly on boot
https://dev.openwrt.org/ticket/17593

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

SVN-Revision: 42233
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 b22ad85bc6 firewall: fix validation constraints
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 39649
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
John Crispin 15ebcfc04e firewall3: update init.d script to make use of procd
add validation data

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

SVN-Revision: 39617
10 years ago
Steven Barth fac5e62abd firewall: don't reload if there were no address or data changes
This fixes packet loss due to reloading firewall every minute with IPv6
implementation of certain ISPs.

SVN-Revision: 39332
11 years ago
John Crispin a844275f37 firewall: improve logging in hotplug script
Signed-off-by: Nathan Hintz <nlhintz@hotmail.com>

SVN-Revision: 39300
11 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
Jo-Philipp Wich 07a3110e88 firewall: fix git source url
SVN-Revision: 36839
11 years ago
Jo-Philipp Wich b721c92221 firewall3: rename to firewall, move into base system menu, update to git head with compatibility fixes for AA
SVN-Revision: 36838
11 years ago
Jo-Philipp Wich 0dd6753c09 Drop legacy firewall package
SVN-Revision: 36837
11 years ago
Steven Barth 4cb9d9715c firewall: Remove obsoleted ULA-border rule
SVN-Revision: 36622
11 years ago
Jo-Philipp Wich 92062542e2 firewall: fix logging rule regression (#12999)
SVN-Revision: 35745
11 years ago
Jo-Philipp Wich e106f25ee7 firewall: various enhancements
- reduce mssfix related log spam (#10681)
	- separate src and dest terminal chains (#11453, #12945)
	- disable per-zone custom chains by default, they're rarely used

Additionally introduce options "device", "subnet", "extra", "extra_src" and "extra_dest"
to allow defining zones not related to uci interfaces, e.g. to match "ppp+" or any tcp
traffic to and from a specific port.

SVN-Revision: 35484
11 years ago
Jo-Philipp Wich 839f3ab0e7 firewall: flush conntrack table after changing interface rules
SVN-Revision: 35348
12 years ago
Steven Barth b077480a59 firewall: Add ULA site border for IPv6 traffic This prevents private traffic from leaking out to the internet
SVN-Revision: 35012
12 years ago
Jo-Philipp Wich 16d0957a4e firewall: fix typo in reflection hotplug script
SVN-Revision: 34569
12 years ago
Jo-Philipp Wich 6504b268b3 firewall: extend nat reflection support
- use comment match to keep track of per-network rules
	- setup reflection for any interface which is part of a masqueraded zone, not just "wan"
	- delete per-network reflection rules if network is brought down

SVN-Revision: 34472
12 years ago
Felix Fietkau 405e21d167 packages: sort network related packages into package/network/
SVN-Revision: 33688
12 years ago