summaryrefslogtreecommitdiff
path: root/sys/net
AgeCommit message (Collapse)Author
2008-07-10check pf NAT source port allocation against net.inet.(tcp|udp).baddynamicDamien Miller
lists; prevents use of ports corresponding to well-known services. replace a couple of arc4random()%N with arc4random_uniform(N) that missed the first round. ok mcbride@
2008-07-10In pf_state_insert(), if the first pf_state_key_attach() fails, theDavid Krause
state key is freed by pf_state_key_attach(). But in the case of NAT, there are two state keys allocated, so we must free the second key manually. Fixes a pf_state_key_pl leak seen in certain cases with pfsync or with pf state-insert errors. ok mcbride@ henning@
2008-07-05in pf_state_key_attach(), when there is already an existing state key thatDavid Krause
can be used and we return the state key back to the pool, don't insert state items into the tailq using that garbage state key. this makes things much happier for me. ok henning@
2008-07-04in pf_state_key_attach(), when we find that there already is a state keyHenning Brauer
that we can attach the state to, make sure to not overwrite the state key pointer in the state that was just set to the existing state key with the state key that was supplied with the state and just free'd (well, pool_put'd). by the time we clean up the state and try to follow it to RB_REMOVE etc we'd follow that garbage pointer to either an unrelated state key or the old state key still sitting unused in the pool. should fix the RB_REMOVE panics some people have been seeing. "clearly ok, please commit" ryan
2008-07-04remove prototype for nonexistant functionHenning Brauer
2008-07-03link pf state keys to tcp pcbs and vice versa.Henning Brauer
when we first do a pcb lookup and we have a pointer to a pf state key in the mbuf header, store the state key pointer in the pcb and a pointer to the pcb we just found in the state key. when either the state key or the pcb is removed, clear the pointers. on subsequent packets inbound we can skip the pcb lookup and just use the pointer from the state key. on subsequent packets outbound we can skip the state key lookup and use the pointer from the pcb. about 8% speedup with 100 concurrent tcp sessions, should help much more with more tcp sessions. ok markus ryan
2008-07-01Don't return immediately if we're actually passing the traffic, we want toRyan Thomas McBride
ensure that the packet gets rewritten correctly first. As usual, problem pointed out by david ok henning
2008-07-01PF_DT_SKIP_STATETREE is no longer used.Ryan Thomas McBride
ok henning
2008-06-29this stupid per-arch SIZEOF_BPF_HDR define is really really stupid, butTheo de Raadt
for now add __sparc64__ to the list (ridiculous as it seems, but that is the best we know to do so far) ok miod
2008-06-29Simplify state creation code; merge state import/export code between pfsyncRyan Thomas McBride
and the state-related pf(4) ioctls, and make functions in state creation and destruction paths more robust in error conditions. All values in struct pfsync_state now in network byte order, as with pfsync. testing by david ok henning, systat parts ok canacar
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
2008-06-26Fix sticky-address on rdr; With the current nat code, we always use the sameRyan Thomas McBride
address in the NATed state key for translation regardless of direction. Report and testing by david@
2008-06-22Revert 1.203; it's not safe to blindly walk the tailq instead of the rbtreeRyan Thomas McBride
for picking states to unlink as the tailq may contain unlinked states.
2008-06-21Only do state key linking on the outbound path.Ryan Thomas McBride
Fixes stateful filtering on enc0. Problem report, testing, and ok david@
2008-06-19add 10GbaseT media type, 10 Gigabit Ethernet over CAT 6 unshielded orReyk Floeter
shielded twisted pair cables. this is an upcoming standard. ok brad@
2008-06-19Fix handling check for NAT and creation of a second pf_state_key in pfsync.Ryan Thomas McBride
Problem report and testing by david@
2008-06-17Crank PFSYNC_VERSION, lots has changed in struct pfsync_state due to theRyan Thomas McBride
state table reorg. discussed with deraadt and henning, reminded by david
2008-06-16when freeing a state key sk1, look wether it is linked to another state keyHenning Brauer
sk2 and reset sk2's link back to sk1
2008-06-15A bit of cleanup:Marco Pfatschbacher
- we prefer u_int*_t over uint_*t. - static is bad for debugging. - header files should not contain functions.
2008-06-15Add 802.3ad LACP support for trunk(4).Marco Pfatschbacher
Implementation from NetBSD. Ported via FreeBSD's version in trunk^Wlagg(4). This is still work in progress. Tested with a HP ProCurve 3500. OK reyk@
2008-06-14add carppeer; an option to specify a different multicast address orReyk Floeter
even the unicast address of the remote carp peer. this especially helps when the multicast carp advertisements are causing problems in the network (some crappy switches don't do well with multicast), there are conflicts with VRRP, or the policy of the network does not allow multicast (most Internet eXchange points didn't allow carped OpenBGP routers because of the multicast advertisements). discussed with many ok mpf@
2008-06-14Remove NBPFILTER conditional since we do not include "bpfilter.h" and theJoel Sing
<net/bpf.h> header is not required here. ok henning@
2008-06-14Include "pflog.h" so that we get NPFLOG.Joel Sing
ok henning@
2008-06-14Also do the PR_ZERO dance here. This was held back on Henning's requestMichael Knudsen
because it conflicted with the change he did in pf_if.c earlier. He finally woke up to ok (well, ``yes'', really) this version now.
2008-06-14There's no more reason to use oldnointr allocator here since we paceArtur Grabowski
the allocations in uvm_km_thread, as long as they are PR_WAITOK and all the memory hogs should be WAITOK in pf now. "following your explaination, it's ok" henning@
2008-06-14pool_get()s not in interrupt context should not be PR_NOWAIT, butHenning Brauer
PR_WAITOK | PR_LIMITFAIL. from discussion with art. ok ryan claudio thib
2008-06-14Move bpf_mtap_hdr() above the trunk_*_input() routines.Marco Pfatschbacher
This makes it easier to add trunk protocols that consume some packets. Add a special case for the failover protocol, to prevent shoving duplicates to bpf. (Not beautiful, but it has to do for the moment). OK reyk@, claudio@
2008-06-13Move the responsibility to free received packets on trunked interfacesMarco Pfatschbacher
from ether_input() into trunk_input() where it can be handled in a smarter way. OK claudio@ and reyk@ on an earlier version.
2008-06-13Change the logic when selecting routes on RTM_CHANGE & RTM_GET. RTM_CHANGEClaudio Jeker
can not supply the correct nexthop if the nexthop is changed. So if the route we want to change is a non-multipath one allow the change to succeed. This unbreaks RTM_CHANGE in most situations. Found by jsing@ Ok henning@
2008-06-13we used to use the lowest (so it is deterministic) mac address in theHenning Brauer
system for the bridge ID for stp. That worksfine unless you have two bridges in the system that talkto the same neighboring systems (switches), because the two bridges on the openbsd system would have the same ID. fix by only looking at interfaces part of the bridge and using the lowest mac address of these. works fine because stpcan only be enabled on IFT_ETHER interfaces so there is always at least one and we re-evaluate every time an interface is added or deleted from the bridge. diff was rotting in my tree for at least a year, I have no idea what triggered it really. ok reyk mk djm
2008-06-13Treat LINK_STATE_UNKNOWN as LINK_STATE_UP.Marco Pfatschbacher
This restores the old behaviour where we were checking for != LINK_STATE_DOWN. Fixes the ethernet to wireless failover feature and also allows trunk(4) to be used within qemu. Tested by sturm@. OK reyk@. "grumble, we should fix more drivers' link state handling" brad@
2008-06-13Cleanup a bit. Instead of doing dst = 0 in every error handling block initClaudio Jeker
it once at start instead.
2008-06-12fix synproxy.Henning Brauer
the factored out pf_create_state() could return PF_PASS, _DROP, and _SYNPROXY_DROP. We were treating the latter the same as _PASS and thus passing the original SYN which we of course don't want in the synproxy case. breakage reported by sakurai-san, headscratching with and ok ryan
2008-06-12#if 0 an annoygly chatty printf active whenever we're at loglevelHenning Brauer
loud, spilling out hundreds of lines on ruleset reloads is disturbing when you're hacking over cereal console, ryan ok
2008-06-12Fix the egress group matching for IPv4. There are to ways to define a /0Claudio Jeker
network mask. For some reasons some parts set sa->sa_len to 0 to specify a /0 netmask so check fot that too. tested by david@ OK henning@
2008-06-11Split address setup operations into a separate function. More to come.Ryan Thomas McBride
ok henning
2008-06-11when we establish the mapping from a state key, do it both ways, akaHenning Brauer
key1->reverse = key2; and key2->reverse = key1; ok ryan
2008-06-11factor out state creation code for readability; make it static inlineHenning Brauer
to not hurt performance while passing the 20 args (sigh) ok theo ryan, ok + feedback jsing
2008-06-11superfluous to check for m != NULL in pf_find_state, it is plainHenning Brauer
impossible that m is NULL here since all callers dereference it unconditionally beforehands, and find state without and mbuf doesn't make sense in the first place
2008-06-11after finding a state in the outbound path clear the statekey pointerHenning Brauer
in the header so it cannot get used again in case of somewhat weird reflection + mbuf-reuse-without-pkthdr-clearing cases. it looks like gif falls into the latter category. discussed with and ok theo
2008-06-11extra paranoia:Henning Brauer
1) only set the state key in the mbuf header in the inbound case 2) only use it in the outbound case discussed with and ok theo
2008-06-11yuck, fix a last minute collisionHenning Brauer
2008-06-11store a pointer to the stack side state key in the mbuf packetHenning Brauer
header inbound. on the outbound side, we take that and look for the key that is the exact opposite, and store that mapping in the state key. on subsequent packets we don't have to do the lookup on outbound any more. almost unable to get real benchmarks going here, we know for sure this gives a more than 5% increase in forwarding performance. many thanks to ckuethe for stress- and performance-testing. ok ryan theo
2008-06-10Handle the closing of half connections where we don't see the fullReyk Floeter
bidirectional FIN/ACK+ACK handshake. ok henning@
2008-06-10Simplify code slightly; use PR_ZERO with pool_get() rather than bzero().Ryan Thomas McBride
ok mpf henning
2008-06-10Free the counters struct when we free the table entry.Ryan Thomas McBride
2008-06-10Handle a special sloppy case where we only see one half of theReyk Floeter
connection. If there is a ACK after the initial SYN without ever seeing a packet from the destination, set the connection to established. ok henning@
2008-06-10Make counters on table addresses optional and disabled by default.Ryan Thomas McBride
Use the 'counters' table option in pf.conf if you actually need them. If enabled, memory is not allocated until packets match an address. This saves about 40% memory if counters are not being used, and paves the way for some more significant cleanups coming soon. ok henning mpf deraadt
2008-06-10when walking the entire state table it makes much more sense to walkHenning Brauer
the tailq instead of the rb tree. pt out by kjell some time ago, ok ryan
2008-06-10remove a debug check& printf that should not have gone in in the firstHenning Brauer
place