summaryrefslogtreecommitdiffhomepage
path: root/src/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/socket.c b/src/socket.c
index 7de45b9..8eefa87 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -36,13 +36,14 @@ static inline int send4(struct wireguard_device *wg, struct sk_buff *skb, struct
rcu_read_lock_bh();
sock = rcu_dereference_bh(wg->sock4);
- fl.fl4_sport = inet_sk(sock)->inet_sport;
if (unlikely(!sock)) {
ret = -ENONET;
goto err;
}
+ fl.fl4_sport = inet_sk(sock)->inet_sport;
+
if (cache)
rt = dst_cache_get_ip4(cache, &fl.saddr);
@@ -107,13 +108,14 @@ static inline int send6(struct wireguard_device *wg, struct sk_buff *skb, struct
rcu_read_lock_bh();
sock = rcu_dereference_bh(wg->sock6);
- fl.fl6_sport = inet_sk(sock)->inet_sport;
if (unlikely(!sock)) {
ret = -ENONET;
goto err;
}
+ fl.fl6_sport = inet_sk(sock)->inet_sport;
+
if (cache)
dst = dst_cache_get_ip6(cache, &fl.saddr);