summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* in_scrubprefix needs the same netmask checking as in_addprefix (which wasclaudio2012-07-101-9/+12
| | | | | | added in 1.40). This fixes a pathological case where in_scrubprefix would do the wrong thing. Found and reported by glebius@FreeBSD OK bluhm@
* Instead of casting interface address pointers, use the macros NULLbluhm2012-07-081-6/+6
| | | | | and ifatoia(). No binary diff. OK blambert@ henning@ claudio@
* To access the ifaddr of an in_ifaddr or in6_ifaddr struct, it isbluhm2012-01-031-8/+7
| | | | | | cleaner to access the first member via ia_ifa instead of casting. No binary change. ok henning@ krw@
* Since the IPv6 madness is not enough introduce NAT64 -- which is actuallyclaudio2011-10-131-2/+1
| | | | | | | | "af-to" a generic IP version translator for pf(4). Not everything perfect yet but lets fix these things in the tree. Insane amount of work done by sperreault@, mikeb@ and reyk@. Looked over by mcbride@ henning@ and myself at eurobsdcon. OK mcbride@ and general put it in from deraadt@
* allow /31s on broadcast interfaces (eg ethernet) to work as per rfc3021.dlg2011-07-061-3/+7
| | | | | | | | | | | | | | | | | the issue in our kernel was the broadcast address calculated on the /31 caused a ton of checks for use of broadcast addresses to kick in and prevent one of the two addresses on the /31 from being used. this diff basically detects if a /31 has been configured and doesnt configure a broadcast address for it, which makes the ips usable for normal traffic. i wrote this so i could interoperate with "carrier" network gear better, and sthen wants it so he can conserve address space use. the further special casing of broadcast address handling was from claudio@ ok claudio@ markus@ sthen@ henning@
* slight knf (particularly the function decls) so i dont get too distracteddlg2011-07-031-40/+17
| | | | | | while reading. ok henning@ jsing@ tedu@ marco@ bluhm@ krw@
* gc in_interfaces. doesnt seem to do anything except get incremented.dlg2011-07-021-5/+1
| | | | ok henning@ deraadt@
* Make in_broadcast() rdomain aware. Mostly mechanical change.claudio2011-04-281-4/+7
| | | | | | This fixes the problem of binding sockets to broadcast IPs in other rdomains. OK henning@
* Only call ifa_del() when no error happend previously. Do the same thingclaudio2010-11-281-5/+10
| | | | | | | for dohooks() since it makes no sense to call the if_addrhooks when the address assignment failed. Additionally only call ifa_add() in in_ifinit() when no error happend. Fixes a carp(4) panic seen by dhill and dlg. OK henning@, dlg@
* an extra parameter for in_ifinit, indicating wether the ifaddr passed to ithenning2010-11-171-5/+12
| | | | | is new or an already existing one. for existing ones, call ifa_del first tested by many as part of a larger diff, ok claudio dlg krw sthen
* use ifa_update_broadaddr and make sure bcast address is set before callinghenning2010-11-171-5/+11
| | | | | in_ifinit tested by many as part of a larger diff, ok claudio dlg krw sthen
* move the ifa_add call to in_ifinit() so it is called AFTER the ifaddrhenning2010-11-171-2/+4
| | | | | structure is fully set up tested by many as part of a larger diff, ok claudio dlg sthen krw
* remove subnetsarelocal / SUBNETSARELOCAL. it's been off by default sincehenning2010-01-131-27/+7
| | | | | 1996 with no way to enable but kernel config or code mods and is bound to classful adressing anyway.
* 4.2BSD had the host parts bit of the address all zero as broadcast address.henning2010-01-131-12/+2
| | | | | | | 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
* we don't need broadcast for the classful network AND broadcast for thehenning2010-01-131-4/+1
| | | | | subnet of the classful network. at least, not since 1992. ok mpf dlg bob
* instead of fiddling with the per-interface address lists directly inhenning2010-01-131-4/+3
| | | | | many places create a proper API (ifa_add / ifa_del) and use it. ok theo ryan dlg
* let's admit it's not 1992 any more. CIDR is around for a long time, evenhenning2010-01-131-24/+17
| | | | | | | | | | | 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
* rtables are stacked on rdomains (it is possible to have multiple routingclaudio2009-11-031-1/+2
| | | | | | | | | | | | | | 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@
* Initial support for routing domains. This allows to bind interfaces toclaudio2009-06-051-5/+14
| | | | | | | | | alternate routing table and separate them from other interfaces in distinct routing tables. The same network can now be used in any doamin at the same time without causing conflicts. This diff is mostly mechanical and adds the necessary rdomain checks accross net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6. input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@
* Introduce splsoftassert(), similar to splassert() but for soft interruptmiod2009-03-151-2/+2
| | | | | | levels. This will allow for platforms where soft interrupt levels do not map to real hardware interrupt levels to have soft ipl values overlapping hard ipl values without breaking spl asserts.
* adderss -> addressmiod2008-06-041-2/+2
|
* Last of the really easy bzero() -> M_ZERO. Use 'p = malloc(sizeof(*p) ...'krw2007-10-011-4/+2
| | | | where obvious.
* remove backpointer from ifa to ifp if an address gets delete; fixesmarkus2007-09-171-1/+3
| | | | panics in ip_freemoptions(); ok claudio, henning, mpf
* Remove inm_ifp from struct in_multi -- caching struct ifnet is dangerousclaudio2007-07-201-2/+1
| | | | | | | because interfaces may disappear without notice causing use after free bugs. Instead use the inm_ia->ia_ifp as a hint, struct in_ifaddr correctly tracks removals of interfaces and invalidates ia_ifp in such cases. looks good henning@ markus@
* Fix a use after free crash in in_delmulti(). If a interface is detachedclaudio2007-07-041-9/+13
| | | | | | | | | | before it is removed from the multicast group in_delmulti() will try to access the no longer available ifp. We invalidate the ifa_ifp back pointer in the ifa in if_detach() now and use the ifa_ifp in in_delmulti() instead of the internal inm_ifp. By doing it this way we know if the interface was removed. This fixes a kernel panic triggered by ospfd and gif(4) tunnels. looks good henning@ reyk@
* thou shalt not use static in the kerneldlg2007-05-271-11/+11
|
* Consistently spell FALLTHROUGH to appease lint.jsg2007-02-141-2/+2
| | | | ok kettenis@ cloder@ tom@ henning@
* move local network route to real interface instead of carp interface; from mpf@markus2007-01-021-5/+19
|
* Use more queue macros rather than doing it by hand; ok otto@ krw@miod2006-03-051-18/+19
|
* With the exception of two other small uncommited diffs this movesbrad2006-03-041-2/+2
| | | | | | the remainder of the network stack from splimp to splnet. ok miod@
* Fix a panic reported by D.Snezhkov by issuing an ifconfig command withclaudio2006-02-211-1/+2
| | | | | | -alias and netmask used at the same time. This resulted in a corrupted routing table and a panic in rn_walktree after the interface was destroyed. OK krw@ henning@
* Hold a reference to the relevant struct in_ifaddr while a multicast addresspascoe2005-06-031-1/+4
| | | | | | is bound on the interface. ok mcbride@ henning@
* Correctly compare routes in in_addprefix. If a netmask is supplied it needsclaudio2005-03-071-7/+9
| | | | | | to be compared too -- 10/8 and 10/24 are not equal. This fixes a problem with overlapping networks reported by Simon Slaytor. OK henning@
* From NetBSD:pascoe2005-01-151-6/+7
| | | | | | | | | | - Keep track of allhost multicast address record we joined into each in_ifaddr and delete it when an address is purged. - Don't simply try to delete a multicast address record listed in the ia_multiaddrs. It results a dangling pointer. Let whoever holds a reference to it to delete it. mcbride@ markus@ ok
* for loopback, set ia_dstaddr instead of ia_ifa.ifa_dstaddr in in_ifinit()dhartmei2004-11-181-2/+2
| | | | | found by Ruslan Ermilov, ok markus@ http://marc.theaimsgroup.com/?l=freebsd-net&m=110072900204253
* Don't allow SIOCGET{VIF,SG}CNT from sockets other than the multicast router.brad2004-08-241-2/+2
| | | | | | | From NetBSD Fixes PR 3825 ok mcbride@ canacar@ claudio@
* When in_ifinit fails and we've created a new address, clean it up beforemcbride2004-06-211-2/+13
| | | | | | returning. ok markus@
* clean some copy&paste leftovers from KAME code.mpf2004-05-311-4/+4
| | | | ok markus, itojun.
* memory leak fix; from pat, via tedu, ok dhartmeideraadt2004-03-281-2/+7
|
* de-register. deraadt okitojun2003-12-101-18/+18
|
* install host route for p2p interface even if there's connected net routeitojun2003-06-231-19/+17
| | | | by broadcast interface. NetBSD PR 21903. markus ok
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Prevent packet processing while tweaking address and routing tables.henric2002-10-041-1/+28
| | | | ok art@
* KNF - return is not a function. sync w/kameitojun2002-09-111-2/+2
|
* - Add a flags argument to dohooks.art2002-07-121-4/+4
| | | | | | | | | | | | | | | | The flag can be either HOOK_REMOVE or HOOK_REMOVE|HOOK_FREE. o HOOK_REMOVE removes the hook from the list before executing it. o HOOK_FREE frees the hook after that. - Let dostartuphooks use HOOK_REMOVE|HOOK_FREE so we can reclaim the memory. - Let doshutdownhooks use HOOK_REMOVE so that when some shutdown hook panics (they do that all the #@$%! time these days) we don't loop for ever. Don't HOOK_FREE, it doesn't matter and I don't want to add another possible panic condition for shutdown hooks. - Actually free the pointer we're throwing away in hook_disestablish (I wonder how much memory this has leaked over the years).
* whitespaceitojun2002-06-091-3/+3
|
* Add hooks to struct ifnet that allow to register callbacks that will bedhartmei2002-04-241-1/+6
| | | | notified of interface address changes. ok provos@, angelos@
* cleanup in_broadcast. don't consider /32 addrs as broadcast.itojun2002-04-011-36/+27
|
* First round of __P removal in sysmillert2002-03-141-7/+7
|
* KNFderaadt2001-11-241-2/+2
|