summaryrefslogtreecommitdiff
path: root/sys/netinet
AgeCommit message (Collapse)Author
2010-02-09Before cloning a route to change the MTU check that the route we clone fromClaudio Jeker
is valid and usable (reject and blackholes are not conidered usable). TCP has this nasty behaviour to clone routes to disable PMTU and this combined with dynamic routing resulted in dead sessions when there was a default reject route installed. OK henning@, sthen@
2010-02-08arpioctl() is not used sore remove it. Found by Gleydson Soares.Claudio Jeker
2010-01-28Remove dead assignment and newly created unused variable.Charles Longeau
Found by LLVM/Clang Static Analyzer. ok krw@ henning@
2010-01-15Replace pool_get() + bzero() with pool_get(..., PR_ZERO).Charles Longeau
With input from oga@ and krw@ ok oga@ krw@ thib@ markus@ mk@
2010-01-13Double and in comment.Claudio Jeker
2010-01-13remove subnetsarelocal / SUBNETSARELOCAL. it's been off by default sinceHenning Brauer
1996 with no way to enable but kernel config or code mods and is bound to classful adressing anyway.
2010-01-13no point in looking for the old "all host bits zero" broadcast address anyHenning Brauer
more here either
2010-01-134.2BSD had the host parts bit of the address all zero as broadcast address.Henning Brauer
4.3BSD (anno 1986) supported the host part bits all one for broadcast as well, since that's what everybody agreed on and RFC919 (anno 1984) proposed. now, roughly a quarter decade later, we can really stop supporting the all zero variant. sorry to you guys still running 4.2BSD. ok theo ryan
2010-01-13we don't need broadcast for the classful network AND broadcast for theHenning Brauer
subnet of the classful network. at least, not since 1992. ok mpf dlg bob
2010-01-13Remove special bridge code in in_arpinput() this is no longer needed sinceClaudio Jeker
we now correctly broadcast packets to all local ports. OK deraadt@
2010-01-13instead of fiddling with the per-interface address lists directly inHenning Brauer
many places create a proper API (ifa_add / ifa_del) and use it. ok theo ryan dlg
2010-01-13let's admit it's not 1992 any more. CIDR is around for a long time, evenHenning Brauer
that router vendor doesn't default to classful routing any more, and there really is no point in having a classful netmask and a subnetmask to split it. we still do classful guesses on the netmask if it isn't supplied by userland, but that's about it. i decided to keep ia_netmask and kill ia_subnetmask which makes this diff bigish, the classful ia_netmask wasn't really used all that much. the real changes are in in.c, the rest is mostly s/ia_subnetmask/ia_netmask. ok claudio dlg ryan
2010-01-12Add input and user protocol hook to handle GRE packets by pipex.YASUOKA Masahiko
ok @dlg
2010-01-12Unify the various fake ethernet generators as ether_fakeaddr() whichTheo de Raadt
is safe for both hardware devices and virtual devices ok mpf, kettenis, moaning and groaning and slow acceptance from mcbride XXX should loop checking for uniqueness after new henning diff goes in
2010-01-12Remove the "bump the advskew to 240 in case of errors" hack.Marco Pfatschbacher
The demote counter can handle that. This lets carp hosts with an identical demote count still know which one is the designated master and prevents them from failing over asymmetrically. Since there is a demote handling bug in all releases prior to 4.6, symmetric failover will only work against 4.6 (and newer) from now on. OK henning@
2010-01-12Allow the queueing of multiple fragments on virtual interfaces with aBob Beck
queue length of one - i.e. vlans with the forthcoming change from dlg. this allows fragmented frames to be sent on such an interface, hoping that the interface underneath copes correctly - A better fix for this will be forthcoming soon, but this is good enough for now, and will allow the change for vlans to use an ifq length of 1. tested by me and dlg@, ok dlg@, claudio@, deraadt@
2010-01-12Use M_ZERO in malloc instead of doing a bzeor right afterwards.Claudio Jeker
From Gleydson Soares, OK beck@
2010-01-10Fix two bugs in IPsec/HMAC-SHA2:Markus Friedl
(1) use correct (message) block size of 128 byte (instead of 64 bytes) for HMAC-SHA512/384 (RFC4634). (2) RFC4868 specifies that HMAC-SHA-{256,384,512} is truncated to nnn/2 bits, while we still use 96 bits. 96 bits have been specified in draft-ietf-ipsec-ciph-sha-256-00 while draft-ietf-ipsec-ciph-sha-256-01 changed it to 128 bits. WARNING: this change makes IPsec with SHA-256 (the default) incompatible with older OpenBSD versions and other IPsec-implementations that share this bug. ok+tests naddy, fries; requested by reyk/deraadt
2010-01-02uninitalized protocol version for ipv6; from mickey; ok claudioMarkus Friedl
2009-12-23The process's rdomain should be, well, per-process and not per-rthread,Philip Guenthe
so put it in struct process instead of struct proc. While at it, move the p_emul member inside struct proc so that it gets copied automatically instead of requiring manual assignment. ok deraadt@
2009-12-15Ensure that the interface is valid before trying to access its flags.Joel Sing
ok claudio@
2009-12-15Ansify function declarations.Joel Sing
ok claudio@
2009-12-15Ensure that the interface is not null before trying to access its flags.Joel Sing
Fixes PR6274. ok claudio@
2009-12-11Two cases of IPSEC getsockopt() returning two bytes of uninitialializedTheo de Raadt
kernel stack content instead of proper information; found by Clement LECIGNE
2009-12-07do not forward and drop packets with M_MCAST flag set in ip_forward()Joerg Goltermann
ok henning@, claudio@ "I think this should go in"
2009-11-27Add setrdomain() and getrdomain() system calls. Committing now toPhilip Guenthe
catch the libc major bump per request from deraadt@ Diff by reyk. ok guenther@
2009-11-21Add a way to bind the tunnel endpoint of a gif/gre interface into aClaudio Jeker
different rdomain than the default one. This allows to do MPLS VPNs without the MPLS madness. OK deraadt@, henning@
2009-11-20NULL dereference in IPV6_PORTRANGE and IP_IPSEC_*, found by Clement LECIGNE,Philip Guenthe
localhost DoS everywhere. To help minimize further issues, make the mbuf != NULL test explicit instead of implicit in a length test. Suggestions and initial work by mpf@ and miod@ ok henning@, mpf@, claudio@,
2009-11-19avoid overflow since protos > IPPROTO_MAX exist. From FreeBSD withOtto Moerbeek
a twist; ok millert@ kettenis@
2009-11-13Extend the protosw pr_ctlinput function to include the rdomain. This isClaudio Jeker
needed so that the route and inp lookups done in TCP and UDP know where to look. Additionally in_pcbnotifyall() and tcp_respond() got a rdomain argument as well for similar reasons. With this tcp seems to be now fully rdomain save and no longer leaks single packets into the main domain. Looks good markus@, henning@
2009-11-13Packets generated by ip_fragment() need to inherit the rdomain from theClaudio Jeker
original packet or they will trigger the diagnostic check in the interface output routines. OK jsg@
2009-11-03rtables are stacked on rdomains (it is possible to have multiple routingClaudio Jeker
tables on top of a rdomain) but until now our code was a crazy mix so that it was impossible to correctly use rtables in that case. Additionally pf(4) only knows about rtables and not about rdomains. This is especially bad when tracking (possibly conflicting) states in various domains. This diff fixes all or most of these issues. It adds a lookup function to get the rdomain id based on a rtable id. Makes pf understand rdomains and allows pf to move packets between rdomains (it is similar to NAT). Because pf states now track the rdomain id as well it is necessary to modify the pfsync wire format. So old and new systems will not sync up. A lot of help by dlg@, tested by sthen@, jsg@ and probably more OK dlg@, mpf@, deraadt@
2009-10-28*NULL store in IP_AUTH_LEVEL, IP_ESP_TRANS_LEVEL, IP_ESP_NETWORK_LEVEL,Theo de Raadt
IP_IPCOMP_LEVEL found by Clement LECIGNE, localhost root exploitable on userland/kernel shared vm machines (ie. i386, amd64, arm, sparc (but not sparc64), sh, ...) on OpenBSD 4.3 or older ok claudio
2009-10-25Get rid of unused macro `la_timer'.Michael Knudsen
`if it is unused nuke it' claudio
2009-10-17Allow us to accept gratuitous ARP requests in cases where theMarco Pfatschbacher
link-route points over the carp interface. (IP-less carpdev) The descision whether to drop an ARP query is now expressed with a goto out; rather than a second check later, which prevented the carpdev case to work. Also add some comments to make in_arpinput() easier to understand. OK henning, markus.
2009-10-06Redo the route lookup in the output (and IPv6 forwarding) path if theClaudio Jeker
destination of a packet was changed by pf. This allows for some evil games with rdr-to or nat-to but is mostly needed for better rdomain/rtable support. This is a first step and more work and cleanup is needed. Here a list of what works and what does not (needs a patched pfctl): pass out rdr-to: from local rdr-to local addr works (if state tracking on lo0 is done) from remote rdr-to local addr does NOT work from local rdr-to remote works from remote rdr-to remote works pass in nat-to: from remote nat-to local addr does NOT work from remote nat-to non-local addr works non-local is an IP that is routed to the FW but is not assigned on the FW. The non working cases need some magic to correctly rewrite the incomming packet since the rewriting would happen outbound which is too late. "time to get it in" deraadt@
2009-10-04Add (again) support for divert sockets. They allow you to:Michele Marchetto
- queue packets from pf(4) to a userspace application - reinject packets from the application into the kernel stack. The divert socket can be bound to a special "divert port" and will receive every packet diverted to that port by pf(4). The pf syntax is pretty simple, e.g.: pass on em0 inet proto tcp from any to any port 80 divert-packet port 1 A lot of discussion have happened since my last commit that resulted in many changes and improvements. I would *really* like to thank everyone who took part in the discussion especially canacar@ who spotted out which are the limitations of this approach. OpenBSD divert(4) is meant to be compatible with software running on top of FreeBSD's divert sockets even though they are pretty different and will become even more with time. discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@ tested by reyk@ and myself ok reyk@ claudio@ beck@ manpage help and ok by jmc@
2009-09-08I had not enough oks to commit this diff.Michele Marchetto
Sorry.
2009-09-08Add support for divert sockets. They allow you to:Michele Marchetto
- queue packets from pf(4) to a userspace application - reinject packets from the application into the kernel stack. The divert socket can be bound to a special "divert port" and will receive every packet diverted to that port by pf(4). The pf syntax is pretty simple, e.g.: pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000 test, bugfix and ok by reyk@ manpage help and ok by jmc@ no objections from many others.
2009-08-23revert the icmp error diff again (r1.167-1.169)David Krause
seems to be causing some kind of memory corruption after several hours of heavy IPsec traffic. connections start becoming very slow eventually leading to all IPsec packets being lost. a reboot solves the issue for several more hours before it appears again.
2009-08-20fix indentationAlexander Bluhm
no binary change; ok grunk@
2009-08-12don't confuse chars with strings; ok oga@Martynas Venckus
2009-08-107 years ofHenning Brauer
#if 1 reasonable #else bullshit required by some committee #endif are enough. theo ok
2009-08-10we need to null mcopy, gotos bite. theo and i both missed them, theo okHenning Brauer
2009-08-10fix previous:Henning Brauer
-m_copydata istead of straight bcopy. noticed by damien -handle the pretty much impossible case that the packet header grows so much that MHLEN < 68. i bet this had been the least of our worries, in that case, but code oughta be correct anyway. ok theo and dlg
2009-08-10this is basically a fixed version of r1.165, avoid m_copym of each and everyHenning Brauer
forwarded packet in case ip_output returns an error and we have to quote some of it back in an icmp error message. this implementation done from scratch: place an mbuf on the stack. copy the pkthdr from the forwarded packet and the first 68 bytes of payload. if we need to send an icmp error, just m_copym our mbuf-on-the-stack into a real one that icmp_error can fuck with and eat as it desires. ok theo dlg
2009-08-10sockets created via a listening socket lose the rdomain and fail to workClaudio Jeker
therefore. Inherit the rdomain through the syncache. There are some interactions that need some more work (ctlinput) so this can be improved but is good enough for now. OK markus@
2009-08-09once again ipsec tries to be clever and plays fast, this time byHenning Brauer
recycling an mbuf tag and changing its type. just always get a new one. theo ok
2009-08-01timeout_add -> timeout_add_msecBret Lambert
ok michele@ claudio@
2009-07-28revert the avoidance of the mbuf copy for the icmp errors (r1.165)David Gwynne
some greater care must be taken to ensure the mbuf generated for icmp errors is a good copy.