summaryrefslogtreecommitdiff
path: root/sys/net
AgeCommit message (Collapse)Author
2015-07-07Do not return internal nodes to the upper layer in rn_lookup().Martin Pieuchot
The limit between the radix layer and the route layer is somewhat vague, if it exists at all. This changes prevent rtrequest1(9) to find and delete the root node (RNF_ROOT) when trying to delete a non-existing default route: # route delete 0.0.0.0 delete host 0.0.0.0 # route delete 0.0.0.0 route: writing to routing socket: No such process delete host 0.0.0.0: not in table Historically rn_delete() was a no-op when called with an internal node as argument. But there's no reason to manipulate such node. In a better world rn_match() would contain such check, but let's change the perfect-match function for the moment as this fixes a bug and many dragons are lurking in there. Fix a regression introduced by the big refactoring of r1.40 and reported by tobias@. ok tobias@, claudio@, pelikan@
2015-07-02most of the destinations for mbufs in ether_input are mpsafe except forDavid Gwynne
pipex and bridge. this puts KERNEL_LOCK/KERNEL_UNLOCK around the pipex chunk till we can give it some mp love. ok yasuoka@ mpi@
2015-07-02Move back rdomain's check into ether_output() otherwise it triggersMartin Pieuchot
if a pseudo-interface is on a different rdomain than its parent. Sorry for the inconvenience, I hope you'll fly again with us. Regression reported by and ok semarie@, ok phessler@
2015-07-02Unify the check for up & running between all pseudo-drivers.Martin Pieuchot
2015-07-02By design if_input_process() needs to hold a reference on the receivingMartin Pieuchot
ifp in order to access its ifih handlers. So get rid of if_get() in the various ifih handlers we know the ifp is live at this point. ok dlg@
2015-06-30Get rid of the undocumented & temporary* m_copy() macro added forMartin Pieuchot
compatibility with 4.3BSD in September 1989. *Pick your own definition for "temporary". ok bluhm@, claudio@, dlg@
2015-06-30Rename if_output() into if_enqueue() to avoid confusion with commentsMartin Pieuchot
talking about (*ifp->if_output)(). ok claudio@, dlg@
2015-06-30Move the specialized m_copym2() preserving the alignment of the payloadMartin Pieuchot
after the Ethernet header in its own function and use it in bridge_input(). This should fix alignment issues kettenis@ is seeing. ok bluhm@, claudio@
2015-06-29Never cache a RTF_GATEWAY route as next hop for a gateway route.Martin Pieuchot
This prevents rtentry loops when rt->rt_gwroute points to rt leading to an infamous "rtentry leak" panic, easily triggered by dhclient(8) trying to remove a route after resuming a machine. This bug is at least 20 years old! 4.4BSD-Lite2 had a fix for it in its X.25 output routine but apparently it never made it into OpenBSD. ok claudio@
2015-06-29count if_ibytes in if_input like we do for if_ipackets.David Gwynne
tweaks and ok mpi@
2015-06-25Properly deliver broadcast-like packets to the network stack.Martin Pieuchot
In bridge(4) speak, broadcast-like packets are Ethernet Multicast frames or Unicast for which the destination is unknown. It makes sense to not retransmit broadcast-like packets on the interface they were received but they still must be delivered to the network stack. Problem reported by and ok jasper@
2015-06-25No more NBRIDGE in the Ethernet layer. Fewer layer violation, say yeah!Martin Pieuchot
2015-06-25Move brige(4)'s output hook outside of ether_output().Martin Pieuchot
This fix some weird bridge(4) configurations involving pseudo-drivers stacked on top of interfaces in a bridge. Also simplifies the loop prevention logic to match bridge's input path. Instead of using a tag per port/bridge simply flag output mbufs to make sure only one copy per bridge go through bridge_output(). ok bluhm@, claudio@
2015-06-25Check for correct rdomain in if_output() rather than in ether_output().Martin Pieuchot
Not all drivers make use of ether_output() and there's no real reason to call it when no ARP resolution is needed. But in this case we still want to make sure we're sending packets in the correct rdomain. ok bluhm@, claudio@ as part of a larger diff.
2015-06-24Stop garbgage collecting mbufs from the ARP, IPv4 and IPv6 queues whenMartin Pieuchot
an interface is destroyed or removed. Since the introduction of ph_ifidx, as soon as a mbuf with an invalid interface index is dequeued it will be freed. ok claudio@, dlg@
2015-06-24Increment if_ipackets in if_input().Martin Pieuchot
Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
2015-06-23Pass a "struct ifnet *" instead of a "struct arpcom *" to arpresolve().Martin Pieuchot
Most of the ARP layer already take an ifp pointer and this makes clear wich chunks of code are messing with ac_enaddr. Note that our Ethernet code assume that these pointer are interchangeable since the first element of the "struct arpcom" is a "struct ifnet".
2015-06-23Adapt bridge(4) to the new if_input() framework.Martin Pieuchot
Move bridge_input() outside of ether_input() in order to duplicate packets flowing through a bridge port before applying any transformation on mbufs. This saves a various m_adj(9)/M_PREPEND(9) dances and remove the bridge(4) hack from vlan(4). Tested by mxb <mxb AT alumni DOT chalmers DOT se> and kettenis@ ok bluhm@
2015-06-22Increment rule counters only after successful state insertionMike Belopuhov
Do rule counter increments after state has been successfully installed. This has an additional benefit of making error handling a bit simpler. OK mpi, bluhm
2015-06-22rtrequest1(9) error code path cleanup.Martin Pieuchot
Pass the length to free(9), do not violate the radix/route layer and set the gateway of a route a bit later to simplify error code path. ok claudio@
2015-06-16Store a unique ID, an interface index, rather than a pointer to theMartin Pieuchot
receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
2015-06-15Fix a double free in the destroy path triggered when a second process,Martin Pieuchot
in my case dhclient(8), races with ifconfig(8) to free the descriptors of the joined multicast groups. While here reduce the difference with carp(4). ok dms@
2015-06-12Remove superfluous splnet() protection.Martin Pieuchot
ok lteo@
2015-06-11Move away from using hzto(9); OK dlgMike Belopuhov
2015-06-10Add missing include.Martin Pieuchot
2015-06-09Remove the hack to check if the received pointer has changed in an ifihMartin Pieuchot
now that all drivers and pseudo-drivers are using if_input(). if_input() is reentrant and is now the only place where we set `rcvif'.
2015-06-09Convert trunk(4) to if_input().Martin Pieuchot
ok dlg@
2015-06-08Merge multiple copies of the code doing VLAN tag insertion back intoMartin Pieuchot
vlan_start(). ok sthen@, phessler@
2015-06-08Move carp-related logic from ether_output() into carp_start().Martin Pieuchot
ok sthen@, phessler@
2015-06-07Introduce unhandled_af() for cases where code conditionally doesJonathan Gray
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@
2015-06-06Put the link-layer address back into the gateway field of RTF_LOCALMartin Pieuchot
routes. Since such routes are also flagged with RTF_LLINFO various code path assume correctly that they contain valid ARP or ND information. This fixes the "arpresolve: unresolved and rt_expire == 0" issue reported on tech@ by mxb <mxb AT alumni DOT chalmers DOT se>. ok claudio@, phessler@
2015-06-05Improve error handling and recovery during state insertionMike Belopuhov
Reshuffle the code around a bit and greatly improve error handling fixing a few bugs along the way. Problem reported by and fix was written with Alexandr Nedvedicky. OK henning
2015-06-03Adjust yielding condition slightly in the if_input_process thread.Mike Belopuhov
ok mpi, kettenis
2015-06-03Fix pf_map_addr() not to cause dividing by 0. This fixes problem whenYASUOKA Masahiko
using table or dynamic interface addresses for source-hash. Also avoid calling arc4random_uniform() with upper_bound == 0. ok mikeb
2015-06-03there's been a long standing issue in ppp on a tty/serial line where it ↵David Gwynne
allocates mbufs at IPL_SOFTTTY, which is above the IPL_NET the mbuf layer protects itself at. recent improvements to diagnostics in pools and mbufs now panic instead of letting these things silently corrupt. this reworks the ppp handling in the tty layer so it has its own private pool to allocate packet memory out of. these packets get built and then queued for softnet to process. softnet dequeues the packet and attaches it to mbufs as external storage before handing it on to the rest of the stack. this was reported on bugs@ and tested by both Walter Daugherity and Martin van den Nieuwelaar ok deraadt@ mpi@
2015-06-02RIP ether_input_mbuf().Martin Pieuchot
2015-06-02Use if_input() instead of ether_input_mbuf().Martin Pieuchot
ok jasper@, bluhm@
2015-06-02Take carp(4) out of ether_input().Martin Pieuchot
Tested by <mxb AT alumni DOT chalmers DOT se>, thanks! ok bluhm@, dlg@
2015-06-01Convert tun(4) to if_input().Martin Pieuchot
Tested by Norman Golisz and <mxb AT alumni DOT chalmers DOT se>, thanks! ok bluhm@
2015-05-28Kill unused IF_INPUT_ENQUEUE().Martin Pieuchot
ok dlg@
2015-05-27check if the packet is for us or if we're promisc before we cut theDavid Gwynne
vlan header out of the packet. fixes rx on top of trunks on top of nics that dont do hw vlan tagging. ok mpi@
2015-05-26Don't create ICMP states on reply packets unless tracking states sloppyMike Belopuhov
Since we've strengthened the ICMP state matching procedure during lookup to only match packets against states set up in a particular direction, we need to make sure we don't create states on packets that would otherwise be flowing in the direction opposite to the direction of the state and prevent further packets from matching the created state due to strict rules imposed by the ICMP direction check. Problem reported by Alexandr Nedvedicky, alexandr.nedvedicky-at-oracle.com. Discussed with reyk@; OK henning
2015-05-26Store the IP address of the corresponding ifa in the rt_gateway fieldMartin Pieuchot
of RTF_CLONING and RTF_BROASCAST routes to not create MPATH conflicts when IP address aliases are used. This change makes it possible to have multiple RTF_CLONING routes with the same priority. Note that any of the existing RTF_CLONING route might be used by the kernel to create a RTF_CLONED route which should not be a problem with aliases since they are attached to the same ifp. This unbreak address aliases since the kernel supports multiple connected routes for a subnet. Found the hardway by djm@, ok claudio@
2015-05-26Normalize route destination before checking for MPATH conflicts.Martin Pieuchot
This makes rt_mpath_conflict() work as expected when adding routes with the same destination and the same netmask. With and ok claudio@
2015-05-26Now that the Ethernet header is always passed as part of the mbuf, killMartin Pieuchot
the second (unused) argument of the input packet handlers. ok dlg@
2015-05-26move add_net_randomness from ether_input to the if_input task.David Gwynne
change it from feeding the ethertype of the packet (which is almost certainly an ip packet or vlan packet, so not that variable) to the number of packets about to be processed. ok deraadt@ mpi@
2015-05-26make vlans inherit their parents hardmtu as well as mtu.David Gwynne
from brad@ and tested locally.
2015-05-25fix panic for real and revert previous rev 1.52Sebastian Benoit
from markus@ sorry for the mixup
2015-05-25fix a panic in import_identities() in case the ID isnt loadedSebastian Benoit
(triggered by bgpd). ok marku@s, mikeb@
2015-05-23introduce ipsec-id bundles and use them for ipsecflowinfo,Markus Friedl
fixes rekeying for l2tp/ipsec against multiple windows clients and saves memory (for many SAs to same peers); feedback and ok mikeb@