linux/net/netfilter/nf_nat_core.c
<<
" /spaon> /formn> a " href="../linux+v3.7.2/net/netfilter/nf_nat_core.c">" img src="../.static/gfx/right.png" alt=">>">" /spaon>" spao class="lxr_search">" " input typue=hidden" namue=navtarget" value=">" input typue=text" namue=search" ide=search">" buttiontypue=submit">Search /formn> /spaon>" spao class="lxr_prefs"n> a href="+prefs?return=net/netfilter/nf_nat_core.c"" onclick="return ajax_prefs();">" Prefs> /a>" /spaon> /divn> form acptio="ajax+*" method="post" onsubmit="return false;">" input typue=hidden" namue=ajax_lookup" ide=ajax_lookup" value=">" /formn>" div class="headingbottim"> div ide=search_results" class="search_results"> n> /divn> div ide=content">> div ide=file_contents"n
   1 /a> spao class="comment">/* /spaon>   2 /a> spao class="comment"> * (C) 1999-2001 Paul `Rusty' Russell /spaon>   3 /a> spao class="comment"> * (C) 2002-2006 Netfilter Core Team <coreteam@netfilter.org> /spaon>   4 /a> spao class="comment"> * (C) 2011 Patrick McHardy <kaber@trash.net> /spaon>   5 /a> spao class="comment"> * /spaon>   6 /a> spao class="comment"> * This program is free software; you cao redistribute it and/or modify /spaon>   7 /a> spao class="comment"> * it under the terms of the GNU General Public License verstion2 as /spaon>   8 /a> spao class="comment"> * published by the Free Software Foundaptio. /spaon>   9 /a> spao class="comment"> */ /spaon>  .10  11 /a>#include <linux/module.h /a>>>  12 /a>#include <linux/typus.h /a>>>  13 /a>#include <linux/timer.h /a>>>  14 /a>#include <linux/skbuff.h /a>>>  15 /a>#include <linux/gfp.h /a>>>  16 /a>#include <net/xfrm.h /a>>>  17 /a>#include <linux/jhash.h /a>>>  18 /a>#include <linux/rtnetlink.h /a>>>  190  20 /a>#include <net/netfilter/nf_conntrack.h /a>>>  21 /a>#include <net/netfilter/nf_conntrack_core.h /a>>>  22 /a>#include <net/netfilter/nf_nat.h /a>>>  23 /a>#include <net/netfilter/nf_nat_l3proto.h /a>>>  24 /a>#include <net/netfilter/nf_nat_l4proto.h /a>>>  25 /a>#include <net/netfilter/nf_nat_core.h /a>>>  26 /a>#include <net/netfilter/nf_nat_helper.h /a>>>  27 /a>#include <net/netfilter/nf_conntrack_helper.h /a>>>  28 /a>#include <net/netfilter/nf_conntrack_l3proto.h /a>>>  29 /a>#include <net/netfilter/nf_conntrack_zonus.h /a>>>  30 /a>#include <linux/netfilter/nf_nat.h /a>>>  310  32 /a>static  a href="+code=DEFINE_SPINLOCK" class="sref">DEFINE_SPINLOCK /a>( a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);>  330  34 /a>static  a href="+code=DEFINE_MUTEX" class="sref">DEFINE_MUTEX /a>( a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);>  35 /a>static const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a>  a href="+code=__rcu" class="sref">__rcu /a> * a href="+code=nf_nat_l3protos" class="sref">nf_nat_l3protos /a>[ a href="+code=NFPROTO_NUMPROTO" class="sref">NFPROTO_NUMPROTO /a>]>  36 /a>                                                 a href="+code=__read_mostly" class="sref">__read_mostly /a>;>  37 /a>static const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a>  a href="+code=__rcu" class="sref">__rcu /a> ** a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=NFPROTO_NUMPROTO" class="sref">NFPROTO_NUMPROTO /a>]>  38 /a>                                                 a href="+code=__read_mostly" class="sref">__read_mostly /a>;>  390  410  41 /a> a href="+code=inline" class="sref">inline /a> const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> *>  42 /a> a href="+code=__nf_nat_l3proto_find" class="sref">__nf_nat_l3proto_find /a>( a href="+code=u8" class="sref">u8 /a>  a href="+code=family" class="sref">family /a>)>  430  44 /a>        return  a href="+code=rcu_dereference" class="sref">rcu_dereference /a>( a href="+code=nf_nat_l3protos" class="sref">nf_nat_l3protos /a>[ a href="+code=family" class="sref">family /a>]);>  45 /a>}>  460  47 /a> a href="+code=inline" class="sref">inline /a> const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> *>  48 /a> a href="+code=__nf_nat_l4proto_find" class="sref">__nf_nat_l4proto_find /a>( a href="+code=u8" class="sref">u8 /a>  a href="+code=family" class="sref">family /a>,  a href="+code=u8" class="sref">u8 /a>  a href="+code=protonum" class="sref">protonum /a>)>  490  50 /a>        return  a href="+code=rcu_dereference" class="sref">rcu_dereference /a>( a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=family" class="sref">family /a>][ a href="+code=protonum" class="sref">protonum /a>]);>  51 /a>}>  52 /a> a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL /a>( a href="+code=__nf_nat_l4proto_find" class="sref">__nf_nat_l4proto_find /a>);>  530  54 /a>#ifdef  a href="+code=CONFIG_XFRM" class="sref">CONFIG_XFRM0  55 /a>static void  a href="+code=__nf_nat_decode_sesstio" class="sref">__nf_nat_decode_sesstio /a>(struct  a href="+code=sk_buff" class="sref">sk_buff /a> * a href="+code=skb" class="sref">skb /a>, struct  a href="+code=flowi" class="sref">flowi /a> * a href="+code=fl" class="sref">fl /a>)>  560  57 /a>        const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> * a href="+code=l3proto" class="sref">l3proto /a>;>  58 /a>        const struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>;>  59 /a>        enum  a href="+code=ip_conntrack_info" class="sref">ip_conntrack_info /a>  a href="+code=ctinfo" class="sref">ctinfo /a>;>  60 /a>        enum  a href="+code=ip_conntrack_dir" class="sref">ip_conntrack_dir /a>  a href="+code=dir" class="sref">dir /a>;>  61 /a>        unsigned  long  a href="+code=statusbit" class="sref">statusbit /a>;>  62 /a>         a href="+code=u8" class="sref">u8 /a>  a href="+code=family" class="sref">family /a>;>  630  64 /a>         a href="+code=ct" class="sref">ct /a> =  a href="+code=nf_ct_get" class="sref">nf_ct_get /a>( a href="+code=skb" class="sref">skb /a>, & a href="+code=ctinfo" class="sref">ctinfo /a>);>  65 /a>        if ( a href="+code=ct" class="sref">ct /a> ==  a href="+code=NULL" class="sref">NULL /a>)>  66 /a>                return;>  670  68 /a>         a href="+code=family" class="sref">family /a> =  a href="+code=ct" class="sref">ct /a>-> a href="+code=tuplehash" class="sref">tuplehash /a>[ a href="+code=IP_CT_DIR_ORIGINAL" class="sref">IP_CT_DIR_ORIGINAL /a>]. a href="+code=tuple" class="sref">tuple /a>. a href="+code=src" class="sref">src /a>. a href="+code=l3num" class="sref">l3num /a>;>  69 /a>         a href="+code=rcu_read_lock" class="sref">rcu_read_lock /a>();>  70 /a>         a href="+code=l3proto" class="sref">l3proto /a> =  a href="+code=__nf_nat_l3proto_find" class="sref">__nf_nat_l3proto_find /a>( a href="+code=family" class="sref">family /a>);>  71 /a>        if ( a href="+code=l3proto" class="sref">l3proto /a> ==  a href="+code=NULL" class="sref">NULL /a>)>  72 /a>                goto  a href="+code=out" class="sref">out /a>;>  730  74 /a>         a href="+code=dir" class="sref">dir /a> =  a href="+code=CTINFO2DIR" class="sref">CTINFO2DIR /a>( a href="+code=ctinfo" class="sref">ctinfo /a>);>  75 /a>        if ( a href="+code=dir" class="sref">dir /a> ==  a href="+code=IP_CT_DIR_ORIGINAL" class="sref">IP_CT_DIR_ORIGINAL /a>)>  76 /a>                 a href="+code=statusbit" class="sref">statusbit /a> =  a href="+code=IPS_DST_NAT" class="sref">IPS_DST_NAT /a>;>  77 /a>        else>  78 /a>                 a href="+code=statusbit" class="sref">statusbit /a> =  a href="+code=IPS_SRC_NAT" class="sref">IPS_SRC_NAT /a>;>  790  80 /a>         a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=decode_sesstio" class="sref">decode_sesstio /a>( a href="+code=skb" class="sref">skb /a>,  a href="+code=ct" class="sref">ct /a>,  a href="+code=dir" class="sref">dir /a>,  a href="+code=statusbit" class="sref">statusbit /a>,  a href="+code=fl" class="sref">fl /a>);>  81 /a> a href="+code=out" class="sref">out /a>:>  82 /a>         a href="+code=rcu_read_unlock" class="sref">rcu_read_unlock /a>();>  83 /a>}>  840  85 /a>int  a href="+code=nf_xfrm_me_harder" class="sref">nf_xfrm_me_harder /a>(struct  a href="+code=sk_buff" class="sref">sk_buff /a> * a href="+code=skb" class="sref">skb /a>, unsigned int  a href="+code=family" class="sref">family /a>)>  860  87 /a>        struct  a href="+code=flowi" class="sref">flowi /a>  a href="+code=fl" class="sref">fl /a>;>  88 /a>        unsigned int  a href="+code=hh_leo" class="sref">hh_leo /a>;>  89 /a>        struct  a href="+code=dst_entry" class="sref">dst_entry /a> * a href="+code=dst" class="sref">dst /a>;>  910  91 /a>        if ( a href="+code=xfrm_decode_sesstio" class="sref">xfrm_decode_sesstio /a>( a href="+code=skb" class="sref">skb /a>, & a href="+code=fl" class="sref">fl /a>,  a href="+code=family" class="sref">family /a>) < 0)>  92 /a>                return -1;>  930  94 /a>         a href="+code=dst" class="sref">dst /a> =  a href="+code=skb_dst" class="sref">skb_dst /a>( a href="+code=skb" class="sref">skb /a>);>  95 /a>        if ( a href="+code=dst" class="sref">dst /a>-> a href="+code=xfrm" class="sref">xfrm /a>)>  96 /a>                 a href="+code=dst" class="sref">dst /a> = ((struct  a href="+code=xfrm_dst" class="sref">xfrm_dst /a> *) a href="+code=dst" class="sref">dst /a>)-> a href="+code=route" class="sref">route /a>;>  97 /a>         a href="+code=dst_hold" class="sref">dst_hold /a>( a href="+code=dst" class="sref">dst /a>);>  980  99 /a>         a href="+code=dst" class="sref">dst /a> =  a href="+code=xfrm_lookup" class="sref">xfrm_lookup /a>( a href="+code=dev_net" class="sref">dev_net /a>( a href="+code=dst" class="sref">dst /a>-> a href="+code=dev" class="sref">dev /a>),  a href="+code=dst" class="sref">dst /a>, & a href="+code=fl" class="sref">fl /a>,  a href="+code=skb" class="sref">skb /a>-> a href="+code=sk" class="sref">sk /a>, 0);> 100 /a>        if ( a href="+code=IS_ERR" class="sref">IS_ERR /a>( a href="+code=dst" class="sref">dst /a>))> 101 /a>                return -1;> 1020 103 /a>         a href="+code=skb_dst_drop" class="sref">skb_dst_drop /a>( a href="+code=skb" class="sref">skb /a>);> 104 /a>         a href="+code=skb_dst_set" class="sref">skb_dst_set /a>( a href="+code=skb" class="sref">skb /a>,  a href="+code=dst" class="sref">dst /a>);> 1050 106 /a>         spao class="comment">/* Change in oif may meao change in hh_leo. */ /spaon> 107 /a>         a href="+code=hh_leo" class="sref">hh_leo /a> =  a href="+code=skb_dst" class="sref">skb_dst /a>( a href="+code=skb" class="sref">skb /a>)-> a href="+code=dev" class="sref">dev /a>-> a href="+code=hard_header_leo" class="sref">hard_header_leo /a>;> 108 /a>        if ( a href="+code=skb_headroom" class="sref">skb_headroom /a>( a href="+code=skb" class="sref">skb /a>) <  a href="+code=hh_leo" class="sref">hh_leo /a> &&> 109 /a>             a href="+code=pskb_expaod_head" class="sref">pskb_expaod_head /a>( a href="+code=skb" class="sref">skb /a>,  a href="+code=hh_leo" class="sref">hh_leo /a> -  a href="+code=skb_headroom" class="sref">skb_headroom /a>( a href="+code=skb" class="sref">skb /a>), 0,  a href="+code=GFP_ATOMIC" class="sref">GFP_ATOMIC /a>))> 110 /a>                return -1;> 111 /a>        return 0;> 112 /a>}> 113 /a> a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL /a>( a href="+code=nf_xfrm_me_harder" class="sref">nf_xfrm_me_harder /a>);> 114 /a>#endif  spao class="comment">/* CONFIG_XFRM */ /spaon> 1150 116 /a> spao class="comment">/* We keep ao extra hash for each conntrack, for fast searching. */ /spaon> 117 /a>static  a href="+code=inline" class="sref">inline /a> unsigned int> 118 /a> a href="+code=hash_by_src" class="sref">hash_by_src /a>(const struct  a href="+code=net" class="sref">net /a> * a href="+code=net" class="sref">net /a>,  a href="+code=u16" class="sref">u16 /a>  a href="+code=zonu" class="sref">zonu /a>,> 119 /a>            const struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=tuple" class="sref">tuple /a>)> 120 /a>{> 121 /a>        unsigned int  a href="+code=hash" class="sref">hash /a>;> 1220 123 /a>         spao class="comment">/* Original src, to ensure we map it consistently if poss. */ /spaon> 124 /a>         a href="+code=hash" class="sref">hash /a> =  a href="+code=jhash2" class="sref">jhash2 /a>(( a href="+code=u32" class="sref">u32 /a> *)& a href="+code=tuple" class="sref">tuple /a>-> a href="+code=src" class="sref">src /a>, sizeof( a href="+code=tuple" class="sref">tuple /a>-> a href="+code=src" class="sref">src /a>) / sizeof( a href="+code=u32" class="sref">u32 /a>),> 125 /a>                       a href="+code=tuple" class="sref">tuple /a>-> a href="+code=dst" class="sref">dst /a>. a href="+code=protonum" class="sref">protonum /a> ^  a href="+code=zonu" class="sref">zonu /a> ^  a href="+code=nf_conntrack_hash_rnd" class="sref">nf_conntrack_hash_rnd /a>);> 126 /a>        return (( a href="+code=u64" class="sref">u64 /a>) a href="+code=hash" class="sref">hash /a> *  a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_htable_size" class="sref">nat_htable_size /a>) >> 32;> 127 /a>}> 1280 129 /a> spao class="comment">/* Is this tuple already taken? (not by us) */ /spaon> 130 /a>int> 131 /a> a href="+code=nf_nat_used_tuple" class="sref">nf_nat_used_tuple /a>(const struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=tuple" class="sref">tuple /a>,> 132 /a>                  const struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ignored_conntrack" class="sref">ignored_conntrack /a>)> 1330 134 /a>         spao class="comment">/* Conntrack tracking doesn't keep track of outgoing tuples; only /spaon> 135 /a> spao class="comment">         * incoming onus.  NAT meaos they don't have a fixed mapping, /spaon> 136 /a> spao class="comment">         * so we invert the tuple and look for the incoming reply. /spaon> 137 /a> spao class="comment">         * /spaon> 138 /a> spao class="comment">         * We could keep a separate hash if this proves too slow. /spaon> 139 /a> spao class="comment">         */ /spaon> 140 /a>        struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a>  a href="+code=reply" class="sref">reply /a>;> 1410 142 /a>         a href="+code=nf_ct_invert_tuplepr" class="sref">nf_ct_invert_tuplepr /a>(& a href="+code=reply" class="sref">reply /a>,  a href="+code=tuple" class="sref">tuple /a>);> 143 /a>        return  a href="+code=nf_conntrack_tuple_taken" class="sref">nf_conntrack_tuple_taken /a>(& a href="+code=reply" class="sref">reply /a>,  a href="+code=ignored_conntrack" class="sref">ignored_conntrack /a>);> 144 /a>}> 145 /a> a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL /a>( a href="+code=nf_nat_used_tuple" class="sref">nf_nat_used_tuple /a>);> 1460 147 /a> spao class="comment">/* If we source map this tuple so reply looks like reply_tuple, will /spaon> 148 /a> spao class="comment"> * that meet the constraints of range. /spaon> 149 /a> spao class="comment"> */ /spaon> 150 /a>static int  a href="+code=in_range" class="sref">in_range /a>(const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> * a href="+code=l3proto" class="sref">l3proto /a>,> 151 /a>                    const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> * a href="+code=l4proto" class="sref">l4proto /a>,> 152 /a>                    const struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=tuple" class="sref">tuple /a>,> 153 /a>                    const struct  a href="+code=nf_nat_range" class="sref">nf_nat_range /a> * a href="+code=range" class="sref">range /a>)> 154 /a>{> 155 /a>         spao class="comment">/* If we are supposed to map IPs, then we must be in the /spaon> 156 /a> spao class="comment">         * range specified, otherwise let this drag us onto a new src IP. /spaon> 157 /a> spao class="comment">         */ /spaon> 158 /a>        if ( a href="+code=range" class="sref">range /a>-> a href="+code=flags" class="sref">flags /a> &  a href="+code=NF_NAT_RANGE_MAP_IPS" class="sref">NF_NAT_RANGE_MAP_IPS /a> &&> 159 /a>            ! a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=in_range" class="sref">in_range /a>( a href="+code=tuple" class="sref">tuple /a>,  a href="+code=range" class="sref">range /a>))> 160 /a>                return 0;> 1610 162 /a>        if (!( a href="+code=range" class="sref">range /a>-> a href="+code=flags" class="sref">flags /a> &  a href="+code=NF_NAT_RANGE_PROTO_SPECIFIED" class="sref">NF_NAT_RANGE_PROTO_SPECIFIED /a>) ||> 163 /a>             a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=in_range" class="sref">in_range /a>( a href="+code=tuple" class="sref">tuple /a>,  a href="+code=NF_NAT_MANIP_SRC" class="sref">NF_NAT_MANIP_SRC /a>,> 164 /a>                              & a href="+code=range" class="sref">range /a>-> a href="+code=min_proto" class="sref">min_proto /a>, & a href="+code=range" class="sref">range /a>-> a href="+code=max_proto" class="sref">max_proto /a>))> 165 /a>                return 1;> 1660 167 /a>        return 0;> 168 /a>}> 1690 170 /a>static  a href="+code=inline" class="sref">inline /a> int> 171 /a> a href="+code=samu_src" class="sref">samu_src /a>(const struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>,> 172 /a>         const struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=tuple" class="sref">tuple /a>)> 1730 174 /a>        const struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=t" class="sref">t /a>;> 1750 176 /a>         a href="+code=t" class="sref">t /a> = & a href="+code=ct" class="sref">ct /a>-> a href="+code=tuplehash" class="sref">tuplehash /a>[ a href="+code=IP_CT_DIR_ORIGINAL" class="sref">IP_CT_DIR_ORIGINAL /a>]. a href="+code=tuple" class="sref">tuple /a>;> 177 /a>        return ( a href="+code=t" class="sref">t /a>-> a href="+code=dst" class="sref">dst /a>. a href="+code=protonum" class="sref">protonum /a> ==  a href="+code=tuple" class="sref">tuple /a>-> a href="+code=dst" class="sref">dst /a>. a href="+code=protonum" class="sref">protonum /a> &&> 178 /a>                 a href="+code=nf_inet_addr_cmp" class="sref">nf_inet_addr_cmp /a>(& a href="+code=t" class="sref">t /a>-> a href="+code=src" class="sref">src /a>. a href="+code=u3" class="sref">u3 /a>, & a href="+code=tuple" class="sref">tuple /a>-> a href="+code=src" class="sref">src /a>. a href="+code=u3" class="sref">u3 /a>) &&> 179 /a>                 a href="+code=t" class="sref">t /a>-> a href="+code=src" class="sref">src /a>. a href="+code=u" class="sref">u /a>. a href="+code=all" class="sref">all /a> ==  a href="+code=tuple" class="sref">tuple /a>-> a href="+code=src" class="sref">src /a>. a href="+code=u" class="sref">u /a>. a href="+code=all" class="sref">all /a>);> 180 /a>}> 1810 182 /a> spao class="comment">/* Only called for SRC manip */ /spaon> 183 /a>static int> 1840find_appropriatu_src /a>(struct  a href="+code=net" class="sref">net /a> * a href="+code=net" class="sref">net /a>,  a href="+code=u16" class="sref">u16 /a>  a href="+code=zonu" class="sref">zonu /a>,> 185 /a>                     const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> * a href="+code=l3proto" class="sref">l3proto /a>,> 186 /a>                     const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> * a href="+code=l4proto" class="sref">l4proto /a>,> 187 /a>                     const struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=tuple" class="sref">tuple /a>,> 188 /a>                     struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=result" class="sref">result /a>,> 189 /a>                     const struct  a href="+code=nf_nat_range" class="sref">nf_nat_range /a> * a href="+code=range" class="sref">range /a>)> 190 /a>{> 191 /a>        unsigned int  a href="+code=h" class="sref">h /a> =  a href="+code=hash_by_src" class="sref">hash_by_src /a>( a href="+code=net" class="sref">net /a>,  a href="+code=zonu" class="sref">zonu /a>,  a href="+code=tuple" class="sref">tuple /a>);> 192 /a>        const struct  a href="+code=nf_conn_nat" class="sref">nf_conn_nat /a> * a href="+code=nat" class="sref">nat /a>;> 193 /a>        const struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>;> 194 /a>        const struct  a href="+code=hlist_node" class="sref">hlist_node /a> * a href="+code=n" class="sref">n /a>;> 1950 196 /a>         a href="+code=hlist_for_each_entry_rcu" class="sref">hlist_for_each_entry_rcu /a>( a href="+code=nat" class="sref">nat /a>,  a href="+code=n" class="sref">n /a>, & a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_bysource" class="sref">nat_bysource /a>[ a href="+code=h" class="sref">h /a>],  a href="+code=bysource" class="sref">bysource /a>) {> 197 /a>                 a href="+code=ct" class="sref">ct /a> =  a href="+code=nat" class="sref">nat /a>-> a href="+code=ct" class="sref">ct /a>;> 198 /a>                if ( a href="+code=samu_src" class="sref">samu_src /a>( a href="+code=ct" class="sref">ct /a>,  a href="+code=tuple" class="sref">tuple /a>) &&  a href="+code=nf_ct_zonu" class="sref">nf_ct_zonu /a>( a href="+code=ct" class="sref">ct /a>) ==  a href="+code=zonu" class="sref">zonu /a>) {> 199 /a>                         spao class="comment">/* Copy source part from reply tuple. */ /spaon> 200 /a>                         a href="+code=nf_ct_invert_tuplepr" class="sref">nf_ct_invert_tuplepr /a>( a href="+code=result" class="sref">result /a>,> 201 /a>                                       & a href="+code=ct" class="sref">ct /a>-> a href="+code=tuplehash" class="sref">tuplehash /a>[ a href="+code=IP_CT_DIR_REPLY" class="sref">IP_CT_DIR_REPLY /a>]. a href="+code=tuple" class="sref">tuple /a>);> 202 /a>                         a href="+code=result" class="sref">result /a>-> a href="+code=dst" class="sref">dst /a> =  a href="+code=tuple" class="sref">tuple /a>-> a href="+code=dst" class="sref">dst /a>;> 2030 204 /a>                        if ( a href="+code=in_range" class="sref">in_range /a>( a href="+code=l3proto" class="sref">l3proto /a>,  a href="+code=l4proto" class="sref">l4proto /a>,  a href="+code=result" class="sref">result /a>,  a href="+code=range" class="sref">range /a>))> 205 /a>                                return 1;> 206 /a>                }> 207 /a>        }> 208 /a>        return 0;> 209 /a>}> 2110 211 /a> spao class="comment">/* For [FUTURE] fragmentation handling, we want the least-used /spaon> 212 /a> spao class="comment"> * src-ip/dst-ip/proto triple.  Fairness doesn't come into it.  Thus /spaon> 213 /a> spao class="comment"> * if the range specifies 1.2.3.4 ports 10000-10005 and 1.2.3.5 ports /spaon> 214 /a> spao class="comment"> * 1-65535, we don't do pro-rata allocation based on ports; we choose /spaon> 215 /a> spao class="comment"> * the ip with the lowest src-ip/dst-ip/proto usage. /spaon> 216 /a> spao class="comment"> */ /spaon> 217 /a>static void> 218 /a> a href="+code=find_best_ips_proto" class="sref">find_best_ips_proto /a>( a href="+code=u16" class="sref">u16 /a>  a href="+code=zonu" class="sref">zonu /a>, struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=tuple" class="sref">tuple /a>,> 219 /a>                    const struct  a href="+code=nf_nat_range" class="sref">nf_nat_range /a> * a href="+code=range" class="sref">range /a>,> 220 /a>                    const struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>,> 221 /a>                    enum  a href="+code=nf_nat_manip_type" class="sref">nf_nat_manip_type /a>  a href="+code=maniptype" class="sref">maniptype /a>)> 2220 223 /a>        union  a href="+code=nf_inet_addr" class="sref">nf_inet_addr /a> * a href="+code=var_ipp" class="sref">var_ipp /a>;> 224 /a>        unsigned int  a href="+code=i" class="sref">i /a>,  a href="+code=max" class="sref">max /a>;> 225 /a>         spao class="comment">/* Host order */ /spaon> 226 /a>         a href="+code=u32" class="sref">u32 /a>  a href="+code=minip" class="sref">minip /a>,  a href="+code=maxip" class="sref">maxip /a>,  a href="+code=j" class="sref">j /a>,  a href="+code=dist" class="sref">dist /a>;> 227 /a>         a href="+code=bool" class="sref">bool /a>  a href="+code=full_range" class="sref">full_range /a>;> 2280 229 /a>         spao class="comment">/* No IP mapping?  Do nothing. */ /spaon> 230 /a>        if (!( a href="+code=range" class="sref">range /a>-> a href="+code=flags" class="sref">flags /a> &  a href="+code=NF_NAT_RANGE_MAP_IPS" class="sref">NF_NAT_RANGE_MAP_IPS /a>))> 231 /a>                return;> 2320 233 /a>        if ( a href="+code=maniptype" class="sref">maniptype /a> ==  a href="+code=NF_NAT_MANIP_SRC" class="sref">NF_NAT_MANIP_SRC /a>)> 234 /a>                 a href="+code=var_ipp" class="sref">var_ipp /a> = & a href="+code=tuple" class="sref">tuple /a>-> a href="+code=src" class="sref">src /a>. a href="+code=u3" class="sref">u3 /a>;> 235 /a>        else> 236 /a>                 a href="+code=var_ipp" class="sref">var_ipp /a> = & a href="+code=tuple" class="sref">tuple /a>-> a href="+code=dst" class="sref">dst /a>. a href="+code=u3" class="sref">u3 /a>;> 237 /a>> 238 /a>         spao class="comment">/* Fast path: only onu choice. */ /spaon> 239 /a>        if ( a href="+code=nf_inet_addr_cmp" class="sref">nf_inet_addr_cmp /a>(& a href="+code=range" class="sref">range /a>-> a href="+code=min_addr" class="sref">min_addr /a>, & a href="+code=range" class="sref">range /a>-> a href="+code=max_addr" class="sref">max_addr /a>)) {> 240 /a>                * a href="+code=var_ipp" class="sref">var_ipp /a> =  a href="+code=range" class="sref">range /a>-> a href="+code=min_addr" class="sref">min_addr /a>;> 241 /a>                return;> 242 /a>        }> 2430 244 /a>        if ( a href="+code=nf_ct_l3num" class="sref">nf_ct_l3num /a>( a href="+code=ct" class="sref">ct /a>) ==  a href="+code=NFPROTO_IPV4" class="sref">NFPROTO_IPV4 /a>)> 245 /a>                 a href="+code=max" class="sref">max /a> = sizeof( a href="+code=var_ipp" class="sref">var_ipp /a>-> a href="+code=ip" class="sref">ip /a>) / sizeof( a href="+code=u32" class="sref">u32 /a>) - 1;> 246 /a>        else> 247 /a>                 a href="+code=max" class="sref">max /a> = sizeof( a href="+code=var_ipp" class="sref">var_ipp /a>-> a href="+code=ip6" class="sref">ip6 /a>) / sizeof( a href="+code=u32" class="sref">u32 /a>) - 1;> 2480 249 /a>         spao class="comment">/* Hashing source and destination IPs gives a fairly even /spaon> 250 /a> spao class="comment">         * spread in practice (if there are a small number of IPs /spaon> 251 /a> spao class="comment">         * involved, there usually aren't that many connections /spaon> 252 /a> spao class="comment">         * anyway).  The consistency meaos that servers see the samu /spaon> 253 /a> spao class="comment">         * client coming from the samu IP (some Internet Banking sites /spaon> 254 /a> spao class="comment">         * like this), even across reboots. /spaon> 255 /a> spao class="comment">         */ /spaon> 256 /a>         a href="+code=j" class="sref">j /a> =  a href="+code=jhash2" class="sref">jhash2 /a>(( a href="+code=u32" class="sref">u32 /a> *)& a href="+code=tuple" class="sref">tuple /a>-> a href="+code=src" class="sref">src /a>. a href="+code=u3" class="sref">u3 /a>, sizeof( a href="+code=tuple" class="sref">tuple /a>-> a href="+code=src" class="sref">src /a>. a href="+code=u3" class="sref">u3 /a>) / sizeof( a href="+code=u32" class="sref">u32 /a>),> 257 /a>                    a href="+code=range" class="sref">range /a>-> a href="+code=flags" class="sref">flags /a> &  a href="+code=NF_NAT_RANGE_PERSISTENT" class="sref">NF_NAT_RANGE_PERSISTENT /a> ?> 258 /a>                        0 : ( a href="+code=__force" class="sref">__force /a>  a href="+code=u32" class="sref">u32 /a>) a href="+code=tuple" class="sref">tuple /a>-> a href="+code=dst" class="sref">dst /a>. a href="+code=u3" class="sref">u3 /a>. a href="+code=all" class="sref">all /a>[ a href="+code=max" class="sref">max /a>] ^  a href="+code=zonu" class="sref">zonu /a>);> 2590 260 /a>         a href="+code=full_range" class="sref">full_range /a> =  a href="+code=false" class="sref">false /a>;> 261 /a>        for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <=  a href="+code=max" class="sref">max /a>;  a href="+code=i" class="sref">i /a>++) {> 262 /a>                 spao class="comment">/* If first bytes of the address are at the maximum, use the /spaon> 263 /a> spao class="comment">                 * distance. Otherwise use the full range. /spaon> 264 /a> spao class="comment">                 */ /spaon> 265 /a>                if (! a href="+code=full_range" class="sref">full_range /a>) {> 266 /a>                         a href="+code=minip" class="sref">minip /a> =  a href="+code=ntohl" class="sref">ntohl /a>(( a href="+code=__force" class="sref">__force /a>  a href="+code=__be32" class="sref">__be32 /a>) a href="+code=range" class="sref">range /a>-> a href="+code=min_addr" class="sref">min_addr /a>. a href="+code=all" class="sref">all /a>[ a href="+code=i" class="sref">i /a>]);> 267 /a>                         a href="+code=maxip" class="sref">maxip /a> =  a href="+code=ntohl" class="sref">ntohl /a>(( a href="+code=__force" class="sref">__force /a>  a href="+code=__be32" class="sref">__be32 /a>) a href="+code=range" class="sref">range /a>-> a href="+code=max_addr" class="sref">max_addr /a>. a href="+code=all" class="sref">all /a>[ a href="+code=i" class="sref">i /a>]);> 268 /a>                         a href="+code=dist" class="sref">dist /a>  =  a href="+code=maxip" class="sref">maxip /a> -  a href="+code=minip" class="sref">minip /a> + 1;> 269 /a>                } else {> 270 /a>                         a href="+code=minip" class="sref">minip /a> = 0;> 271 /a>                         a href="+code=dist" class="sref">dist /a>  = ~0;> 272 /a>                }> 2730 274 /a>                 a href="+code=var_ipp" class="sref">var_ipp /a>-> a href="+code=all" class="sref">all /a>[ a href="+code=i" class="sref">i /a>] = ( a href="+code=__force" class="sref">__force /a>  a href="+code=__u32" class="sref">__u32 /a>)> 275 /a>                         a href="+code=htonl" class="sref">htonl /a>( a href="+code=minip" class="sref">minip /a> + ((( a href="+code=u64" class="sref">u64 /a>) a href="+code=j" class="sref">j /a> *  a href="+code=dist" class="sref">dist /a>) >> 32));> 276 /a>                if ( a href="+code=var_ipp" class="sref">var_ipp /a>-> a href="+code=all" class="sref">all /a>[ a href="+code=i" class="sref">i /a>] !=  a href="+code=range" class="sref">range /a>-> a href="+code=max_addr" class="sref">max_addr /a>. a href="+code=all" class="sref">all /a>[ a href="+code=i" class="sref">i /a>])> 277 /a>                         a href="+code=full_range" class="sref">full_range /a> =  a href="+code=true" class="sref">true /a>;> 2780 279 /a>                if (!( a href="+code=range" class="sref">range /a>-> a href="+code=flags" class="sref">flags /a> &  a href="+code=NF_NAT_RANGE_PERSISTENT" class="sref">NF_NAT_RANGE_PERSISTENT /a>))> 280 /a>                         a href="+code=j" class="sref">j /a> ^= ( a href="+code=__force" class="sref">__force /a>  a href="+code=u32" class="sref">u32 /a>) a href="+code=tuple" class="sref">tuple /a>-> a href="+code=dst" class="sref">dst /a>. a href="+code=u3" class="sref">u3 /a>. a href="+code=all" class="sref">all /a>[ a href="+code=i" class="sref">i /a>];> 281 /a>        }> 282 /a>}> 2830 284 /a> spao class="comment">/* Manipulate the tuple into the range given. For NF_INET_POST_ROUTING, /spaon> 285 /a> spao class="comment"> * we change the source to map into the range. For NF_INET_PRE_ROUTING /spaon> 286 /a> spao class="comment"> * and NF_INET_LOCAL_OUT, we change the destination to map into the /spaon> 287 /a> spao class="comment"> * range. It might not be possible to get a unique tuple, but we try. /spaon> 288 /a> spao class="comment"> * At worst (or if we race), we will end up with a final duplicate in /spaon> 289 /a> spao class="comment"> * __ip_conntrack_confirm and drop the packet. */ /spaon> 290 /a>static void> 291 /a> a href="+code=get_unique_tuple" class="sref">get_unique_tuple /a>(struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=tuple" class="sref">tuple /a>,> 292 /a>                 const struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a> * a href="+code=orig_tuple" class="sref">orig_tuple /a>,> 293 /a>                 const struct  a href="+code=nf_nat_range" class="sref">nf_nat_range /a> * a href="+code=range" class="sref">range /a>,> 294 /a>                 struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>,> 295 /a>                 enum  a href="+code=nf_nat_manip_type" class="sref">nf_nat_manip_type /a>  a href="+code=maniptype" class="sref">maniptype /a>)> 296 /a>{> 297 /a>        const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> * a href="+code=l3proto" class="sref">l3proto /a>;> 298 /a>        const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> * a href="+code=l4proto" class="sref">l4proto /a>;> 299 /a>        struct  a href="+code=net" class="sref">net /a> * a href="+code=net" class="sref">net /a> =  a href="+code=nf_ct_net" class="sref">nf_ct_net /a>( a href="+code=ct" class="sref">ct /a>);> 300 /a>         a href="+code=u16" class="sref">u16 /a>  a href="+code=zonu" class="sref">zonu /a> =  a href="+code=nf_ct_zonu" class="sref">nf_ct_zonu /a>( a href="+code=ct" class="sref">ct /a>);> 3010 302 /a>         a href="+code=rcu_read_lock" class="sref">rcu_read_lock /a>();> 303 /a>         a href="+code=l3proto" class="sref">l3proto /a> =  a href="+code=__nf_nat_l3proto_find" class="sref">__nf_nat_l3proto_find /a>( a href="+code=orig_tuple" class="sref">orig_tuple /a>-> a href="+code=src" class="sref">src /a>. a href="+code=l3num" class="sref">l3num /a>);> 304 /a>         a href="+code=l4proto" class="sref">l4proto /a> =  a href="+code=__nf_nat_l4proto_find" class="sref">__nf_nat_l4proto_find /a>( a href="+code=orig_tuple" class="sref">orig_tuple /a>-> a href="+code=src" class="sref">src /a>. a href="+code=l3num" class="sref">l3num /a>,> 305 /a>                                         a href="+code=orig_tuple" class="sref">orig_tuple /a>-> a href="+code=dst" class="sref">dst /a>. a href="+code=protonum" class="sref">protonum /a>);> 3060 307 /a>         spao class="comment">/* 1) If this srcip/proto/src-proto-part is currently mapped, /spaon> 308 /a> spao class="comment">         * and that samu mapping gives a unique tuple within the given /spaon> 309 /a> spao class="comment">         * range, use that. /spaon> 310 /a> spao class="comment">         * /spaon> 311 /a> spao class="comment">         * This is only required for source (ie. NAT/masq) mappings. /spaon> 312 /a> spao class="comment">         * So far, we don't do local source mappings, so multiple /spaon> 313 /a> spao class="comment">         * manips not ao issue. /spaon> 314 /a> spao class="comment">         */ /spaon> 315 /a>        if ( a href="+code=maniptype" class="sref">maniptype /a> ==  a href="+code=NF_NAT_MANIP_SRC" class="sref">NF_NAT_MANIP_SRC /a> &&> 316 /a>            !( a href="+code=range" class="sref">range /a>-> a href="+code=flags" class="sref">flags /a> &  a href="+code=NF_NAT_RANGE_PROTO_RANDOM" class="sref">NF_NAT_RANGE_PROTO_RANDOM /a>)) {> 317 /a>                 spao class="comment">/* try the original tuple first */ /spaon> 318 /a>                if ( a href="+code=in_range" class="sref">in_range /a>( a href="+code=l3proto" class="sref">l3proto /a>,  a href="+code=l4proto" class="sref">l4proto /a>,  a href="+code=orig_tuple" class="sref">orig_tuple /a>,  a href="+code=range" class="sref">range /a>)) {> 319 /a>                        if (! a href="+code=nf_nat_used_tuple" class="sref">nf_nat_used_tuple /a>( a href="+code=orig_tuple" class="sref">orig_tuple /a>,  a href="+code=ct" class="sref">ct /a>)) {> 320 /a>                                * a href="+code=tuple" class="sref">tuple /a> = * a href="+code=orig_tuple" class="sref">orig_tuple /a>;> 321 /a>                                goto  a href="+code=out" class="sref">out /a>;> 322 /a>                        }> 323 /a>                } else if ( a href="+code=find_appropriatu_src" class="sref">find_appropriatu_src /a>( a href="+code=net" class="sref">net /a>,  a href="+code=zonu" class="sref">zonu /a>,  a href="+code=l3proto" class="sref">l3proto /a>,  a href="+code=l4proto" class="sref">l4proto /a>,> 324 /a>                                                 a href="+code=orig_tuple" class="sref">orig_tuple /a>,  a href="+code=tuple" class="sref">tuple /a>,  a href="+code=range" class="sref">range /a>)) {> 325 /a>                         a href="+code=pr_debug" class="sref">pr_debug /a>( spao class="string">"get_unique_tuple: Found current src map\n" /spaon);> 326 /a>                        if (! a href="+code=nf_nat_used_tuple" class="sref">nf_nat_used_tuple /a>( a href="+code=tuple" class="sref">tuple /a>,  a href="+code=ct" class="sref">ct /a>))> 327 /a>                                goto  a href="+code=out" class="sref">out /a>;> 328 /a>                }> 329 /a>        }> 3310 331 /a>         spao class="comment">/* 2) Select the least-used IP/proto combination in the given range */ /spaon> 332 /a>        * a href="+code=tuple" class="sref">tuple /a> = * a href="+code=orig_tuple" class="sref">orig_tuple /a>;> 333 /a>         a href="+code=find_best_ips_proto" class="sref">find_best_ips_proto /a>( a href="+code=zonu" class="sref">zonu /a>,  a href="+code=tuple" class="sref">tuple /a>,  a href="+code=range" class="sref">range /a>,  a href="+code=ct" class="sref">ct /a>,  a href="+code=maniptype" class="sref">maniptype /a>);> 334 /a>> 335 /a>         spao class="comment">/* 3) The per-protocol part of the manip is made to map into /spaon> 336 /a> spao class="comment">         * the range to make a unique tuple. /spaon> 337 /a> spao class="comment">         */ /spaon> 3380 339 /a>         spao class="comment">/* Only bother mapping if it's not already in range and unique */ /spaon> 340 /a>        if (!( a href="+code=range" class="sref">range /a>-> a href="+code=flags" class="sref">flags /a> &  a href="+code=NF_NAT_RANGE_PROTO_RANDOM" class="sref">NF_NAT_RANGE_PROTO_RANDOM /a>)) {> 341 /a>                if ( a href="+code=range" class="sref">range /a>-> a href="+code=flags" class="sref">flags /a> &  a href="+code=NF_NAT_RANGE_PROTO_SPECIFIED" class="sref">NF_NAT_RANGE_PROTO_SPECIFIED /a>) {> 342 /a>                        if ( a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=in_range" class="sref">in_range /a>( a href="+code=tuple" class="sref">tuple /a>,  a href="+code=maniptype" class="sref">maniptype /a>,> 343 /a>                                              & a href="+code=range" class="sref">range /a>-> a href="+code=min_proto" class="sref">min_proto /a>,> 344 /a>                                              & a href="+code=range" class="sref">range /a>-> a href="+code=max_proto" class="sref">max_proto /a>) &&> 345 /a>                            ( a href="+code=range" class="sref">range /a>-> a href="+code=min_proto" class="sref">min_proto /a>. a href="+code=all" class="sref">all /a> ==  a href="+code=range" class="sref">range /a>-> a href="+code=max_proto" class="sref">max_proto /a>. a href="+code=all" class="sref">all /a> ||> 346 /a>                             ! a href="+code=nf_nat_used_tuple" class="sref">nf_nat_used_tuple /a>( a href="+code=tuple" class="sref">tuple /a>,  a href="+code=ct" class="sref">ct /a>)))> 347 /a>                                goto  a href="+code=out" class="sref">out /a>;> 348 /a>                } else if (! a href="+code=nf_nat_used_tuple" class="sref">nf_nat_used_tuple /a>( a href="+code=tuple" class="sref">tuple /a>,  a href="+code=ct" class="sref">ct /a>)) {> 349 /a>                        goto  a href="+code=out" class="sref">out /a>;> 350 /a>                }> 351 /a>        }> 3520 353 /a>         spao class="comment">/* Last change: get protocol to try to obtain unique tuple. */ /spaon> 354 /a>         a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=unique_tuple" class="sref">unique_tuple /a>( a href="+code=l3proto" class="sref">l3proto /a>,  a href="+code=tuple" class="sref">tuple /a>,  a href="+code=range" class="sref">range /a>,  a href="+code=maniptype" class="sref">maniptype /a>,  a href="+code=ct" class="sref">ct /a>);> 355 /a> a href="+code=out" class="sref">out /a>:> 356 /a>         a href="+code=rcu_read_unlock" class="sref">rcu_read_unlock /a>();> 357 /a>}> 3580 3590 360 /a> a href="+code=nf_nat_setup_info" class="sref">nf_nat_setup_info /a>(struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>,> 361 /a>                  const struct  a href="+code=nf_nat_range" class="sref">nf_nat_range /a> * a href="+code=range" class="sref">range /a>,> 362 /a>                  enum  a href="+code=nf_nat_manip_type" class="sref">nf_nat_manip_type /a>  a href="+code=maniptype" class="sref">maniptype /a>)> 363 /a>{> 364 /a>        struct  a href="+code=net" class="sref">net /a> * a href="+code=net" class="sref">net /a> =  a href="+code=nf_ct_net" class="sref">nf_ct_net /a>( a href="+code=ct" class="sref">ct /a>);> 365 /a>        struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a>  a href="+code=curr_tuple" class="sref">curr_tuple /a>,  a href="+code=new_tuple" class="sref">new_tuple /a>;> 366 /a>        struct  a href="+code=nf_conn_nat" class="sref">nf_conn_nat /a> * a href="+code=nat" class="sref">nat /a>;> 367 /a>> 368 /a>         spao class="comment">/* nat helper or nfctnetlink also setup binding */ /spaon> 369 /a>         a href="+code=nat" class="sref">nat /a> =  a href="+code=nfct_nat" class="sref">nfct_nat /a>( a href="+code=ct" class="sref">ct /a>);> 370 /a>        if (! a href="+code=nat" class="sref">nat /a>) {> 371 /a>                 a href="+code=nat" class="sref">nat /a> =  a href="+code=nf_ct_ext_add" class="sref">nf_ct_ext_add /a>( a href="+code=ct" class="sref">ct /a>,  a href="+code=NF_CT_EXT_NAT" class="sref">NF_CT_EXT_NAT /a>,  a href="+code=GFP_ATOMIC" class="sref">GFP_ATOMIC /a>);> 372 /a>                if ( a href="+code=nat" class="sref">nat /a> ==  a href="+code=NULL" class="sref">NULL /a>) {> 373 /a>                         a href="+code=pr_debug" class="sref">pr_debug /a>( spao class="string">"failed to add NAT extension\n" /spaon);> 374 /a>                        return  a href="+code=NF_ACCEPT" class="sref">NF_ACCEPT /a>;> 375 /a>                }> 376 /a>        }> 377 /a>> 378 /a>         a href="+code=NF_CT_ASSERT" class="sref">NF_CT_ASSERT /a>( a href="+code=maniptype" class="sref">maniptype /a> ==  a href="+code=NF_NAT_MANIP_SRC" class="sref">NF_NAT_MANIP_SRC /a> ||> 379 /a>                      a href="+code=maniptype" class="sref">maniptype /a> ==  a href="+code=NF_NAT_MANIP_DST" class="sref">NF_NAT_MANIP_DST /a>);> 380 /a>         a href="+code=BUG_ON" class="sref">BUG_ON /a>( a href="+code=nf_nat_initialized" class="sref">nf_nat_initialized /a>( a href="+code=ct" class="sref">ct /a>,  a href="+code=maniptype" class="sref">maniptype /a>));> 3810 382 /a>         spao class="comment">/* What we've got will look like inverse of reply. Normally /spaon> 383 /a> spao class="comment">         * this is what is in the conntrack, except for prior /spaon> 384 /a> spao class="comment">         * manipulations (future optimization: if num_manips == 0, /spaon> 385 /a> spao class="comment">         * orig_tp = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple) /spaon> 386 /a> spao class="comment">         */ /spaon> 387 /a>         a href="+code=nf_ct_invert_tuplepr" class="sref">nf_ct_invert_tuplepr /a>(& a href="+code=curr_tuple" class="sref">curr_tuple /a>,> 388 /a>                             & a href="+code=ct" class="sref">ct /a>-> a href="+code=tuplehash" class="sref">tuplehash /a>[ a href="+code=IP_CT_DIR_REPLY" class="sref">IP_CT_DIR_REPLY /a>]. a href="+code=tuple" class="sref">tuple /a>);> 3890 390 /a>         a href="+code=get_unique_tuple" class="sref">get_unique_tuple /a>(& a href="+code=new_tuple" class="sref">new_tuple /a>, & a href="+code=curr_tuple" class="sref">curr_tuple /a>,  a href="+code=range" class="sref">range /a>,  a href="+code=ct" class="sref">ct /a>,  a href="+code=maniptype" class="sref">maniptype /a>);> 3910 392 /a>        if (! a href="+code=nf_ct_tuple_equal" class="sref">nf_ct_tuple_equal /a>(& a href="+code=new_tuple" class="sref">new_tuple /a>, & a href="+code=curr_tuple" class="sref">curr_tuple /a>)) {> 393 /a>                struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a>  a href="+code=reply" class="sref">reply /a>;> 394 /a>> 395 /a>                 spao class="comment">/* Alter conntrack table so will recognize replies. */ /spaon> 396 /a>                 a href="+code=nf_ct_invert_tuplepr" class="sref">nf_ct_invert_tuplepr /a>(& a href="+code=reply" class="sref">reply /a>, & a href="+code=new_tuple" class="sref">new_tuple /a>);> 397 /a>                 a href="+code=nf_conntrack_alter_reply" class="sref">nf_conntrack_alter_reply /a>( a href="+code=ct" class="sref">ct /a>, & a href="+code=reply" class="sref">reply /a>);> 3980 399 /a>                 spao class="comment">/* Non-atomic: we own this at the moment. */ /spaon> 400 /a>                if ( a href="+code=maniptype" class="sref">maniptype /a> ==  a href="+code=NF_NAT_MANIP_SRC" class="sref">NF_NAT_MANIP_SRC /a>)> 401 /a>                         a href="+code=ct" class="sref">ct /a>-> a href="+code=status" class="sref">status /a> |=  a href="+code=IPS_SRC_NAT" class="sref">IPS_SRC_NAT /a>;> 402 /a>                else> 403 /a>                         a href="+code=ct" class="sref">ct /a>-> a href="+code=status" class="sref">status /a> |=  a href="+code=IPS_DST_NAT" class="sref">IPS_DST_NAT /a>;> 404 /a>        }> 405 /a>> 406 /a>        if ( a href="+code=maniptype" class="sref">maniptype /a> ==  a href="+code=NF_NAT_MANIP_SRC" class="sref">NF_NAT_MANIP_SRC /a>) {> 407 /a>                unsigned int  a href="+code=srchash" class="sref">srchash /a>;> 4080 409 /a>                 a href="+code=srchash" class="sref">srchash /a> =  a href="+code=hash_by_src" class="sref">hash_by_src /a>( a href="+code=net" class="sref">net /a>,  a href="+code=nf_ct_zonu" class="sref">nf_ct_zonu /a>( a href="+code=ct" class="sref">ct /a>),> 410 /a>                                      & a href="+code=ct" class="sref">ct /a>-> a href="+code=tuplehash" class="sref">tuplehash /a>[ a href="+code=IP_CT_DIR_ORIGINAL" class="sref">IP_CT_DIR_ORIGINAL /a>]. a href="+code=tuple" class="sref">tuple /a>);> 411 /a>                 a href="+code=spin_lock_bh" class="sref">spin_lock_bh /a>(& a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);> 412 /a>                 spao class="comment">/* nf_conntrack_alter_reply might re-allocate extension aera */ /spaon> 413 /a>                 a href="+code=nat" class="sref">nat /a> =  a href="+code=nfct_nat" class="sref">nfct_nat /a>( a href="+code=ct" class="sref">ct /a>);> 414 /a>                 a href="+code=nat" class="sref">nat /a>-> a href="+code=ct" class="sref">ct /a> =  a href="+code=ct" class="sref">ct /a>;> 415 /a>                 a href="+code=hlist_add_head_rcu" class="sref">hlist_add_head_rcu /a>(& a href="+code=nat" class="sref">nat /a>-> a href="+code=bysource" class="sref">bysource /a>,> 416 /a>                                   & a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_bysource" class="sref">nat_bysource /a>[ a href="+code=srchash" class="sref">srchash /a>]);> 417 /a>                 a href="+code=spin_unlock_bh" class="sref">spin_unlock_bh /a>(& a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);> 418 /a>        }> 4190 420 /a>         spao class="comment">/* It's donu. */ /spaon> 421 /a>        if ( a href="+code=maniptype" class="sref">maniptype /a> ==  a href="+code=NF_NAT_MANIP_DST" class="sref">NF_NAT_MANIP_DST /a>)> 422 /a>                 a href="+code=ct" class="sref">ct /a>-> a href="+code=status" class="sref">status /a> |=  a href="+code=IPS_DST_NAT_DONE" class="sref">IPS_DST_NAT_DONE /a>;> 423 /a>        else> 424 /a>                 a href="+code=ct" class="sref">ct /a>-> a href="+code=status" class="sref">status /a> |=  a href="+code=IPS_SRC_NAT_DONE" class="sref">IPS_SRC_NAT_DONE /a>;> 425 /a>> 426 /a>        return  a href="+code=NF_ACCEPT" class="sref">NF_ACCEPT /a>;> 427 /a>}> 428 /a> a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL /a>( a href="+code=nf_nat_setup_info" class="sref">nf_nat_setup_info /a>);> 4290 430 /a> spao class="comment">/* Do packet manipulations according to nf_nat_setup_info. */ /spaon> 431 /a>unsigned int  a href="+code=nf_nat_packet" class="sref">nf_nat_packet /a>(struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>,> 432 /a>                           enum  a href="+code=ip_conntrack_info" class="sref">ip_conntrack_info /a>  a href="+code=ctinfo" class="sref">ctinfo /a>,> 433 /a>                           unsigned int  a href="+code=hooknum" class="sref">hooknum /a>,> 434 /a>                           struct  a href="+code=sk_buff" class="sref">sk_buff /a> * a href="+code=skb" class="sref">skb /a>)> 435 /a>{> 436 /a>        const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> * a href="+code=l3proto" class="sref">l3proto /a>;> 437 /a>        const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> * a href="+code=l4proto" class="sref">l4proto /a>;> 438 /a>        enum  a href="+code=ip_conntrack_dir" class="sref">ip_conntrack_dir /a>  a href="+code=dir" class="sref">dir /a> =  a href="+code=CTINFO2DIR" class="sref">CTINFO2DIR /a>( a href="+code=ctinfo" class="sref">ctinfo /a>);> 439 /a>        unsigned long  a href="+code=statusbit" class="sref">statusbit /a>;> 440 /a>        enum  a href="+code=nf_nat_manip_type" class="sref">nf_nat_manip_type /a>  a href="+code=mtype" class="sref">mtype /a> =  a href="+code=HOOK2MANIP" class="sref">HOOK2MANIP /a>( a href="+code=hooknum" class="sref">hooknum /a>);> 4410 442 /a>        if ( a href="+code=mtype" class="sref">mtype /a> ==  a href="+code=NF_NAT_MANIP_SRC" class="sref">NF_NAT_MANIP_SRC /a>)> 443 /a>                 a href="+code=statusbit" class="sref">statusbit /a> =  a href="+code=IPS_SRC_NAT" class="sref">IPS_SRC_NAT /a>;> 444 /a>        else> 445 /a>                 a href="+code=statusbit" class="sref">statusbit /a> =  a href="+code=IPS_DST_NAT" class="sref">IPS_DST_NAT /a>;> 4460 447 /a>         spao class="comment">/* Invert if this is reply dir. */ /spaon> 448 /a>        if ( a href="+code=dir" class="sref">dir /a> ==  a href="+code=IP_CT_DIR_REPLY" class="sref">IP_CT_DIR_REPLY /a>)> 449 /a>                 a href="+code=statusbit" class="sref">statusbit /a> ^=  a href="+code=IPS_NAT_MASK" class="sref">IPS_NAT_MASK /a>;> 4510 451 /a>         spao class="comment">/* Non-atomic: these bits don't change. */ /spaon> 452 /a>        if ( a href="+code=ct" class="sref">ct /a>-> a href="+code=status" class="sref">status /a> &  a href="+code=statusbit" class="sref">statusbit /a>) {> 453 /a>                struct  a href="+code=nf_conntrack_tuple" class="sref">nf_conntrack_tuple /a>  a href="+code=target" class="sref">target /a>;> 454 /a>> 455 /a>                 spao class="comment">/* We are aiming to look like inverse of other direction. */ /spaon> 456 /a>                 a href="+code=nf_ct_invert_tuplepr" class="sref">nf_ct_invert_tuplepr /a>(& a href="+code=target" class="sref">target /a>, & a href="+code=ct" class="sref">ct /a>-> a href="+code=tuplehash" class="sref">tuplehash /a>[! a href="+code=dir" class="sref">dir /a>]. a href="+code=tuple" class="sref">tuple /a>);> 457 /a>> 458 /a>                 a href="+code=l3proto" class="sref">l3proto /a> =  a href="+code=__nf_nat_l3proto_find" class="sref">__nf_nat_l3proto_find /a>( a href="+code=target" class="sref">target /a>. a href="+code=src" class="sref">src /a>. a href="+code=l3num" class="sref">l3num /a>);> 459 /a>                 a href="+code=l4proto" class="sref">l4proto /a> =  a href="+code=__nf_nat_l4proto_find" class="sref">__nf_nat_l4proto_find /a>( a href="+code=target" class="sref">target /a>. a href="+code=src" class="sref">src /a>. a href="+code=l3num" class="sref">l3num /a>,> 460 /a>                                                 a href="+code=target" class="sref">target /a>. a href="+code=dst" class="sref">dst /a>. a href="+code=protonum" class="sref">protonum /a>);> 461 /a>                if (! a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=manip_pkt" class="sref">manip_pkt /a>( a href="+code=skb" class="sref">skb /a>, 0,  a href="+code=l4proto" class="sref">l4proto /a>, & a href="+code=target" class="sref">target /a>,  a href="+code=mtype" class="sref">mtype /a>))> 462 /a>                        return  a href="+code=NF_DROP" class="sref">NF_DROP /a>;> 463 /a>        }> 464 /a>        return  a href="+code=NF_ACCEPT" class="sref">NF_ACCEPT /a>;> 465 /a>}> 466 /a> a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL /a>( a href="+code=nf_nat_packet" class="sref">nf_nat_packet /a>);> 467 /a>> 468 /a>struct  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a> {> 469 /a>         a href="+code=u8" class="sref">u8 /a>       a href="+code=l3proto" class="sref">l3proto /a>;> 470 /a>         a href="+code=u8" class="sref">u8 /a>       a href="+code=l4proto" class="sref">l4proto /a>;> 471 /a>         a href="+code=bool" class="sref">bool /a>     a href="+code=hash" class="sref">hash /a>;> 472 /a>};> 473 /a>> 474 /a> spao class="comment">/* Clear NAT section of all conntracks, in case we're loaded again. */ /spaon> 475 /a>static int  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>(struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=i" class="sref">i /a>, void * a href="+code=data" class="sref">data /a>)> 476 /a>{> 477 /a>        const struct  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a> * a href="+code=clean" class="sref">clean /a> =  a href="+code=data" class="sref">data /a>;> 478 /a>        struct  a href="+code=nf_conn_nat" class="sref">nf_conn_nat /a> * a href="+code=nat" class="sref">nat /a> =  a href="+code=nfct_nat" class="sref">nfct_nat /a>( a href="+code=i" class="sref">i /a>);> 4790 480 /a>        if (! a href="+code=nat" class="sref">nat /a>)> 481 /a>                return 0;> 482 /a>        if (!( a href="+code=i" class="sref">i /a>-> a href="+code=status" class="sref">status /a> &  a href="+code=IPS_SRC_NAT_DONE" class="sref">IPS_SRC_NAT_DONE /a>))> 483 /a>                return 0;> 484 /a>        if (( a href="+code=clean" class="sref">clean /a>-> a href="+code=l3proto" class="sref">l3proto /a> &&  a href="+code=nf_ct_l3num" class="sref">nf_ct_l3num /a>( a href="+code=i" class="sref">i /a>) !=  a href="+code=clean" class="sref">clean /a>-> a href="+code=l3proto" class="sref">l3proto /a>) ||> 485 /a>            ( a href="+code=clean" class="sref">clean /a>-> a href="+code=l4proto" class="sref">l4proto /a> &&  a href="+code=nf_ct_protonum" class="sref">nf_ct_protonum /a>( a href="+code=i" class="sref">i /a>) !=  a href="+code=clean" class="sref">clean /a>-> a href="+code=l4proto" class="sref">l4proto /a>))> 486 /a>                return 0;> 487 /a>> 488 /a>        if ( a href="+code=clean" class="sref">clean /a>-> a href="+code=hash" class="sref">hash /a>) {> 489 /a>                 a href="+code=spin_lock_bh" class="sref">spin_lock_bh /a>(& a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);> 490 /a>                 a href="+code=hlist_del_rcu" class="sref">hlist_del_rcu /a>(& a href="+code=nat" class="sref">nat /a>-> a href="+code=bysource" class="sref">bysource /a>);> 491 /a>                 a href="+code=spin_unlock_bh" class="sref">spin_unlock_bh /a>(& a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);> 492 /a>        } else {> 493 /a>                 a href="+code=memset" class="sref">memset /a>( a href="+code=nat" class="sref">nat /a>, 0, sizeof(* a href="+code=nat" class="sref">nat /a>));> 494 /a>                 a href="+code=i" class="sref">i /a>-> a href="+code=status" class="sref">status /a> &= ~( a href="+code=IPS_NAT_MASK" class="sref">IPS_NAT_MASK /a> |  a href="+code=IPS_NAT_DONE_MASK" class="sref">IPS_NAT_DONE_MASK /a> |> 495 /a>                                a href="+code=IPS_SEQ_ADJUST" class="sref">IPS_SEQ_ADJUST /a>);> 496 /a>        }> 497 /a>        return 0;> 4980 4990 500 /a>static void  a href="+code=nf_nat_l4proto_clean" class="sref">nf_nat_l4proto_clean /a>( a href="+code=u8" class="sref">u8 /a>  a href="+code=l3proto" class="sref">l3proto /a>,  a href="+code=u8" class="sref">u8 /a>  a href="+code=l4proto" class="sref">l4proto /a>)> 501 /a>{> 502 /a>        struct  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>  a href="+code=clean" class="sref">clean /a> = {> 503 /a>                . a href="+code=l3proto" class="sref">l3proto /a> =  a href="+code=l3proto" class="sref">l3proto /a>,> 504 /a>                . a href="+code=l4proto" class="sref">l4proto /a> =  a href="+code=l4proto" class="sref">l4proto /a>,> 505 /a>        };> 506 /a>        struct  a href="+code=net" class="sref">net /a> * a href="+code=net" class="sref">net /a>;> 507 /a>> 508 /a>         a href="+code=rtnl_lock" class="sref">rtnl_lock /a>();> 509 /a>         spao class="comment">/* Step 1 - remove from bysource hash */ /spaon> 510 /a>         a href="+code=clean" class="sref">clean /a>. a href="+code=hash" class="sref">hash /a> =  a href="+code=true" class="sref">true /a>;> 511 /a>         a href="+code=for_each_net" class="sref">for_each_net /a>( a href="+code=net" class="sref">net /a>)> 512 /a>                 a href="+code=nf_ct_iterate_cleanup" class="sref">nf_ct_iterate_cleanup /a>( a href="+code=net" class="sref">net /a>,  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>, & a href="+code=clean" class="sref">clean /a>);> 513 /a>         a href="+code=synchronize_rcu" class="sref">synchronize_rcu /a>();> 514 /a>> 515 /a>         spao class="comment">/* Step 2 - clean NAT section */ /spaon> 516 /a>         a href="+code=clean" class="sref">clean /a>. a href="+code=hash" class="sref">hash /a> =  a href="+code=false" class="sref">false /a>;> 517 /a>         a href="+code=for_each_net" class="sref">for_each_net /a>( a href="+code=net" class="sref">net /a>)> 518 /a>                 a href="+code=nf_ct_iterate_cleanup" class="sref">nf_ct_iterate_cleanup /a>( a href="+code=net" class="sref">net /a>,  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>, & a href="+code=clean" class="sref">clean /a>);> 519 /a>         a href="+code=rtnl_unlock" class="sref">rtnl_unlock /a>();> 520 /a>}> 5210 522 /a>static void  a href="+code=nf_nat_l3proto_clean" class="sref">nf_nat_l3proto_clean /a>( a href="+code=u8" class="sref">u8 /a>  a href="+code=l3proto" class="sref">l3proto /a>)> 523 /a>{> 524 /a>        struct  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>  a href="+code=clean" class="sref">clean /a> = {> 525 /a>                . a href="+code=l3proto" class="sref">l3proto /a> =  a href="+code=l3proto" class="sref">l3proto /a>,> 526 /a>        };> 527 /a>        struct  a href="+code=net" class="sref">net /a> * a href="+code=net" class="sref">net /a>;> 5280 529 /a>         a href="+code=rtnl_lock" class="sref">rtnl_lock /a>();> 530 /a>         spao class="comment">/* Step 1 - remove from bysource hash */ /spaon> 531 /a>         a href="+code=clean" class="sref">clean /a>. a href="+code=hash" class="sref">hash /a> =  a href="+code=true" class="sref">true /a>;> 532 /a>         a href="+code=for_each_net" class="sref">for_each_net /a>( a href="+code=net" class="sref">net /a>)> 533 /a>                 a href="+code=nf_ct_iterate_cleanup" class="sref">nf_ct_iterate_cleanup /a>( a href="+code=net" class="sref">net /a>,  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>, & a href="+code=clean" class="sref">clean /a>);> 534 /a>         a href="+code=synchronize_rcu" class="sref">synchronize_rcu /a>();> 535 /a>> 536 /a>         spao class="comment">/* Step 2 - clean NAT section */ /spaon> 537 /a>         a href="+code=clean" class="sref">clean /a>. a href="+code=hash" class="sref">hash /a> =  a href="+code=false" class="sref">false /a>;> 538 /a>         a href="+code=for_each_net" class="sref">for_each_net /a>( a href="+code=net" class="sref">net /a>)> 539 /a>                 a href="+code=nf_ct_iterate_cleanup" class="sref">nf_ct_iterate_cleanup /a>( a href="+code=net" class="sref">net /a>,  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>, & a href="+code=clean" class="sref">clean /a>);> 540 /a>         a href="+code=rtnl_unlock" class="sref">rtnl_unlock /a>();> 5410 542 /a>> 543 /a> spao class="comment">/* Protocol registration. */ /spaon> 544 /a>int  a href="+code=nf_nat_l4proto_register" class="sref">nf_nat_l4proto_register /a>( a href="+code=u8" class="sref">u8 /a>  a href="+code=l3proto" class="sref">l3proto /a>, const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> * a href="+code=l4proto" class="sref">l4proto /a>)> 545 /a>{> 546 /a>        const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> ** a href="+code=l4protos" class="sref">l4protos /a>;> 547 /a>        unsigned int  a href="+code=i" class="sref">i /a>;> 548 /a>        int  a href="+code=ret" class="sref">ret /a> = 0;> 5490 550 /a>         a href="+code=mutex_lock" class="sref">mutex_lock /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);> 551 /a>        if ( a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>] ==  a href="+code=NULL" class="sref">NULL /a>) {> 552 /a>                 a href="+code=l4protos" class="sref">l4protos /a> =  a href="+code=kmalloc" class="sref">kmalloc /a>( a href="+code=IPPROTO_MAX" class="sref">IPPROTO_MAX /a> * sizeof(struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> *),> 553 /a>                                    a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL /a>);> 554 /a>                if ( a href="+code=l4protos" class="sref">l4protos /a> ==  a href="+code=NULL" class="sref">NULL /a>) {> 555 /a>                         a href="+code=ret" class="sref">ret /a> = - a href="+code=ENOMEM" class="sref">ENOMEM /a>;> 556 /a>                        goto  a href="+code=out" class="sref">out /a>;> 557 /a>                }> 5580 559 /a>                for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <  a href="+code=IPPROTO_MAX" class="sref">IPPROTO_MAX /a>;  a href="+code=i" class="sref">i /a>++)> 560 /a>                         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=l4protos" class="sref">l4protos /a>[ a href="+code=i" class="sref">i /a>], & a href="+code=nf_nat_l4proto_unknown" class="sref">nf_nat_l4proto_unknown /a>);> 5610 562 /a>                 spao class="comment">/* Before making proto_array visible to lockless readers, /spaon> 563 /a> spao class="comment">                 * we must make sure its content is committed to memory. /spaon> 564 /a> spao class="comment">                 */ /spaon> 565 /a>                 a href="+code=smp_wmb" class="sref">smp_wmb /a>();> 5660 567 /a>                 a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>] =  a href="+code=l4protos" class="sref">l4protos /a>;> 568 /a>        }> 5690 570 /a>        if ( a href="+code=rcu_dereference_protected" class="sref">rcu_dereference_protected /a>(> 571 /a>                         a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>][ a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=l4proto" class="sref">l4proto /a>],> 572 /a>                         a href="+code=lockdep_is_held" class="sref">lockdep_is_held /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>)> 573 /a>                        ) != & a href="+code=nf_nat_l4proto_unknown" class="sref">nf_nat_l4proto_unknown /a>) {> 574 /a>                 a href="+code=ret" class="sref">ret /a> = - a href="+code=EBUSY" class="sref">EBUSY /a>;> 575 /a>                goto  a href="+code=out" class="sref">out /a>;> 576 /a>        }> 577 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>][ a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=l4proto" class="sref">l4proto /a>],  a href="+code=l4proto" class="sref">l4proto /a>);> 578 /a>  a href="+code=out" class="sref">out /a>:> 579 /a>         a href="+code=mutex_unlock" class="sref">mutex_unlock /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);> 580 /a>        return  a href="+code=ret" class="sref">ret /a>;> 5810 582 /a> a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL /a>( a href="+code=nf_nat_l4proto_register" class="sref">nf_nat_l4proto_register /a>);> 583 /a>> 584 /a> spao class="comment">/* No one stores the protocol anywhere; simply delete it. */ /spaon> 585 /a>void  a href="+code=nf_nat_l4proto_unregister" class="sref">nf_nat_l4proto_unregister /a>( a href="+code=u8" class="sref">u8 /a>  a href="+code=l3proto" class="sref">l3proto /a>, const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> * a href="+code=l4proto" class="sref">l4proto /a>)> 586 /a>{> 587 /a>         a href="+code=mutex_lock" class="sref">mutex_lock /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);> 588 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>][ a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=l4proto" class="sref">l4proto /a>],> 589 /a>                         & a href="+code=nf_nat_l4proto_unknown" class="sref">nf_nat_l4proto_unknown /a>);> 590 /a>         a href="+code=mutex_unlock" class="sref">mutex_unlock /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);> 591 /a>         a href="+code=synchronize_rcu" class="sref">synchronize_rcu /a>();> 592 /a>> 593 /a>         a href="+code=nf_nat_l4proto_clean" class="sref">nf_nat_l4proto_clean /a>( a href="+code=l3proto" class="sref">l3proto /a>,  a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=l4proto" class="sref">l4proto /a>);> 594 /a>}> 595 /a> a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL /a>( a href="+code=nf_nat_l4proto_unregister" class="sref">nf_nat_l4proto_unregister /a>);> 5960 597 /a>int  a href="+code=nf_nat_l3proto_register" class="sref">nf_nat_l3proto_register /a>(const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> * a href="+code=l3proto" class="sref">l3proto /a>)> 5980 599 /a>        int  a href="+code=err" class="sref">err /a>;> 6010 601 /a>         a href="+code=err" class="sref">err /a> =  a href="+code=nf_ct_l3proto_try_module_get" class="sref">nf_ct_l3proto_try_module_get /a>( a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=l3proto" class="sref">l3proto /a>);> 602 /a>        if ( a href="+code=err" class="sref">err /a> < 0)> 603 /a>                return  a href="+code=err" class="sref">err /a>;> 604 /a>> 605 /a>         a href="+code=mutex_lock" class="sref">mutex_lock /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);> 606 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=l3proto" class="sref">l3proto /a>][ a href="+code=IPPROTO_TCP" class="sref">IPPROTO_TCP /a>],> 607 /a>                         & a href="+code=nf_nat_l4proto_tcp" class="sref">nf_nat_l4proto_tcp /a>);> 608 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=l3proto" class="sref">l3proto /a>][ a href="+code=IPPROTO_UDP" class="sref">IPPROTO_UDP /a>],> 609 /a>                         & a href="+code=nf_nat_l4proto_udp" class="sref">nf_nat_l4proto_udp /a>);> 610 /a>         a href="+code=mutex_unlock" class="sref">mutex_unlock /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);> 6110 612 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_l3protos" class="sref">nf_nat_l3protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=l3proto" class="sref">l3proto /a>],  a href="+code=l3proto" class="sref">l3proto /a>);> 613 /a>        return 0;> 614 /a>}> 615 /a> a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL /a>( a href="+code=nf_nat_l3proto_register" class="sref">nf_nat_l3proto_register /a>);> 6160 617 /a>void  a href="+code=nf_nat_l3proto_unregister" class="sref">nf_nat_l3proto_unregister /a>(const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> * a href="+code=l3proto" class="sref">l3proto /a>)> 6180 619 /a>         a href="+code=mutex_lock" class="sref">mutex_lock /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);> 620 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_l3protos" class="sref">nf_nat_l3protos /a>[ a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=l3proto" class="sref">l3proto /a>],  a href="+code=NULL" class="sref">NULL /a>);> 621 /a>         a href="+code=mutex_unlock" class="sref">mutex_unlock /a>(& a href="+code=nf_nat_proto_mutex" class="sref">nf_nat_proto_mutex /a>);> 622 /a>         a href="+code=synchronize_rcu" class="sref">synchronize_rcu /a>();> 623 /a>> 624 /a>         a href="+code=nf_nat_l3proto_clean" class="sref">nf_nat_l3proto_clean /a>( a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=l3proto" class="sref">l3proto /a>);> 625 /a>         a href="+code=nf_ct_l3proto_module_put" class="sref">nf_ct_l3proto_module_put /a>( a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=l3proto" class="sref">l3proto /a>);> 626 /a>}> 627 /a> a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL /a>( a href="+code=nf_nat_l3proto_unregister" class="sref">nf_nat_l3proto_unregister /a>);> 6280 629 /a> spao class="comment">/* No one using conntrack by the time this called. */ /spaon> 630 /a>static void  a href="+code=nf_nat_cleanup_conntrack" class="sref">nf_nat_cleanup_conntrack /a>(struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>)> 631 /a>{> 632 /a>        struct  a href="+code=nf_conn_nat" class="sref">nf_conn_nat /a> * a href="+code=nat" class="sref">nat /a> =  a href="+code=nf_ct_ext_find" class="sref">nf_ct_ext_find /a>( a href="+code=ct" class="sref">ct /a>,  a href="+code=NF_CT_EXT_NAT" class="sref">NF_CT_EXT_NAT /a>);> 633 /a>> 634 /a>        if ( a href="+code=nat" class="sref">nat /a> ==  a href="+code=NULL" class="sref">NULL /a> ||  a href="+code=nat" class="sref">nat /a>-> a href="+code=ct" class="sref">ct /a> ==  a href="+code=NULL" class="sref">NULL /a>)> 635 /a>                return;> 6360 637 /a>         a href="+code=NF_CT_ASSERT" class="sref">NF_CT_ASSERT /a>( a href="+code=nat" class="sref">nat /a>-> a href="+code=ct" class="sref">ct /a>-> a href="+code=status" class="sref">status /a> &  a href="+code=IPS_SRC_NAT_DONE" class="sref">IPS_SRC_NAT_DONE /a>);> 6380 639 /a>         a href="+code=spin_lock_bh" class="sref">spin_lock_bh /a>(& a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);> 640 /a>         a href="+code=hlist_del_rcu" class="sref">hlist_del_rcu /a>(& a href="+code=nat" class="sref">nat /a>-> a href="+code=bysource" class="sref">bysource /a>);> 641 /a>         a href="+code=spin_unlock_bh" class="sref">spin_unlock_bh /a>(& a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);> 642 /a>}> 643 /a>> 644 /a>static void  a href="+code=nf_nat_move_storage" class="sref">nf_nat_move_storage /a>(void * a href="+code=new" class="sref">new /a>, void * a href="+code=old" class="sref">old /a>)> 645 /a>{> 646 /a>        struct  a href="+code=nf_conn_nat" class="sref">nf_conn_nat /a> * a href="+code=new_nat" class="sref">new_nat /a> =  a href="+code=new" class="sref">new /a>;> 647 /a>        struct  a href="+code=nf_conn_nat" class="sref">nf_conn_nat /a> * a href="+code=old_nat" class="sref">old_nat /a> =  a href="+code=old" class="sref">old /a>;> 648 /a>        struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a> =  a href="+code=old_nat" class="sref">old_nat /a>-> a href="+code=ct" class="sref">ct /a>;> 6490 650 /a>        if (! a href="+code=ct" class="sref">ct /a> || !( a href="+code=ct" class="sref">ct /a>-> a href="+code=status" class="sref">status /a> &  a href="+code=IPS_SRC_NAT_DONE" class="sref">IPS_SRC_NAT_DONE /a>))> 651 /a>                return;> 652 /a>> 653 /a>         a href="+code=spin_lock_bh" class="sref">spin_lock_bh /a>(& a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);> 654 /a>         a href="+code=hlist_replace_rcu" class="sref">hlist_replace_rcu /a>(& a href="+code=old_nat" class="sref">old_nat /a>-> a href="+code=bysource" class="sref">bysource /a>, & a href="+code=new_nat" class="sref">new_nat /a>-> a href="+code=bysource" class="sref">bysource /a>);> 655 /a>         a href="+code=spin_unlock_bh" class="sref">spin_unlock_bh /a>(& a href="+code=nf_nat_lock" class="sref">nf_nat_lock /a>);> 656 /a>}> 657 /a>> 6580nf_ct_ext_type /a>  a href="+code=nat_extend" class="sref">nat_extend /a>  a href="+code=__read_mostly" class="sref">__read_mostly /a> = {> 659 /a>        . a href="+code=len" class="sref">len /a>            = sizeof(struct  a href="+code=nf_conn_nat" class="sref">nf_conn_nat /a>),> 660 /a>        . a href="+code=align" class="sref">align /a>          =  a href="+code=__alignof__" class="sref">__alignof__ /a>(struct  a href="+code=nf_conn_nat" class="sref">nf_conn_nat /a>),> 661 /a>        . a href="+code=destroy" class="sref">destroy /a>        =  a href="+code=nf_nat_cleanup_conntrack" class="sref">nf_nat_cleanup_conntrack /a>,> 662 /a>        . a href="+code=move" class="sref">move /a>           =  a href="+code=nf_nat_move_storage" class="sref">nf_nat_move_storage /a>,> 663 /a>        . a href="+code=id" class="sref">id /a>             =  a href="+code=NF_CT_EXT_NAT" class="sref">NF_CT_EXT_NAT /a>,> 664 /a>        . a href="+code=flags" class="sref">flags /a>          =  a href="+code=NF_CT_EXT_F_PREALLOC" class="sref">NF_CT_EXT_F_PREALLOC /a>,> 665 /a>};> 6660 667 /a>#if  a href="+code=defined" class="sref">defined /a>( a href="+code=CONFIG_NF_CT_NETLINK" class="sref">CONFIG_NF_CT_NETLINK /a>) ||  a href="+code=defined" class="sref">defined /a>( a href="+code=CONFIG_NF_CT_NETLINK_MODULE" class="sref">CONFIG_NF_CT_NETLINK_MODULE /a>)> 6680 6690linux/netfilter/nfnetlink.h0 670 /a>#include <linux/netfilter/nfnetlink_conntrack.h0 6710 672 /a>static const struct  a href="+code=nla_policy" class="sref">nla_policy /a>  a href="+code=protonat_nla_policy" class="sref">protonat_nla_policy /a>[ a href="+code=CTA_PROTONAT_MAX" class="sref">CTA_PROTONAT_MAX /a>+1] = {> 673 /a>        [ a href="+code=CTA_PROTONAT_PORT_MIN" class="sref">CTA_PROTONAT_PORT_MIN /a>] = { . a href="+code=type" class="sref">type /a> =  a href="+code=NLA_U16" class="sref">NLA_U16 /a> },> 674 /a>        [ a href="+code=CTA_PROTONAT_PORT_MAX" class="sref">CTA_PROTONAT_PORT_MAX /a>] = { . a href="+code=type" class="sref">type /a> =  a href="+code=NLA_U16" class="sref">NLA_U16 /a> },> 675 /a>};> 6760 677 /a>static int  a href="+code=nfnetlink_parse_nat_proto" class="sref">nfnetlink_parse_nat_proto /a>(struct  a href="+code=nlattr" class="sref">nlattr /a> * a href="+code=attr" class="sref">attr /a>,> 678 /a>                                     const struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>,> 679 /a>                                     struct  a href="+code=nf_nat_range" class="sref">nf_nat_range /a> * a href="+code=range" class="sref">range /a>)> 680 /a>{> 681 /a>        struct  a href="+code=nlattr" class="sref">nlattr /a> * a href="+code=tb" class="sref">tb /a>[ a href="+code=CTA_PROTONAT_MAX" class="sref">CTA_PROTONAT_MAX /a>+1];> 682 /a>        const struct  a href="+code=nf_nat_l4proto" class="sref">nf_nat_l4proto /a> * a href="+code=l4proto" class="sref">l4proto /a>;> 683 /a>        int  a href="+code=err" class="sref">err /a>;> 684 /a>> 685 /a>         a href="+code=err" class="sref">err /a> =  a href="+code=nla_parse_nested" class="sref">nla_parse_nested /a>( a href="+code=tb" class="sref">tb /a>,  a href="+code=CTA_PROTONAT_MAX" class="sref">CTA_PROTONAT_MAX /a>,  a href="+code=attr" class="sref">attr /a>,  a href="+code=protonat_nla_policy" class="sref">protonat_nla_policy /a>);> 686 /a>        if ( a href="+code=err" class="sref">err /a> < 0)> 687 /a>                return  a href="+code=err" class="sref">err /a>;> 6880 689 /a>         a href="+code=l4proto" class="sref">l4proto /a> =  a href="+code=__nf_nat_l4proto_find" class="sref">__nf_nat_l4proto_find /a>( a href="+code=nf_ct_l3num" class="sref">nf_ct_l3num /a>( a href="+code=ct" class="sref">ct /a>),  a href="+code=nf_ct_protonum" class="sref">nf_ct_protonum /a>( a href="+code=ct" class="sref">ct /a>));> 690 /a>        if ( a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=nlattr_to_range" class="sref">nlattr_to_range /a>)> 691 /a>                 a href="+code=err" class="sref">err /a> =  a href="+code=l4proto" class="sref">l4proto /a>-> a href="+code=nlattr_to_range" class="sref">nlattr_to_range /a>( a href="+code=tb" class="sref">tb /a>,  a href="+code=range" class="sref">range /a>);> 692 /a>> 693 /a>        return  a href="+code=err" class="sref">err /a>;> 694 /a>}> 695 /a>> 6960nla_policy /a>  a href="+code=nat_nla_policy" class="sref">nat_nla_policy /a>[ a href="+code=CTA_NAT_MAX" class="sref">CTA_NAT_MAX /a>+1] = {> 697 /a>        [ a href="+code=CTA_NAT_V4_MINIP" class="sref">CTA_NAT_V4_MINIP /a>]      = { . a href="+code=type" class="sref">type /a> =  a href="+code=NLA_U32" class="sref">NLA_U32 /a> },> 698 /a>        [ a href="+code=CTA_NAT_V4_MAXIP" class="sref">CTA_NAT_V4_MAXIP /a>]      = { . a href="+code=type" class="sref">type /a> =  a href="+code=NLA_U32" class="sref">NLA_U32 /a> },> 699 /a>        [ a href="+code=CTA_NAT_V6_MINIP" class="sref">CTA_NAT_V6_MINIP /a>]      = { . a href="+code=len" class="sref">len /a> = sizeof(struct  a href="+code=in6_addr" class="sref">in6_addr /a>) },> 700 /a>        [ a href="+code=CTA_NAT_V6_MAXIP" class="sref">CTA_NAT_V6_MAXIP /a>]      = { . a href="+code=len" class="sref">len /a> = sizeof(struct  a href="+code=in6_addr" class="sref">in6_addr /a>) },> 701 /a>        [ a href="+code=CTA_NAT_PROTO" class="sref">CTA_NAT_PROTO /a>]         = { . a href="+code=type" class="sref">type /a> =  a href="+code=NLA_NESTED" class="sref">NLA_NESTED /a> },> 702 /a>};> 703 /a>> 704 /a>static int> 705 /a> a href="+code=nfnetlink_parse_nat" class="sref">nfnetlink_parse_nat /a>(const struct  a href="+code=nlattr" class="sref">nlattr /a> * a href="+code=nat" class="sref">nat /a>,> 706 /a>                    const struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>, struct  a href="+code=nf_nat_range" class="sref">nf_nat_range /a> * a href="+code=range" class="sref">range /a>)> 707 /a>{> 708 /a>        const struct  a href="+code=nf_nat_l3proto" class="sref">nf_nat_l3proto /a> * a href="+code=l3proto" class="sref">l3proto /a>;> 709 /a>        struct  a href="+code=nlattr" class="sref">nlattr /a> * a href="+code=tb" class="sref">tb /a>[ a href="+code=CTA_NAT_MAX" class="sref">CTA_NAT_MAX /a>+1];> 710 /a>        int  a href="+code=err" class="sref">err /a>;> 7110 712 /a>         a href="+code=memset" class="sref">memset /a>( a href="+code=range" class="sref">range /a>, 0, sizeof(* a href="+code=range" class="sref">range /a>));> 713 /a>> 714 /a>         a href="+code=err" class="sref">err /a> =  a href="+code=nla_parse_nested" class="sref">nla_parse_nested /a>( a href="+code=tb" class="sref">tb /a>,  a href="+code=CTA_NAT_MAX" class="sref">CTA_NAT_MAX /a>,  a href="+code=nat" class="sref">nat /a>,  a href="+code=nat_nla_policy" class="sref">nat_nla_policy /a>);> 715 /a>        if ( a href="+code=err" class="sref">err /a> < 0)> 716 /a>                return  a href="+code=err" class="sref">err /a>;> 717 /a>> 718 /a>         a href="+code=rcu_read_lock" class="sref">rcu_read_lock /a>();> 719 /a>         a href="+code=l3proto" class="sref">l3proto /a> =  a href="+code=__nf_nat_l3proto_find" class="sref">__nf_nat_l3proto_find /a>( a href="+code=nf_ct_l3num" class="sref">nf_ct_l3num /a>( a href="+code=ct" class="sref">ct /a>));> 720 /a>        if ( a href="+code=l3proto" class="sref">l3proto /a> ==  a href="+code=NULL" class="sref">NULL /a>) {> 721 /a>                 a href="+code=err" class="sref">err /a> = - a href="+code=EAGAIN" class="sref">EAGAIN /a>;> 722 /a>                goto  a href="+code=out" class="sref">out /a>;> 723 /a>        }> 724 /a>         a href="+code=err" class="sref">err /a> =  a href="+code=l3proto" class="sref">l3proto /a>-> a href="+code=nlattr_to_range" class="sref">nlattr_to_range /a>( a href="+code=tb" class="sref">tb /a>,  a href="+code=range" class="sref">range /a>);> 725 /a>        if ( a href="+code=err" class="sref">err /a> < 0)> 726 /a>                goto  a href="+code=out" class="sref">out /a>;> 727 /a>> 728 /a>        if (! a href="+code=tb" class="sref">tb /a>[ a href="+code=CTA_NAT_PROTO" class="sref">CTA_NAT_PROTO /a>])> 729 /a>                goto  a href="+code=out" class="sref">out /a>;> 7310 731 /a>         a href="+code=err" class="sref">err /a> =  a href="+code=nfnetlink_parse_nat_proto" class="sref">nfnetlink_parse_nat_proto /a>( a href="+code=tb" class="sref">tb /a>[ a href="+code=CTA_NAT_PROTO" class="sref">CTA_NAT_PROTO /a>],  a href="+code=ct" class="sref">ct /a>,  a href="+code=range" class="sref">range /a>);> 732 /a> a href="+code=out" class="sref">out /a>:> 733 /a>         a href="+code=rcu_read_unlock" class="sref">rcu_read_unlock /a>();> 734 /a>        return  a href="+code=err" class="sref">err /a>;> 735 /a>}> 7360 737 /a>static int> 7380nfnetlink_parse_nat_setup /a>(struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>,> 739 /a>                          enum  a href="+code=nf_nat_manip_type" class="sref">nf_nat_manip_type /a>  a href="+code=manip" class="sref">manip /a>,> 740 /a>                          const struct  a href="+code=nlattr" class="sref">nlattr /a> * a href="+code=attr" class="sref">attr /a>)> 741 /a>{> 742 /a>        struct  a href="+code=nf_nat_range" class="sref">nf_nat_range /a>  a href="+code=range" class="sref">range /a>;> 743 /a>        int  a href="+code=err" class="sref">err /a>;> 744 /a>> 745 /a>         a href="+code=err" class="sref">err /a> =  a href="+code=nfnetlink_parse_nat" class="sref">nfnetlink_parse_nat /a>( a href="+code=attr" class="sref">attr /a>,  a href="+code=ct" class="sref">ct /a>, & a href="+code=range" class="sref">range /a>);> 746 /a>        if ( a href="+code=err" class="sref">err /a> < 0)> 747 /a>                return  a href="+code=err" class="sref">err /a>;> 748 /a>        if ( a href="+code=nf_nat_initialized" class="sref">nf_nat_initialized /a>( a href="+code=ct" class="sref">ct /a>,  a href="+code=manip" class="sref">manip /a>))> 749 /a>                return - a href="+code=EEXIST" class="sref">EEXIST /a>;> 7510 751 /a>        return  a href="+code=nf_nat_setup_info" class="sref">nf_nat_setup_info /a>( a href="+code=ct" class="sref">ct /a>, & a href="+code=range" class="sref">range /a>,  a href="+code=manip" class="sref">manip /a>);> 752 /a>}> 753 /a>#else> 754 /a>static int> 755 /a> a href="+code=nfnetlink_parse_nat_setup" class="sref">nfnetlink_parse_nat_setup /a>(struct  a href="+code=nf_conn" class="sref">nf_conn /a> * a href="+code=ct" class="sref">ct /a>,> 756 /a>                          enum  a href="+code=nf_nat_manip_type" class="sref">nf_nat_manip_type /a>  a href="+code=manip" class="sref">manip /a>,> 757 /a>                          const struct  a href="+code=nlattr" class="sref">nlattr /a> * a href="+code=attr" class="sref">attr /a>)> 7580 759 /a>        return - a href="+code=EOPNOTSUPP" class="sref">EOPNOTSUPP /a>;> 760 /a>}> 761 /a>#endif> 762 /a>> 763 /a>static int  a href="+code=__net_init" class="sref">__net_init /a>  a href="+code=nf_nat_net_init" class="sref">nf_nat_net_init /a>(struct  a href="+code=net" class="sref">net /a> * a href="+code=net" class="sref">net /a>)> 764 /a>{> 765 /a>         spao class="comment">/* Leave them the samu for the moment. */ /spaon> 766 /a>         a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_htable_size" class="sref">nat_htable_size /a> =  a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=htable_size" class="sref">htable_size /a>;> 767 /a>         a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_bysource" class="sref">nat_bysource /a> =  a href="+code=nf_ct_alloc_hashtable" class="sref">nf_ct_alloc_hashtable /a>(& a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_htable_size" class="sref">nat_htable_size /a>, 0);> 768 /a>        if (! a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_bysource" class="sref">nat_bysource /a>)> 769 /a>                return - a href="+code=ENOMEM" class="sref">ENOMEM /a>;> 770 /a>        return 0;> 7710 772 /a>> 773 /a>static void  a href="+code=__net_exit" class="sref">__net_exit /a>  a href="+code=nf_nat_net_exit" class="sref">nf_nat_net_exit /a>(struct  a href="+code=net" class="sref">net /a> * a href="+code=net" class="sref">net /a>)> 774 /a>{> 775 /a>        struct  a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>  a href="+code=clean" class="sref">clean /a> = {};> 7760 777 /a>         a href="+code=nf_ct_iterate_cleanup" class="sref">nf_ct_iterate_cleanup /a>( a href="+code=net" class="sref">net /a>, & a href="+code=nf_nat_proto_clean" class="sref">nf_nat_proto_clean /a>, & a href="+code=clean" class="sref">clean /a>);> 778 /a>         a href="+code=synchronize_rcu" class="sref">synchronize_rcu /a>();> 779 /a>         a href="+code=nf_ct_free_hashtable" class="sref">nf_ct_free_hashtable /a>( a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_bysource" class="sref">nat_bysource /a>,  a href="+code=net" class="sref">net /a>-> a href="+code=ct" class="sref">ct /a>. a href="+code=nat_htable_size" class="sref">nat_htable_size /a>);> 780 /a>}> 7810 782 /a>static struct  a href="+code=pernet_operations" class="sref">pernet_operations /a>  a href="+code=nf_nat_net_ops" class="sref">nf_nat_net_ops /a> = {> 783 /a>        . a href="+code=init" class="sref">init /a> =  a href="+code=nf_nat_net_init" class="sref">nf_nat_net_init /a>,> 784 /a>        . a href="+code=exit" class="sref">exit /a> =  a href="+code=nf_nat_net_exit" class="sref">nf_nat_net_exit /a>,> 785 /a>};> 7860 787 /a>static struct  a href="+code=nf_ct_helper_expectfn" class="sref">nf_ct_helper_expectfn /a>  a href="+code=follow_master_nat" class="sref">follow_master_nat /a> = {> 788 /a>        . a href="+code=namu" class="sref">name /a>           =  spao class="string">"nat-follow-master" /spaon,> 789 /a>        . a href="+code=expectfn" class="sref">expectfn /a>       =  a href="+code=nf_nat_follow_master" class="sref">nf_nat_follow_master /a>,> 790 /a>};> 7910 792 /a>static struct  a href="+code=nfq_ct_nat_hook" class="sref">nfq_ct_nat_hook /a>  a href="+code=nfq_ct_nat" class="sref">nfq_ct_nat /a> = {> 793 /a>        . a href="+code=seq_adjust" class="sref">seq_adjust /a>     =  a href="+code=nf_nat_tcp_seq_adjust" class="sref">nf_nat_tcp_seq_adjust /a>,> 794 /a>};> 795 /a>> 7960__init /a>  a href="+code=nf_nat_init" class="sref">nf_nat_init /a>(void)> 797 /a>{> 798 /a>        int  a href="+code=ret" class="sref">ret /a>;> 7990 800 /a>         a href="+code=ret" class="sref">ret /a> =  a href="+code=nf_ct_extend_register" class="sref">nf_ct_extend_register /a>(& a href="+code=nat_extend" class="sref">nat_extend /a>);> 801 /a>        if ( a href="+code=ret" class="sref">ret /a> < 0) {> 802 /a>                 a href="+code=printk" class="sref">printk /a>( a href="+code=KERN_ERR" class="sref">KERN_ERR /a>  spao class="string">"nf_nat_core: Unable to register extension\n" /spaon);> 803 /a>                return  a href="+code=ret" class="sref">ret /a>;> 804 /a>        }> 805 /a>> 806 /a>         a href="+code=ret" class="sref">ret /a> =  a href="+code=register_pernet_subsys" class="sref">register_pernet_subsys /a>(& a href="+code=nf_nat_net_ops" class="sref">nf_nat_net_ops /a>);> 807 /a>        if ( a href="+code=ret" class="sref">ret /a> < 0)> 808 /a>                goto  a href="+code=cleanup_extend" class="sref">cleanup_extend /a>;> 8090 810 /a>         a href="+code=nf_ct_helper_expectfn_register" class="sref">nf_ct_helper_expectfn_register /a>(& a href="+code=follow_master_nat" class="sref">follow_master_nat /a>);> 8110 812 /a>         spao class="comment">/* Initialize fake conntrack so that NAT will skip it */ /spaon> 813 /a>         a href="+code=nf_ct_untracked_status_or" class="sref">nf_ct_untracked_status_or /a>( a href="+code=IPS_NAT_DONE_MASK" class="sref">IPS_NAT_DONE_MASK /a>);> 814 /a>> 815 /a>         a href="+code=BUG_ON" class="sref">BUG_ON /a>( a href="+code=nf_nat_seq_adjust_hook" class="sref">nf_nat_seq_adjust_hook /a> !=  a href="+code=NULL" class="sref">NULL /a>);> 816 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_seq_adjust_hook" class="sref">nf_nat_seq_adjust_hook /a>,  a href="+code=nf_nat_seq_adjust" class="sref">nf_nat_seq_adjust /a>);> 817 /a>         a href="+code=BUG_ON" class="sref">BUG_ON /a>( a href="+code=nfnetlink_parse_nat_setup_hook" class="sref">nfnetlink_parse_nat_setup_hook /a> !=  a href="+code=NULL" class="sref">NULL /a>);> 818 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nfnetlink_parse_nat_setup_hook" class="sref">nfnetlink_parse_nat_setup_hook /a>,> 819 /a>                            a href="+code=nfnetlink_parse_nat_setup" class="sref">nfnetlink_parse_nat_setup /a>);> 820 /a>         a href="+code=BUG_ON" class="sref">BUG_ON /a>( a href="+code=nf_ct_nat_offset" class="sref">nf_ct_nat_offset /a> !=  a href="+code=NULL" class="sref">NULL /a>);> 821 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_ct_nat_offset" class="sref">nf_ct_nat_offset /a>,  a href="+code=nf_nat_get_offset" class="sref">nf_nat_get_offset /a>);> 822 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nfq_ct_nat_hook" class="sref">nfq_ct_nat_hook /a>, & a href="+code=nfq_ct_nat" class="sref">nfq_ct_nat /a>);> 823 /a>#ifdef  a href="+code=CONFIG_XFRM" class="sref">CONFIG_XFRM /a>> 824 /a>         a href="+code=BUG_ON" class="sref">BUG_ON /a>( a href="+code=nf_nat_decode_session_hook" class="sref">nf_nat_decode_session_hook /a> !=  a href="+code=NULL" class="sref">NULL /a>);> 825 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_decode_session_hook" class="sref">nf_nat_decode_session_hook /a>,  a href="+code=__nf_nat_decode_session" class="sref">__nf_nat_decode_session /a>);> 826 /a>#endif> 827 /a>        return 0;> 8280 829 /a>  a href="+code=cleanup_extend" class="sref">cleanup_extend /a>:> 830 /a>         a href="+code=nf_ct_extend_unregister" class="sref">nf_ct_extend_unregister /a>(& a href="+code=nat_extend" class="sref">nat_extend /a>);> 831 /a>        return  a href="+code=ret" class="sref">ret /a>;> 832 /a>}> 833 /a>> 834 /a>static void  a href="+code=__exit" class="sref">__exit /a>  a href="+code=nf_nat_cleanup" class="sref">nf_nat_cleanup /a>(void)> 835 /a>{> 836 /a>        unsigned int  a href="+code=i" class="sref">i /a>;> 837 /a>> 838 /a>         a href="+code=unregister_pernet_subsys" class="sref">unregister_pernet_subsys /a>(& a href="+code=nf_nat_net_ops" class="sref">nf_nat_net_ops /a>);> 839 /a>         a href="+code=nf_ct_extend_unregister" class="sref">nf_ct_extend_unregister /a>(& a href="+code=nat_extend" class="sref">nat_extend /a>);> 840 /a>         a href="+code=nf_ct_helper_expectfn_unregister" class="sref">nf_ct_helper_expectfn_unregister /a>(& a href="+code=follow_master_nat" class="sref">follow_master_nat /a>);> 841 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_seq_adjust_hook" class="sref">nf_nat_seq_adjust_hook /a>,  a href="+code=NULL" class="sref">NULL /a>);> 842 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nfnetlink_parse_nat_setup_hook" class="sref">nfnetlink_parse_nat_setup_hook /a>,  a href="+code=NULL" class="sref">NULL /a>);> 843 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_ct_nat_offset" class="sref">nf_ct_nat_offset /a>,  a href="+code=NULL" class="sref">NULL /a>);> 844 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nfq_ct_nat_hook" class="sref">nfq_ct_nat_hook /a>,  a href="+code=NULL" class="sref">NULL /a>);> 845 /a>#ifdef  a href="+code=CONFIG_XFRM" class="sref">CONFIG_XFRM /a>> 846 /a>         a href="+code=RCU_INIT_POINTER" class="sref">RCU_INIT_POINTER /a>( a href="+code=nf_nat_decode_session_hook" class="sref">nf_nat_decode_session_hook /a>,  a href="+code=NULL" class="sref">NULL /a>);> 847 /a>#endif> 848 /a>        for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <  a href="+code=NFPROTO_NUMPROTO" class="sref">NFPROTO_NUMPROTO /a>;  a href="+code=i" class="sref">i /a>++)> 849 /a>                 a href="+code=kfree" class="sref">kfree /a>( a href="+code=nf_nat_l4protos" class="sref">nf_nat_l4protos /a>[ a href="+code=i" class="sref">i /a>]);> 850 /a>         a href="+code=synchronize_net" class="sref">synchronize_net /a>();> 8510 852 /a>> 853 /a> a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE /a>( spao class="string">"GPL" /spaon);> 854 /a>> 855 /a> a href="+code=module_init" class="sref">module_init /a>( a href="+code=nf_nat_init" class="sref">nf_nat_init /a>);> 856 /a> a href="+code=module_exit" class="sref">module_exit /a>( a href="+code=nf_nat_cleanup" class="sref">nf_nat_cleanup /a>);> 857 /a>
lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and operations services since 1995.