| .. | .. |
|---|
| 49 | 49 | rt = dst_cache_get_ip4(cache, &fl.saddr); |
|---|
| 50 | 50 | |
|---|
| 51 | 51 | if (!rt) { |
|---|
| 52 | | - security_sk_classify_flow(sock, flowi4_to_flowi(&fl)); |
|---|
| 52 | + security_sk_classify_flow(sock, flowi4_to_flowi_common(&fl)); |
|---|
| 53 | 53 | if (unlikely(!inet_confirm_addr(sock_net(sock), NULL, 0, |
|---|
| 54 | 54 | fl.saddr, RT_SCOPE_HOST))) { |
|---|
| 55 | 55 | endpoint->src4.s_addr = 0; |
|---|
| .. | .. |
|---|
| 129 | 129 | dst = dst_cache_get_ip6(cache, &fl.saddr); |
|---|
| 130 | 130 | |
|---|
| 131 | 131 | if (!dst) { |
|---|
| 132 | | - security_sk_classify_flow(sock, flowi6_to_flowi(&fl)); |
|---|
| 132 | + security_sk_classify_flow(sock, flowi6_to_flowi_common(&fl)); |
|---|
| 133 | 133 | if (unlikely(!ipv6_addr_any(&fl.saddr) && |
|---|
| 134 | 134 | !ipv6_chk_addr(sock_net(sock), &fl.saddr, NULL, 0))) { |
|---|
| 135 | 135 | endpoint->src6 = fl.saddr = in6addr_any; |
|---|
| .. | .. |
|---|
| 160 | 160 | rcu_read_unlock_bh(); |
|---|
| 161 | 161 | return ret; |
|---|
| 162 | 162 | #else |
|---|
| 163 | + kfree_skb(skb); |
|---|
| 163 | 164 | return -EAFNOSUPPORT; |
|---|
| 164 | 165 | #endif |
|---|
| 165 | 166 | } |
|---|
| .. | .. |
|---|
| 241 | 242 | endpoint->addr4.sin_addr.s_addr = ip_hdr(skb)->saddr; |
|---|
| 242 | 243 | endpoint->src4.s_addr = ip_hdr(skb)->daddr; |
|---|
| 243 | 244 | endpoint->src_if4 = skb->skb_iif; |
|---|
| 244 | | - } else if (skb->protocol == htons(ETH_P_IPV6)) { |
|---|
| 245 | + } else if (IS_ENABLED(CONFIG_IPV6) && skb->protocol == htons(ETH_P_IPV6)) { |
|---|
| 245 | 246 | endpoint->addr6.sin6_family = AF_INET6; |
|---|
| 246 | 247 | endpoint->addr6.sin6_port = udp_hdr(skb)->source; |
|---|
| 247 | 248 | endpoint->addr6.sin6_addr = ipv6_hdr(skb)->saddr; |
|---|
| .. | .. |
|---|
| 284 | 285 | peer->endpoint.addr4 = endpoint->addr4; |
|---|
| 285 | 286 | peer->endpoint.src4 = endpoint->src4; |
|---|
| 286 | 287 | peer->endpoint.src_if4 = endpoint->src_if4; |
|---|
| 287 | | - } else if (endpoint->addr.sa_family == AF_INET6) { |
|---|
| 288 | + } else if (IS_ENABLED(CONFIG_IPV6) && endpoint->addr.sa_family == AF_INET6) { |
|---|
| 288 | 289 | peer->endpoint.addr6 = endpoint->addr6; |
|---|
| 289 | 290 | peer->endpoint.src6 = endpoint->src6; |
|---|
| 290 | 291 | } else { |
|---|
| .. | .. |
|---|
| 308 | 309 | { |
|---|
| 309 | 310 | write_lock_bh(&peer->endpoint_lock); |
|---|
| 310 | 311 | memset(&peer->endpoint.src6, 0, sizeof(peer->endpoint.src6)); |
|---|
| 311 | | - dst_cache_reset(&peer->endpoint_cache); |
|---|
| 312 | + dst_cache_reset_now(&peer->endpoint_cache); |
|---|
| 312 | 313 | write_unlock_bh(&peer->endpoint_lock); |
|---|
| 313 | 314 | } |
|---|
| 314 | 315 | |
|---|
| .. | .. |
|---|
| 430 | 431 | if (new4) |
|---|
| 431 | 432 | wg->incoming_port = ntohs(inet_sk(new4)->inet_sport); |
|---|
| 432 | 433 | mutex_unlock(&wg->socket_update_lock); |
|---|
| 433 | | - synchronize_rcu(); |
|---|
| 434 | + synchronize_net(); |
|---|
| 434 | 435 | sock_free(old4); |
|---|
| 435 | 436 | sock_free(old6); |
|---|
| 436 | 437 | } |
|---|