libipt_SNAT.c revision b77f1dafb9f35752bb9685323bcacb32a0e6ddc5
1e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Shared library add-on to iptables to add source-NAT support. */ 2e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#include <stdio.h> 3e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#include <netdb.h> 4e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#include <string.h> 5e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#include <stdlib.h> 6e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#include <getopt.h> 7e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#include <iptables.h> 8e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#include <linux/netfilter_ipv4/ip_tables.h> 9e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#include <linux/netfilter_ipv4/ip_nat_rule.h> 10e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 11e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Source NAT data consists of a multi-range, indicating where to map 12e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher to. */ 13e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstruct ipt_natinfo 14e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 15e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct ipt_entry_target t; 16e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct ip_nat_multi_range mr; 17e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher}; 18e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 19e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Function which prints out usage message. */ 20e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic void 21e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherhelp(void) 22e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 23e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf( 24e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher"SNAT v%s options:\n" 25e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher" --to-source <ipaddr>[-<ipaddr>][:port-port]\n" 26e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher" Address to map source to.\n" 27e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher" (You can use this more than once)\n\n", 28e6869a8f59d779ff4d5a0984c86d80db7078496Marc BoucherNETFILTER_VERSION); 29e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 30e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 31e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic struct option opts[] = { 32e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher { "to-source", 1, 0, '1' }, 33e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher { 0 } 34e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher}; 35e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 36e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Initialize the target. */ 37e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic void 38e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherinit(struct ipt_entry_target *t, unsigned int *nfcache) 39e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 40e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher /* Can't cache this */ 41e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher *nfcache |= NFC_UNKNOWN; 42e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 43e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 44e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic struct ipt_natinfo * 45e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherappend_range(struct ipt_natinfo *info, const struct ip_nat_range *range) 46e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 47e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher unsigned int size; 48e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 49e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher /* One rangesize already in struct ipt_natinfo */ 50e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher size = IPT_ALIGN(sizeof(*info) + info->mr.rangesize * sizeof(*range)); 51e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 52e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher info = realloc(info, size); 53e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (!info) 54e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(OTHER_PROBLEM, "Out of memory\n"); 55e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 56228e98dd6303af11925235af4cf3c3ec450f3f41Rusty Russell info->t.u.target_size = size; 57e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher info->mr.range[info->mr.rangesize] = *range; 58e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher info->mr.rangesize++; 59e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 60e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher return info; 61e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 62e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 63e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Ranges expected in network order. */ 64e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic struct ipt_entry_target * 65e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherparse_to(char *arg, int portok, struct ipt_natinfo *info) 66e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 67e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct ip_nat_range range; 68e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher char *colon, *dash; 69e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct in_addr *ip; 70e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 71e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher memset(&range, 0, sizeof(range)); 72e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher colon = strchr(arg, ':'); 73e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 74e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (colon) { 75e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher int port; 76e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 77e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (!portok) 78e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(PARAMETER_PROBLEM, 79e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher "Need TCP or UDP with port specification"); 80e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 81e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher range.flags |= IP_NAT_RANGE_PROTO_SPECIFIED; 82e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 83e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher port = atoi(colon+1); 84e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (port == 0 || port > 65535) 85e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(PARAMETER_PROBLEM, 86e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher "Port `%s' not valid\n", colon+1); 87e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 88e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher dash = strchr(colon, '-'); 89e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (!dash) { 90e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher range.min.tcp.port 91e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher = range.max.tcp.port 92e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher = htons(port); 93e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } else { 94e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher int maxport; 95e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 96e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher maxport = atoi(dash + 1); 97e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (maxport == 0 || maxport > 65535) 98e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(PARAMETER_PROBLEM, 99e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher "Port `%s' not valid\n", dash+1); 100e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (maxport < port) 101e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher /* People are stupid. */ 102e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(PARAMETER_PROBLEM, 103e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher "Port range `%s' funky\n", colon+1); 104e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher range.min.tcp.port = htons(port); 105e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher range.max.tcp.port = htons(maxport); 106e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } 107e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher /* Starts with a colon? No IP info...*/ 108e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (colon == arg) 109e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher return &(append_range(info, &range)->t); 110e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher *colon = '\0'; 111e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } 112e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 113e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher range.flags |= IP_NAT_RANGE_MAP_IPS; 114e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher dash = strchr(arg, '-'); 115e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (colon && dash && dash > colon) 116e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher dash = NULL; 117e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 118e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (dash) 119e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher *dash = '\0'; 120e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 121e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher ip = dotted_to_addr(arg); 122e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (!ip) 123e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(PARAMETER_PROBLEM, "Bad IP address `%s'\n", 124e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher arg); 125e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher range.min_ip = ip->s_addr; 126e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (dash) { 127e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher ip = dotted_to_addr(dash+1); 128e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (!ip) 129e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(PARAMETER_PROBLEM, "Bad IP address `%s'\n", 130e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher dash+1); 131e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher range.max_ip = ip->s_addr; 132e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } else 133e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher range.max_ip = range.min_ip; 134e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 135e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher return &(append_range(info, &range)->t); 136e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 137e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 138e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Function which parses command options; returns true if it 139e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher ate an option */ 140e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic int 141e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherparse(int c, char **argv, int invert, unsigned int *flags, 142e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher const struct ipt_entry *entry, 143e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct ipt_entry_target **target) 144e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 145e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct ipt_natinfo *info = (void *)*target; 146e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher int portok; 147e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 148e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (entry->ip.proto == IPPROTO_TCP 149e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher || entry->ip.proto == IPPROTO_UDP) 150e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher portok = 1; 151e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher else 152e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher portok = 0; 153e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 154e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher switch (c) { 155e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher case '1': 156b77f1dafb9f35752bb9685323bcacb32a0e6ddc5Harald Welte if (check_inverse(optarg, &invert, NULL, 0)) 157e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(PARAMETER_PROBLEM, 158e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher "Unexpected `!' after --to-source"); 159e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 160e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher *target = parse_to(optarg, portok, info); 161e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher *flags = 1; 162e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher return 1; 163e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 164e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher default: 165e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher return 0; 166e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } 167e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 168e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 169e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Final check; must have specfied --to-source. */ 170e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic void final_check(unsigned int flags) 171e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 172e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (!flags) 173e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher exit_error(PARAMETER_PROBLEM, 174e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher "You must specify --to-source"); 175e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 176e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 177e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic void print_range(const struct ip_nat_range *r) 178e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 179e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (r->flags & IP_NAT_RANGE_MAP_IPS) { 180e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct in_addr a; 181e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 182e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher a.s_addr = r->min_ip; 183e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf("%s", addr_to_dotted(&a)); 184e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (r->max_ip != r->min_ip) { 185e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher a.s_addr = r->max_ip; 186e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf("-%s", addr_to_dotted(&a)); 187e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } 188e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } 189e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (r->flags & IP_NAT_RANGE_PROTO_SPECIFIED) { 190e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf(":"); 191e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf("%hu", ntohs(r->min.tcp.port)); 192e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher if (r->max.tcp.port != r->min.tcp.port) 193e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf("-%hu", ntohs(r->max.tcp.port)); 194e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } 195e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 196e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 197e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Prints out the targinfo. */ 198e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic void 199e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherprint(const struct ipt_ip *ip, 200e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher const struct ipt_entry_target *target, 201e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher int numeric) 202e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 203e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct ipt_natinfo *info = (void *)target; 204e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher unsigned int i = 0; 205e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 206e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf("to:"); 207e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher for (i = 0; i < info->mr.rangesize; i++) { 208e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher print_range(&info->mr.range[i]); 209e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf(" "); 210e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } 211e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 212e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 213e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Saves the union ipt_targinfo in parsable form to stdout. */ 214e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstatic void 215e6869a8f59d779ff4d5a0984c86d80db7078496Marc Bouchersave(const struct ipt_ip *ip, const struct ipt_entry_target *target) 216e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 217e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher struct ipt_natinfo *info = (void *)target; 218e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher unsigned int i = 0; 219e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 220e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher for (i = 0; i < info->mr.rangesize; i++) { 221e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf("--to-source "); 222e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher print_range(&info->mr.range[i]); 223e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher printf(" "); 224e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher } 225e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 226e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 2273efb6ead2e51fe1eca55bcb2b06afb4dc4b8cb7cHarald Weltestatic 228e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherstruct iptables_target snat 229e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher= { NULL, 230e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher "SNAT", 231e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher NETFILTER_VERSION, 23273f72f541ac4dab538d4d418b9bbf1707b31342bRusty Russell IPT_ALIGN(sizeof(struct ip_nat_multi_range)), 23373f72f541ac4dab538d4d418b9bbf1707b31342bRusty Russell IPT_ALIGN(sizeof(struct ip_nat_multi_range)), 234e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher &help, 235e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher &init, 236e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher &parse, 237e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher &final_check, 238e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher &print, 239e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher &save, 240e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher opts 241e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher}; 242e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher 243e6869a8f59d779ff4d5a0984c86d80db7078496Marc Bouchervoid _init(void) 244e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher{ 245e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher register_target(&snat); 246e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher} 247