summaryrefslogtreecommitdiff
path: root/sys/net/if_vxlan.c
AgeCommit message (Collapse)Author
2019-11-08convert interface address change hooks to tasks and a task_list.David Gwynne
this follows what's been done for detach and link state hooks, and makes handling of hooks generally more robust. address hooks are a bit different to detach/link state hooks in that there's only a few things that register hooks (carp, pf, vxlan), but a lot of places to run the hooks (lots of ipv4 and ipv6 address configuration). an address hook cookie was in struct pfi_kif, which is part of the pf abi. rather than break pfctl -sI, this maintains the void * used for the cookie and uses it to store a task, which is then used as intended with the new api.
2019-11-07turn the linkstate hooks into a task list, like the detach hooks.David Gwynne
this is largely mechanical, except for carp. this moves the addition of the carp link state hook after we're committed to using the new interface as a carpdev. because the add can't fail, we avoid a complicated unwind dance. also, this tweaks the carp linkstate hook so it only updates the relevant carp interface, not all of the carpdevs on the parent. hrvoje popovski has tested an early version of this diff and it's generally ok, but there's some splasserts that this diff fires that i'll fix in an upcoming diff. ok claudio@
2019-11-06replace the hooks used with if_detachhooks with a task list.David Gwynne
the main semantic change is that things registering detach hooks have to allocate and set a task structure that then gets added to the list. this means if the task is allocated up front (eg, as part of carps softc or bridges port structure), it avoids the possibility that adding a hook can fail. a lot of drivers weren't checking for failure, and unwinding state in the event of failure in other parts was error prone. while doing this i discovered that the list operations have to be in a particular order, but drivers weren't doing that consistently either. this diff wraps the list ops up so you have to seriously go out of your way to screw them up. ive also sprinkled some NET_ASSERT_LOCKED around the list operations so we can make sure there's no potential for the list to be corrupted, especially while it's being run. hrvoje popovski has tested this a bit, and some issues he discovered have been fixed. ok sashan@
2019-06-10Use mallocarray(9) & put some free(9) sizes for M_IPMOPTS allocations.Martin Pieuchot
ok semarie@, visa@
2019-04-28Removes the KERNEL_LOCK() from bridge(4)'s output fast-path.Martin Pieuchot
This redefines the ifp <-> bridge relationship. No lock can be currently used across the multiples contexts where the bridge has tentacles to protect a pointer, use an interface index. Tested by various, ok dlg@, visa@
2019-04-23a first cut at converting some virtual ethernet interfaces to if_vinputDavid Gwynne
this let's input processing bypass ifiqs. there's a performance benefit from this, and it will let me tweak the backpressure detection mechanism that ifiqs use without impacting on a stack of virtual interfaces. ive tested all of these except mpw, which i will end up testing soon anyway.
2018-12-03Convert more MH_ALIGN() to m_align(). Also switch from m_gethdr/M_GETHDRClaudio Jeker
calls to m_get/M_GET calls because M_MOVE_PKTHDR() is initialising the pkthdr and so it is not needed when allocation the header. OK bluhm@
2018-11-15add support for txprio configurationDavid Gwynne
2018-08-17the stack already counts bytes and packets, so don't do it again here.David Gwynne
makes output stats look plausible. reported by jason tubnor ok deraadt@
2018-02-20add support for setting the tunnel df bit.David Gwynne
ok mpi@
2018-01-22Do not call ip_output() recursively in vxlan_start().Martin Pieuchot
ip_output() currently needs the NET_LOCK() which is not held when an interface is added to a pf(4) queue. Fix an issue reported by Jason Tubnor, ok dlg@
2018-01-09Creating a cloned interface could return ENOMEM due to temporaryAlexander Bluhm
memory shortage. As it is invoked from a system call, it should not fail and wait instead. OK visa@ mpi@
2017-11-20Sprinkle some NET_ASSERT_LOCKED(), const and co to prepare runningMartin Pieuchot
pr_input handlers without KERNEL_LOCK(). ok visa@
2017-10-25Remove Multicast and Broadcast flags from the encapsulated packet inMartin Pieuchot
vxlan(4) like it is done by other tunnelling pseudo-interfaces. While here sync the comment between multiple interfaces. Bug report and original diff from Pierre LALET.
2017-08-11Remove NET_LOCK()'s argument.Martin Pieuchot
Tested by Hrvoje Popovski, ok bluhm@
2017-08-10A missing break in vxlan_sockaddr_cmp() could eventually trick anReyk Floeter
vxlan interface into accepting packets for the wrong destination (if the sockaddr_in6 checks somehow match on sockaddr_in addresses). Coverity CID 1452902; Severity: Moderate OK mikeb@
2017-05-04Introduce sstosa() for converting sockaddr_storage with a type safeAlexander Bluhm
inline function instead of casting it to sockaddr. While there, use inline instead of __inline for all these conversions. Some struct sockaddr casts can be avoided completely. OK dhill@ mpi@
2017-04-11Partially revert previous mallocarray conversions that containDavid Hill
constants. The consensus is that if both operands are constant, we don't need mallocarray. Reminded by tedu@ ok deraadt@
2017-04-09Use mallocarray to allocate multicast group memberships.David Hill
ok deraadt@
2017-01-22move counting if_opackets next to counting if_obytes in if_enqueue.David Gwynne
this means packets are consistently counted in one place, unlike the many and various ways that drivers thought they should do it. ok mpi@ deraadt@
2017-01-04As noticed by bluhm@ the netlock is required for the multicast cleanupMike Belopuhov
While here, remove unnecessary splnet's. ok mpi
2017-01-03Don't try to reconfigure the multicast group in the detach handler ofReyk Floeter
the multicast interface - simply clear the VXLAN configuration when the associated multicast interface disappears. This fixes some locking and recursion problems. OK mpi@ mikeb@
2016-12-13make v6 tunnel address handling consider ipv6 scope.David Gwynne
an earlier version of this diff was ok mpi@
2016-12-02Rremoves 'struct route_in6 *' argument from in6_selectsrc().Martin Pieuchot
Move the corresponding code in in6_pcbselsrc(). This reduces differences with IPv4 and will help us to get rid of 'struct route*'. ok vgross@
2016-11-29For virtual Ethernet drivers that don't have a technical limit of theReyk Floeter
hardmtu, pick a value of 65435 that leaves space for some encapsulation and almost a complete max-IP packet. After some discussion we picked this arbitrary value. OK dlg@
2016-10-25Make kernel without INET6 compile again.Alexander Bluhm
OK mikeb@
2016-10-14Fulfil our contractual obligations with ether_inputMike Belopuhov
Since ether_input expects the m_data to point directly at the Ethernet header and most upper layer protocols immediately following Ethernet expect their headers to be aligned to the 4 byte boundary, we need to ensure that the decapsulated VXLAN packet payload satisfies these requirements. prompted by a diff by vgross@, with input from dlg@, ok yasuoka
2016-10-07Fix vxlan_lookup() to comply the assumption of ether_input(). Put theYASUOKA Masahiko
entire ethernet header on first mbuf and align 32bit at the payload. Also fix the vxlan_output() not to cause an alignment fault. Use a new mbuf for VXLAN header instead of M_PREPEND to make sure that the mbuf is aligned 32bit. This is required to align 32 bit at the outer IP header. input vgross mikeb ok dlg
2016-09-30Accept a packet smaller than ETHERMIN.YASUOKA Masahiko
ok reyk
2016-09-29Rename brtag_src/brtag_dst to brtag_peer/brtag_local to avoidReyk Floeter
confusion about the tunnel endpoints when responding to the peer. OK yasuoka@
2016-09-28Fix vxlan to use the destination address correctly.YASUOKA Masahiko
Use the dst of the bridge_tunneltag for src on vxlan output and vice versa. ok reyk
2016-09-28Fix the way of checking the length of vxlan packet and made it strict.YASUOKA Masahiko
ok reyk
2016-09-04Remove the IFF_LINK0 option to send the response back to the peer'sReyk Floeter
UDP src port - the VXLAN RFC clearly says that packet should be send to the configured VXLAN port (4789). OK mpi@
2016-09-03Add support for a multipoint-to-multipoint mode in vxlan(4). In thisReyk Floeter
mode, vxlan(4) must be configured to accept any virtual network identifier with "vnetid any" and added to a bridge(4) or switch(4). This way the driver will dynamically learn the tunnel endpoints and their vnetids for the responses and can be used to dynamically bridge between VXLANs. It is also being used in combination with switch(4) and the OpenFlow tunnel classifiers. With input from yasuoka@ goda@ OK deraadt@ dlg@
2016-08-07whitespaceReyk Floeter
2016-08-07Define VXLAN_VNI_UNSET and VXLAN_VNI_MAX instead of using magic numbers.Reyk Floeter
No functional change.
2016-08-06Add support for IPv6 tunnel endpoints. This currently only works forReyk Floeter
unicast mode, multicast is not yet supported. ifconfig vxlan0 tunnel fd00::1 fd00::2 Roughly based on an earlier diff by goda@ OK yasuoka@
2016-08-06Fix multicast mode (destination is a multicast IP): the BCAST andReyk Floeter
MCAST flags have to be cleared from the mbuf after decapsulating packets. This fixes tunneled broadcast packets, eg. ARP. It used to work before the input path was changed the flags got cleared later in the stack. OK yasuoka@
2016-04-13We're always ready! So send IFQ_SET_READY() to the bitbucket.Martin Pieuchot
2016-01-22Drop packets whose VNI flag is not set and VNI is not zeroKazuya Goda
ok reyk@ yasuoka@
2016-01-14No need for a splnet() dance around IFQ_DEQUEUE() anymore.Martin Pieuchot
From David Hill, ok dlg@
2015-12-05remove old lint annotationsTed Unangst
2015-11-27Keep "struct vxlan_softc" private to prevent pulling more headers whenMartin Pieuchot
<net/if_vxlan.h> is included.
2015-10-25arp_ifinit() is no longer required.Martin Pieuchot
2015-10-23tweak the vnetid so it can be optional and therefore cleared/deleted.David Gwynne
the abstract vnetid is promoted to a uin32_t, and adds a SIOCDVNETID ioctl so it can be cleared. this is all because i set an assignment on implementing a virtual network interface and the students got confused when vnetid 0 didnt show up in ifconfig output. the vnetid in the vxlan(4) protocol is optional, but the current code confuses 0 with no vnetid being set. this makes it clear. ok reyk@ who also simplified my diff
2015-10-15Fix previous. The port number is not included in sc_src and it isYASUOKA Masahiko
checked already at beginning of the loop. ok reyk
2015-10-12dont need to do suser checks in ioctl paths cos if.c does them for us.David Gwynne
ok mikeb@ mpi@
2015-10-03When multiple vxlan interfaces are configured with same VNI, select theYASUOKA Masahiko
interface whose tunnel destination corresponded to the incoming packets' source address. ok reyk
2015-09-09if_put after the if_get.David Gwynne
ok mpi@ claudio@
2015-07-20Remove splassert(IPL_NET) from if_input().Martin Pieuchot
if_input() has been designed to be able to safely handle a batch of packets from physical drivers to the network stack. Most of these drivers have an interrupt routine executed at IPL_NET and the check made sense during the conversion. However we also want to re-enqueue packets with if_input() from the network stack currently running at IPL_SOFTNET. ok claudio@