~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/netfilter/utils.c

Version: ~ [ linux-5.16-rc1 ] ~ [ linux-5.15.2 ] ~ [ linux-5.14.18 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.79 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.159 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.217 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.255 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.290 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.292 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include <linux/kernel.h>
  2 #include <linux/netfilter.h>
  3 #include <linux/netfilter_ipv4.h>
  4 #include <linux/netfilter_ipv6.h>
  5 #include <net/netfilter/nf_queue.h>
  6 
  7 __sum16 nf_checksum(struct sk_buff *skb, unsigned int hook,
  8                     unsigned int dataoff, u_int8_t protocol,
  9                     unsigned short family)
 10 {
 11         const struct nf_ipv6_ops *v6ops;
 12         __sum16 csum = 0;
 13 
 14         switch (family) {
 15         case AF_INET:
 16                 csum = nf_ip_checksum(skb, hook, dataoff, protocol);
 17                 break;
 18         case AF_INET6:
 19                 v6ops = rcu_dereference(nf_ipv6_ops);
 20                 if (v6ops)
 21                         csum = v6ops->checksum(skb, hook, dataoff, protocol);
 22                 break;
 23         }
 24 
 25         return csum;
 26 }
 27 EXPORT_SYMBOL_GPL(nf_checksum);
 28 
 29 __sum16 nf_checksum_partial(struct sk_buff *skb, unsigned int hook,
 30                             unsigned int dataoff, unsigned int len,
 31                             u_int8_t protocol, unsigned short family)
 32 {
 33         const struct nf_ipv6_ops *v6ops;
 34         __sum16 csum = 0;
 35 
 36         switch (family) {
 37         case AF_INET:
 38                 csum = nf_ip_checksum_partial(skb, hook, dataoff, len,
 39                                               protocol);
 40                 break;
 41         case AF_INET6:
 42                 v6ops = rcu_dereference(nf_ipv6_ops);
 43                 if (v6ops)
 44                         csum = v6ops->checksum_partial(skb, hook, dataoff, len,
 45                                                        protocol);
 46                 break;
 47         }
 48 
 49         return csum;
 50 }
 51 EXPORT_SYMBOL_GPL(nf_checksum_partial);
 52 
 53 int nf_route(struct net *net, struct dst_entry **dst, struct flowi *fl,
 54              bool strict, unsigned short family)
 55 {
 56         const struct nf_ipv6_ops *v6ops;
 57         int ret = 0;
 58 
 59         switch (family) {
 60         case AF_INET:
 61                 ret = nf_ip_route(net, dst, fl, strict);
 62                 break;
 63         case AF_INET6:
 64                 v6ops = rcu_dereference(nf_ipv6_ops);
 65                 if (v6ops)
 66                         ret = v6ops->route(net, dst, fl, strict);
 67                 break;
 68         }
 69 
 70         return ret;
 71 }
 72 EXPORT_SYMBOL_GPL(nf_route);
 73 
 74 int nf_reroute(struct sk_buff *skb, struct nf_queue_entry *entry)
 75 {
 76         const struct nf_ipv6_ops *v6ops;
 77         int ret = 0;
 78 
 79         switch (entry->state.pf) {
 80         case AF_INET:
 81                 ret = nf_ip_reroute(skb, entry);
 82                 break;
 83         case AF_INET6:
 84                 v6ops = rcu_dereference(nf_ipv6_ops);
 85                 if (v6ops)
 86                         ret = v6ops->reroute(skb, entry);
 87                 break;
 88         }
 89         return ret;
 90 }
 91 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp