1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _IP_SET_GETPORT_H
3 #define _IP_SET_GETPORT_H
4 
5 extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
6 				__be16 *port, u8 *proto);
7 
8 #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
9 extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
10 				__be16 *port, u8 *proto);
11 #else
12 static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
13 				       __be16 *port, u8 *proto)
14 {
15 	return false;
16 }
17 #endif
18 
19 extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src,
20 				__be16 *port);
21 
22 static inline bool ip_set_proto_with_ports(u8 proto)
23 {
24 	switch (proto) {
25 	case IPPROTO_TCP:
26 	case IPPROTO_SCTP:
27 	case IPPROTO_UDP:
28 	case IPPROTO_UDPLITE:
29 		return true;
30 	}
31 	return false;
32 }
33 
34 #endif /*_IP_SET_GETPORT_H*/
35