summaryrefslogtreecommitdiff
path: root/sys/net
AgeCommit message (Collapse)Author
2015-12-09Do not trigger a KASSERT() if the route we're trying to remove does notMartin Pieuchot
exist and we get another matching one instead. This bug has been here since the KAME area and recently exposed by a refactoring at n2k15. The problem is that rtrequest(9) does not check on which interface the route entry is attached when issuing a RTM_DELETE. So the kernel would end up deleting the route attached on a different ifp when in_ifinit() fails. This fix is currently a workaround, a better fix is in the pipeline. Reported by Laurence Tratt <laurie AT tratt DOT net>, thanks!
2015-12-09Do not trigger a KASSERT() when destroying/detaching an interface withMartin Pieuchot
RTF_CLONED routes attached. In thise case if_get(9) can return NULL inside rtflushclone1() because ifdetach() starts by clearing the interface pointer in the index map. So it is perfectly correct to bail and we're not going to leak any route entry because we're garbage collecting all of them. Reported by daniel@ and Aaron Miller <aaron DOT miller04 AT gmail DOT com>
2015-12-09rework the if_start mpsafe serialisation so it can serialise arbitrary workDavid Gwynne
work is represented by struct task. the start routine is now wrapped by a task which is serialised by the infrastructure. if_start_barrier has been renamed to ifq_barrier and is now implemented as a task that gets serialised with the start routine. this also adds an ifq_restart() function. it serialises a call to ifq_clr_oactive and calls the start routine again. it exists to avoid a race that kettenis@ identified in between when a start routine discovers theres no space left on a ring, and when it calls ifq_set_oactive. if the txeof side of the driver empties the ring and calls ifq_clr_oactive in between the above calls in start, the queue will be marked oactive and the stack will never call the start routine again. by serialising the ifq_set_oactive call in the start routine and ifq_clr_oactive calls we avoid that race. tested on various nics ok mpi@
2015-12-08vlan doenst have to handle SIOCGIFADDR cos the stack does it.David Gwynne
ok mpi@
2015-12-08Kill unused iftxlist.Martin Pieuchot
ok dlg@
2015-12-08if_stop is unused, so kill it.David Gwynne
ok mpi@
2015-12-08split the interface send queue (struct ifqueue) implementation out.David Gwynne
the intention is to make it more clear what belongs to a transmit queue and what belongs to an interface. suggested by and ok mpi@
2015-12-06g/c pf_change_a6(). it's exactly the same thing as pf_change_ap() with p =Henning Brauer
NULL. inspired by Richard Procter <richard.n.procter@gmail.com>'s mail on tech from Aug 17, but redone. ok sashan vgross
2015-12-05Multiple cleanups.Martin Pieuchot
ok goda@, yasuoka@
2015-12-05g/c unneeded af (address family) params to pf_change_ap and _icmpHenning Brauer
both af and naf (af-to case) are in the pf_pdesc some code shuffling to actually set these before calling pf_change_ap/_icmp inspired by Richard Procter <richard.n.procter@gmail.com>'s mail on tech from Aug 17, but redone ok bluhm vgross
2015-12-05avoid an ugly wrap in a commentTheo de Raadt
2015-12-05Keep kernel definitions under _KERNEL to unbreak ports that includeMartin Pieuchot
<net/if_var.h> because some other operating systems have defines in there. ok jasper@
2015-12-05Make pppx pass packets with npppd through the device. This makes pppx workYASUOKA Masahiko
without pipex.enable=1. Also fix tun(4) not to pass the packets to pipex when pipex.enable=0. "go for it" dlg
2015-12-05pass a pointer to pf_test()'s reason to pf_test_rule instead of using aHenning Brauer
local one. While we always intended to keep the logging in pf_test_rule and pf_test so seperate that we don't end up with a wrong reason, this is just too fragile and I can't even convince myself that it still is right. pointed out by markus, ok bluhm benno
2015-12-05remove old lint annotationsTed Unangst
2015-12-04Reduce the stride length of the tables by two and use a single pageMartin Pieuchot
allocator for the 4K heap. In this configuration a fullfeed BGP server for v4 and v6 consumes 10M more than with the radix tree. This double the depth of the tree and makes the lookup slower. But the ratio speed/memory can be adjusted in the future, for now we are interested in a lock-free route lookup. Tested by and ok benno@
2015-12-04Move the KERNEL_LOCK from rt_match() to rtable_match().Martin Pieuchot
ok claudio@
2015-12-04Reject input when either the version is wrong or the pad is non-zero;Reyk Floeter
not when the version is wrong and the pad is non-zero. OK goda@
2015-12-04Grab the KERNEL_LOCK() around bridge_output().Martin Pieuchot
It is now safe to call if_enqueue() without holding the KERNEL_LOCK() even on an interface part of a bridge(4). ok dlg@, henning@, kettenis@
2015-12-04bridge(4) never outputs packets so set its if_output and if_start to NULL.Martin Pieuchot
bridge_output() is used by the stack to duplicate a packet coming from a bridge member to its other ports. Confusion pointed by Momtchil Momtchev on misc@ ok reyk@
2015-12-03Get rid of rt_mask() and stop allocating a "struct sockaddr" for everyMartin Pieuchot
route entry in ART. rt_plen() now represents the prefix length of a route entry and should be used instead. For now use a "struct sockaddr_in6" to represent the mask when needed, this should be then replaced by the prefix length and RTA_NETMASK only used for compatibility with userland. ok claudio@
2015-12-03ip_send()/ip6_send() allow PF to send response packet in ipsoftnet task.Alexandr Nedvedicky
this avoids current recursion to pf_test() function. the change also switches icmp_error()/icmp6_error() to use ip_send()/ip6_send() so they are safe for PF. The idea comes from Markus Friedl. bluhm, mikeb and mpi helped me a lot to get it into shape. OK bluhm@, mpi@
2015-12-03When enqueuing a mbuf chain, take the top instead of the lastAlexander Bluhm
element. Otherwise the kernel paniced with "ipintr no HDR" if the data passed to pppxwrite() had a certain length. Bug reported and fix tested by Sevan / Venture37. Debugged with and OK mikeb@
2015-12-03Use SRPL_HEAD() and SRPL_ENTRY() to be consistent with and allow toMartin Pieuchot
fallback to a SLIST. ok dlg@, jasper@
2015-12-03Remove broadcast matching from ifa_ifwithaddr(), use in_broadcast() whereVincent Gross
required. ok bluhm@ mpi@.
2015-12-03ANSIfy function definitionsBret Lambert
no change in .o file checksum ok claudio@
2015-12-03Remove unused ``rt_tableid'' field from "struct rtentry".Martin Pieuchot
This reduces the size of the structure by 8 bytes on amd64 now that we are using an index instead of a pointer for reaching interfaces.
2015-12-03Store an interface index instead of a pointer in the "struct rtentry".Martin Pieuchot
These indexes are unique and should be used with if_get() to get a pointer to the corresponding ``ifp''. Such pointer is guaranteed to be valid in a MP environment until if_put() is called. ok claudio@, sthen@
2015-12-03To avoid that the stack manipules the pf statekeys directly, introduceAlexander Bluhm
pf_inp_...() lookup, link and unlink functions as an interface. Locking can be added to them later. Remove the first linking at the beginning of tcp_input() and udp_input() as it is not necessary. It will be done later anyway. That code was a relict, from the time before I had added the second linking. Input from mikeb@ and sashan@; OK sashan@
2015-12-03Add sizes to most free calls. OK sashan@ tedu@Claudio Jeker
2015-12-03Implement etherip(4) driverKazuya Goda
This commit is not removing the existing EtherIP part of gif(4) and it keeps EtherIP of gif(4) working. ok jbg@ sthen@ mpi@ reyk@ yasuoka@
2015-12-03remove nettxintr prototypeDavid Gwynne
2015-12-03rework if_start to allow nics to provide an mpsafe start routine.David Gwynne
existing start routines will still be called under the kernel lock and at IPL_NET. mpsafe start routines will be serialised so only one instance of each interfaces function will be running in the kernel at any point in time. this guarantees packets will be dequeued in order, and the start routines dont have to lock against themselves because if_start does it for them. the code to do that is based on the scsi runqueue code. this also provides an if_start_barrier() function that should wait until any currently running instances of if_start have finished. a driver can opt in to the mpsafe if_start call by doing the following: 1. setting ifp->if_xflags = IFXF_MPSAFE 2. only calling if_start() instead of its own start routine 3. clearing IFF_RUNNING before calling if_start_barrier() on its way down 4. only using IFQ_DEQUEUE (not ifq_deq_begin/commit/rollback) to simplify the implementation the tx mitigation code has been removed. tested by several ok mpi@ jmatthew@
2015-12-03allocate PF tags as M_RTABLE vice M_TEMPBret Lambert
ok henning@ claudio@
2015-12-03Rename pf_unlink_state() to pf_remove_state() so the name does notAlexander Bluhm
collide with the statekey to inp unlinking. OK sashan@ mpi@
2015-12-02rtable_delete() does not use its prio parameter, so delete it.Alexander Bluhm
OK mpi@
2015-12-02When destroying an interface, we have to wait until all referencesAlexander Bluhm
are not used anymore. This has to be done before any interface fields become invalid. As the route delete request cannot call if_get() anymore, pass down the interface. Split rtrequest_delete() into a separate function that may take an existing inteface. OK mpi@
2015-12-02- hide PF internals to pf_unlink_divert_state() from in_pcb.cAlexandr Nedvedicky
OK mpi@, bluhm@
2015-12-02Kill the RT_REPORT flag to rtalloc() and stop sending RTM_MISS messagesClaudio Jeker
for failed route lookups. This is something that was maybe useful in the 90is but in this modern times it is just annoying and nothing expect it anyway. OK mpi@, sthen@
2015-12-02remove unimplemented PF_KEY algorithms; ok sthen@ mpi@ mikeb@Christian Weisgerber
2015-12-02Respect priorities when inserting routes to the same destination in ART.Martin Pieuchot
2015-12-02allocate route labels as M_RTABLE instead of M_TEMPBret Lambert
ok claudio@, mpi@
2015-12-02Move multipath Hash-Threshold selection mechanism inside rtable_match().Martin Pieuchot
This will helps for unlocking the routing table and will prevent further mistake by keeping the multipath logic inside the rtable_* API. ok dlg@, claudio@
2015-12-02Rework the MPLS handling. Remove the lookup loops since nothing is usingClaudio Jeker
them and they make everything so much harder with no gain. Remove the ifp argument from mpls_input since it is not needed. On the input side the lookup side is modified a bit when it comes to BOS handling. Tested in a L3VPN setup with ldpd and bgpd. Commiting now so we can move on with cleaning up rt_ifp usage. If this breaks L2VPN I will fix it once reported. OK mpi@
2015-12-02Include cleanup.Martin Pieuchot
2015-12-02Remove forward declarations that are no longer needed, times and APIs areMartin Pieuchot
changing.
2015-12-01Kill redundant or unused arguments in rtredirect().Martin Pieuchot
ok bluhm@
2015-12-01Split functions in if_bridge.c into if_bridge.c bridgectl.c .Kazuya Goda
Splitting functions in if_bridge.c into if_bridge.c for the forwarding part and bridgectl.c for the control part. It shouldn't have any functional change. ok reyk@ mpi@ yasuoka@
2015-12-01Iterating on &ifnet should only be done with the KERNEL_LOCK held.Vincent Gross
With input and ok mpi@.
2015-12-01Fix bridge to forward broadcast/multicast frames from gif.Kazuya Goda
ok reyk@ mpi@ yasuoka@