Debian Codegraph @

drivers/net/ovpn-dco/addr.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* OpenVPN data channel accelerator
3 *
4 * Copyright (C) 2020- OpenVPN, Inc.
5 *
6 * Author: James Yonan <[email protected]>
7 * Antonio Quartulli <[email protected]>
8 */
9
10 #ifndef _NET_OVPN_DCO_OVPNADDR_H_
11 #define _NET_OVPN_DCO_OVPNADDR_H_
12
13 #include "crypto.h"
14
15 #include <linux/jhash.h>
16 #include <linux/in.h>
17 #include <linux/in6.h>
18 #include <net/ipv6.h>
19
20 /* our basic transport layer address */
21 struct ovpn_sockaddr {
22 union {
23 struct sockaddr_in in4;
24 struct sockaddr_in6 in6;
25 };
26 };
27
28 /* Translate skb->protocol value to AF_INET or AF_INET6 */
29 static inline unsigned short skb_protocol_to_family(const struct sk_buff *skb)
30 {
31 switch (skb->protocol) {
32 case htons(ETH_P_IP):
33 return AF_INET;
34 case htons(ETH_P_IPV6):
35 return AF_INET6;
36 default:
37 return 0;
38 }
39 }
40
41 #endif /* _NET_OVPN_DCO_OVPNADDR_H_ */