aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/socket.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* socket: satisfy sparseJason A. Donenfeld2017-09-151-2/+2
|
* socket: improve reply-to-src algorithmJason A. Donenfeld2017-08-231-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We store the destination IP of incoming packets as the source IP of outgoing packets. When we send outgoing packets, we then ask the routing table for which interface to use and which source address, given our inputs of the destination address and a suggested source address. This all is good and fine, since it means we'll successfully reply using the correct source address, correlating with the destination address for incoming packets. However, what happens when default routes change? Or when interface IP addresses change? Prior to this commit, after getting the response from the routing table of the source address, destination address, and interface, we would then make sure that the source address actually belonged to the outbound interface. If it didn't, we'd reset our source address to zero and re-ask the routing table, in which case the routing table would then give us the default IP address for sending that packet. This worked mostly fine for most purposes, but there was a problem: what if WireGuard legitimately accepted an inbound packet on a default interface using an IP of another interface? In this case, falling back to asking for the default source IP was not a good strategy, since it'd nearly always mean we'd fail to reply using the right source. So, this commit changes the algorithm slightly. Rather than falling back to using the default IP if the preferred source IP doesn't belong to the outbound interface, we have two checks: we make sure that the source IP address belongs to _some_ interface on the system, no matter which one (so long as it's within the network namespace), and we check whether or not the interface of an incoming packet matches the returned interface for the outbound traffic. If both these conditions are true, then we proceed with using this source IP address. If not, we fall back to the default IP address.
* global: use pointer to net_deviceJason A. Donenfeld2017-07-201-8/+8
| | | | | | DaveM prefers it to be this way per [1]. [1] http://www.spinics.net/lists/netdev/msg443992.html
* socket: styleJason A. Donenfeld2017-07-071-12/+3
|
* socket: the checkers distinguish between _bh and non _bhJason A. Donenfeld2017-07-061-1/+1
|
* global: cleanup IP header checkingJason A. Donenfeld2017-06-261-2/+2
| | | | This way is more correct and ensures we're within the skb head.
* socket: use ip_rt_put instead of dst_releaseJason A. Donenfeld2017-06-261-2/+2
|
* socket: verify saddr belongs to interfaceJason A. Donenfeld2017-06-261-1/+4
| | | | | This helps "unstick" stuck source addresses, when changing routes dynamically.
* debug: print interface name in dmesgJason A. Donenfeld2017-05-311-6/+6
|
* locking: always use _bhJason A. Donenfeld2017-04-041-7/+7
| | | | | All locks are potentially between user context and softirq, which means we need to take the _bh variant.
* socket: avoid deadlock on port retryJason A. Donenfeld2017-03-241-4/+3
|
* socket: do not try to create v6 socket when disabledJason A. Donenfeld2017-02-231-0/+2
|
* socket: enable setting of fwmarkJason A. Donenfeld2017-02-131-1/+2
|
* socket: general ephemeral ports instead of name-based portsJason A. Donenfeld2017-02-131-53/+16
|
* socket: synchronize net on socket tear downJason A. Donenfeld2017-02-071-0/+1
|
* Update copyrightJason A. Donenfeld2017-01-101-1/+1
|
* peer: don't use sockaddr_storage to reduce memory usageJason A. Donenfeld2016-12-131-10/+10
|
* global: move to consistent use of uN instead of uintN_t for kernel codeJason A. Donenfeld2016-12-111-6/+6
|
* socket: clear src address when retrying handshakeJason A. Donenfeld2016-12-091-0/+8
|
* headers: cleanup noticesJason A. Donenfeld2016-11-211-1/+1
|
* socket: ensure that saddr routing can deal with interface removalJason A. Donenfeld2016-11-151-0/+11
|
* socket: keep track of src address in sending packetsJason A. Donenfeld2016-11-151-50/+54
|
* socket: release dst on routing loopJason A. Donenfeld2016-11-061-0/+2
|
* socket: big refactoringJason A. Donenfeld2016-11-051-189/+166
|
* socket: route() returns an error pointer, not NULL on failureJason A. Donenfeld2016-11-041-2/+2
| | | | Reported-by: Cedric Buxin <cedric.buxin@izri.org>
* compat: stub out dst_cache for old kernelsJason A. Donenfeld2016-11-041-1/+0
|
* socket: use dst_cache instead of handrolled cacheJason A. Donenfeld2016-11-041-92/+59
|
* compat: Isolate more functionsJason A. Donenfeld2016-09-291-54/+1
|
* Rework headers and includesJason A. Donenfeld2016-09-291-1/+2
|
* send: properly encapsulate ECNJason A. Donenfeld2016-08-291-4/+4
| | | | We're not leaking the DSCP, but we do deal with ECN.
* socket: use isdigitJason A. Donenfeld2016-08-221-1/+2
|
* socket: fix compat for 4.1 v6 socketsJason A. Donenfeld2016-07-221-3/+9
| | | | | | | | It turns out 4.1 is even more broken than expected. While both 4.1 and 4.2 need to jigger the sysctl nob temporarily, it turns out that in 4.1 it's looking in the wrong namespace for the nob value. So, we have to account for the different namespace semantics in the different versions. Super ugly. But, all this code goes away once we upstream.
* socket: reset IPv4 socket to NULL after freeJason A. Donenfeld2016-07-211-0/+1
|
* socket: simpler debug messageJason A. Donenfeld2016-07-211-2/+2
|
* build system: revamp building and configurationJason A. Donenfeld2016-07-181-6/+21
|
* persistent keepalive: use authenticated keepalivesJason A. Donenfeld2016-07-101-6/+2
|
* persistent keepalive: add kernel mechanismJason A. Donenfeld2016-07-081-2/+6
|
* Initial commitJason A. Donenfeld2016-06-251-0/+479