Age | Commit message (Collapse) | Author |
|
by ioctl(2) operation if table exists already. The issue
has been noticed by Giannis Kapetanakis (_at_) edu.physics.uoc.gr.
Giannis noticed relayd(8) aborts unexpectedly when 'relay host'
gets disabled by 'relayctl host dis ...' command. To understand
what's going on we must look at the way how relayd(8) manages
its firewall configuration. If relay-host 'example' is enabled relayd(8)
inserts rule to anchor relayd/example. The rule looks somewhat
like this:
pass in from ... to ... rdr-to <example>
When the rule gets inserted to pf(4) the table 'example' is
created with flags:
lumpy# pfctl -a relayd/example -vg -sT
----r-- example relayd/example
r-flag indicates table is referred by rule only. In the next
step relayd(8) creates and populates table example. It asks
pf(4) to add a persistent flag (PFR_TFLAG_PERSIST), so table
survives flush operation of relayd/example ruleset on behalf
of 'relayctl host dis ...' command. relayd(8) exits via abort()
when table is gone with disable operation.
Giannis was patient enough so we could debug and fix issue.
The committed change has been tested by Giannis too.
OK kn@, bluhm@
|
|
pfr_add_tables() function must set PFR_TFLAG_ACTIVE flag
to table which is attached to rule. This will then allow
pfr_add_addrs() to populate the table with addresses.
without this pair of pfctl(8) commands fails as follows:
# echo 'pass from <foo> to any' |pfctl -f -
# pfctl -t foo -T add 192.168.1.0/24
pfctl: Table does not exist
OK mbuhl@
|
|
OK bluhm
Reported-by: syzbot+50ea4f33ed5dd9264918@syzkaller.appspotmail.com
Reported-by: syzbot+df65f8b7ee8c0089e885@syzkaller.appspotmail.com
|
|
been spotted and reported by jmc@
OK kn@
|
|
same panic can be triggered when address table is part
of anchor loaded by 'load anchor ... from ..,' statement.
pf_find_or_create_ruleset() function called by pfr_add_tables()
must receive ruleset name which comes from pre-allocated root
table.
OK claudio@ dlg@
|
|
NET_LOCK()/PF_LOCK() scope. bluhm@ helped a lot
to put this diff into shape.
OK bluhm@
|
|
prompted by uninitialised var found by bluhm@ running regress on sparc64
ok sashan@
|
|
scope.
feedback by bluhm@
OK bluhm@
|
|
object exists already, then caller must free the pre-allocated buffer.
If caller does not pre-allocate buffer, the pfi_kif_get() will get
memory from pool using M_NOWAIT flag.
Commit is also polishing pfi_initialize() a bit so it uses M_WAITOK
allocation for pfi_all.
there is no change in current behaviour.
feedback by bluhm@
OK bluhm@
|
|
OK todd@, mvs@, kn@
|
|
OK @mpi
|
|
ok sashan
|
|
time_second(9) and time_uptime(9) are widely used in the kernel to
quickly get the system UTC or system uptime as a time_t. However,
time_t is 64-bit everywhere, so it is not generally safe to use them
on 32-bit platforms: you have a split-read problem if your hardware
cannot perform atomic 64-bit reads.
This patch replaces time_second(9) with gettime(9), a safer successor
interface, throughout the kernel. Similarly, time_uptime(9) is replaced
with getuptime(9).
There is a performance cost on 32-bit platforms in exchange for
eliminating the split-read problem: instead of two register reads you
now have a lockless read loop to pull the values from the timehands.
This is really not *too* bad in the grand scheme of things, but
compared to what we were doing before it is several times slower.
There is no performance cost on 64-bit (__LP64__) platforms.
With input from visa@, dlg@, and tedu@.
Several bugs squashed by visa@.
ok kettenis@
|
|
couldn't find an entry if its table is attached a table on the root.
This fixes the problem "route-to <TABLE> least-states" doesn't work.
The problem is found by IIJ.
OK sashan
|
|
ok kn@
|
|
These are just unhelpful case conversion.
OK sashan henning
|
|
Replace hardcoded 0 and implicit checks with enum as done in all other
use cases of `pfra_fback'. No object change.
OK sashan
|
|
(tj found fix in FreeBSD repo for us)
OK @bluhm, @henning
|
|
Don't trust the value of pfra_type blindly since it's coming from
userland and sanitize it in pfr_validate_addr that is called after
every copyin and also perform the check in pfr_create_kentry before
we attempt to use the value not after.
Coverity CID 1452909, 1453097, 1453384; Severity: Minor
It can be triggered only by root by default or anyone with write
access to /dev/pf if such access is provided.
ok visa, bcook, sashan, jsg
|
|
so that we can run these parts of pf in parallel. Also replace a
single usage of pfr_mask with a stack local variable.
ok mpi@
|
|
The distinction between preempt() and yield() stays as it is usueful
to know if a thread decided to yield by itself or if the kernel told
him to go away.
ok tedu@, guenther@
|
|
current process is hogging a CPU.
ok mikeb@, visa@, tedu@
|
|
rectification.
|
|
globals is the KERNEL_LOCK().
ok claudio@
|
|
pfvar_priv.h. The pf_headers had to be defined in multiple .c files
before. In pfvar.h it would have unknown storage size, this file
is included in too many places. The idea is to have a private pf
header that is only included in the pf part of the kernel. For now
it contains pf_pdesc and pf_headers, it may be extended later.
discussion, input and OK henning@ procter@ sashan@
|
|
|
|
|
|
the ioff argument to pool_init() is unused and has been for many
years, so this replaces it with an ipl argument. because the ipl
will be set on init we no longer need pool_setipl.
most of these changes have been done with coccinelle using the spatch
below. cocci sucks at formatting code though, so i fixed that by hand.
the manpage and subr_pool.c bits i did myself.
ok tedu@ jmatthew@
@ipl@
expression pp;
expression ipl;
expression s, a, o, f, m, p;
@@
-pool_init(pp, s, a, o, f, m, p);
-pool_setipl(pp, ipl);
+pool_init(pp, s, a, ipl, f, m, p);
|
|
ok phessler@ henning@
|
|
OK mikeb@, OK bluhm@
|
|
|
|
length of the key as argument.
This way every consumer of the radix tree has a chance to explicitly
initialize the shared data structures and no longer rely on another
subsystem to do the initialization.
As a bonus ``dom_maxrtkey'' is no longer used an die.
ART kernels should now be fully usable because pf(4) and IPSEC properly
initialized the radix tree.
ok chris@, reyk@
|
|
path was taken. This both prevents warnings from clang and acts as a
sanity check.
ok mcbride@ henning@
|
|
- PF should always use unhandled_af()
- 0 is lame, AF_UNSPEC is profi
ok bluhm@
|
|
it also adds af_unhandled(), where it is currently missing.
ok mcbride@
|
|
to never return the internal RNF_ROOT nodes. This removes the checks
in the callee to verify that not an RNF_ROOT node was returned.
OK mpi@
|
|
something based on an address family and later assumes one of the paths
was taken. This was initially just calls to panic until guenther
suggested a function to reduce the amount of strings needed.
This reduces the amount of noise with static analysers and acts
as a sanity check.
ok guenther@ bluhm@
|
|
pfi_kif objects allocated for table entries created by route-to or
by specifying weight weren't garbage collected when the table entry
was destroyed.
Spotted by Alexandr Nedvedicky <alexandr ! nedvedicky at oracle ! com>,
thanks! Ok henning, florian
|
|
Spotted by Alexandr Nedvedicky <alexandr ! nedvedicky at oracle ! com>,
thanks!
|
|
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.
ok tedu@ deraadt@
|
|
Analysis and patch by Richard Kojedzinszky, thanks! ok henning
|
|
long live the one true internet.
ok henning mikeb
|
|
ok miod@ mpi@
|
|
after discussions with beck deraadt kettenis.
|
|
While here, fix pf table displays to fit within 80 chars.
Manpage input jmc@
ok henning@ reyk@
|
|
change for pf, but that's fine at this time. You'll need to rebuild
pf userland after updating your kernel.
change to 'since' member ok henning@
rest ok henning@ deraadt@
|
|
an ABI change involved.
|
|
type**, so no ABI change.
ok henning@ deraadt@
** ...yet
|
|
table statistics so it appeared later on as the Epoch. Noticed
by [the] Shining on bugs@. Thanks!
ok sthen, waver from deraadt
|
|
negating existing entries on re-load does not work (e.g. changing
192.168.6.0/24 to !192.168.6.0/24 in table was ignoed).
ok mikeb@, henning@ mpf@, bluhm@,
|