The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet6/ip_fw_nat64.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2015-2019 Yandex LLC
    5  * Copyright (c) 2015 Alexander V. Chernikov <melifaro@FreeBSD.org>
    6  * Copyright (c) 2015-2019 Andrey V. Elsukov <ae@FreeBSD.org>
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  *
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   28  *
   29  * $FreeBSD$
   30  */
   31 
   32 #ifndef _NETINET6_IP_FW_NAT64_H_
   33 #define _NETINET6_IP_FW_NAT64_H_
   34 
   35 struct ipfw_nat64stl_stats {
   36         uint64_t        opcnt64;        /* 6to4 of packets translated */
   37         uint64_t        opcnt46;        /* 4to6 of packets translated */
   38         uint64_t        ofrags;         /* number of fragments generated */
   39         uint64_t        ifrags;         /* number of fragments received */
   40         uint64_t        oerrors;        /* number of output errors */
   41         uint64_t        noroute4;
   42         uint64_t        noroute6;
   43         uint64_t        noproto;        /* Protocol not supported */
   44         uint64_t        nomem;          /* mbuf allocation failed */
   45         uint64_t        dropped;        /* dropped due to some errors */
   46 };
   47 
   48 struct ipfw_nat64clat_stats {
   49         uint64_t        opcnt64;        /* 6to4 of packets translated */
   50         uint64_t        opcnt46;        /* 4to6 of packets translated */
   51         uint64_t        ofrags;         /* number of fragments generated */
   52         uint64_t        ifrags;         /* number of fragments received */
   53         uint64_t        oerrors;        /* number of output errors */
   54         uint64_t        noroute4;
   55         uint64_t        noroute6;
   56         uint64_t        noproto;        /* Protocol not supported */
   57         uint64_t        nomem;          /* mbuf allocation failed */
   58         uint64_t        dropped;        /* dropped due to some errors */
   59 };
   60 
   61 struct ipfw_nat64lsn_stats {
   62         uint64_t        opcnt64;        /* 6to4 of packets translated */
   63         uint64_t        opcnt46;        /* 4to6 of packets translated */
   64         uint64_t        ofrags;         /* number of fragments generated */
   65         uint64_t        ifrags;         /* number of fragments received */
   66         uint64_t        oerrors;        /* number of output errors */
   67         uint64_t        noroute4;
   68         uint64_t        noroute6;
   69         uint64_t        noproto;        /* Protocol not supported */
   70         uint64_t        nomem;          /* mbuf allocation failed */
   71         uint64_t        dropped;        /* dropped due to some errors */
   72 
   73         uint64_t        nomatch4;       /* No addr/port match */
   74         uint64_t        jcalls;         /* Number of job handler calls */
   75         uint64_t        jrequests;      /* Number of job requests */
   76         uint64_t        jhostsreq;      /* Number of job host requests */
   77         uint64_t        jportreq;       /* Number of portgroup requests */
   78         uint64_t        jhostfails;     /* Number of failed host allocs */
   79         uint64_t        jportfails;     /* Number of failed portgroup allocs */
   80         uint64_t        jreinjected;    /* Number of packets reinjected to q */
   81         uint64_t        jmaxlen;        /* Max queue length reached */
   82         uint64_t        jnomem;         /* No memory to alloc queue item */
   83 
   84         uint64_t        screated;       /* Number of states created */
   85         uint64_t        sdeleted;       /* Number of states deleted */
   86         uint64_t        spgcreated;     /* Number of portgroups created */
   87         uint64_t        spgdeleted;     /* Number of portgroups deleted */
   88         uint64_t        hostcount;      /* Number of hosts  */
   89         uint64_t        tcpchunks;      /* Number of TCP chunks */
   90         uint64_t        udpchunks;      /* Number of UDP chunks */
   91         uint64_t        icmpchunks;     /* Number of ICMP chunks */
   92 
   93         uint64_t        _reserved[4];
   94 };
   95 
   96 #define NAT64_LOG               0x0001  /* Enable logging via BPF */
   97 #define NAT64_ALLOW_PRIVATE     0x0002  /* Allow private IPv4 address
   98                                          * translation
   99                                          */
  100 typedef struct _ipfw_nat64stl_cfg {
  101         char            name[64];       /* NAT name                     */
  102         ipfw_obj_ntlv   ntlv6;          /* object name tlv              */
  103         ipfw_obj_ntlv   ntlv4;          /* object name tlv              */
  104         struct in6_addr prefix6;        /* NAT64 prefix */
  105         uint8_t         plen6;          /* Prefix length */
  106         uint8_t         set;            /* Named instance set [0..31] */
  107         uint8_t         spare[2];
  108         uint32_t        flags;
  109 } ipfw_nat64stl_cfg;
  110 
  111 typedef struct _ipfw_nat64clat_cfg {
  112         char            name[64];       /* NAT name                     */
  113         struct in6_addr plat_prefix;    /* NAT64 (PLAT) prefix */
  114         struct in6_addr clat_prefix;    /* Client (CLAT) prefix */
  115         uint8_t         plat_plen;      /* PLAT Prefix length */
  116         uint8_t         clat_plen;      /* CLAT Prefix length */
  117         uint8_t         set;            /* Named instance set [0..31] */
  118         uint8_t         spare;
  119         uint32_t        flags;
  120 } ipfw_nat64clat_cfg;
  121 
  122 /*
  123  * NAT64LSN default configuration values
  124  */
  125 #define NAT64LSN_MAX_PORTS      2048    /* Max number of ports per host */
  126 #define NAT64LSN_JMAXLEN        2048    /* Max outstanding requests. */
  127 #define NAT64LSN_TCP_SYN_AGE    10      /* State's TTL after SYN received. */
  128 #define NAT64LSN_TCP_EST_AGE    (2 * 3600) /* TTL for established connection */
  129 #define NAT64LSN_TCP_FIN_AGE    180     /* State's TTL after FIN/RST received */
  130 #define NAT64LSN_UDP_AGE        120     /* TTL for UDP states */
  131 #define NAT64LSN_ICMP_AGE       60      /* TTL for ICMP states */
  132 #define NAT64LSN_HOST_AGE       3600    /* TTL for stale host entry */
  133 #define NAT64LSN_PG_AGE         900     /* TTL for stale ports groups */
  134 
  135 typedef struct _ipfw_nat64lsn_cfg {
  136         char            name[64];       /* NAT name                     */
  137         uint32_t        flags;
  138         uint32_t        max_ports;      /* Max ports per client */
  139         uint32_t        agg_prefix_len; /* Prefix length to count */
  140         uint32_t        agg_prefix_max; /* Max hosts per agg prefix */
  141         struct in_addr  prefix4;
  142         uint16_t        plen4;          /* Prefix length */
  143         uint16_t        plen6;          /* Prefix length */
  144         struct in6_addr prefix6;        /* NAT64 prefix */
  145         uint32_t        jmaxlen;        /* Max jobqueue length */
  146         uint16_t        min_port;       /* Min port group # to use */
  147         uint16_t        max_port;       /* Max port group # to use */
  148         uint16_t        nh_delete_delay;/* Stale host delete delay */
  149         uint16_t        pg_delete_delay;/* Stale portgroup delete delay */
  150         uint16_t        st_syn_ttl;     /* TCP syn expire */
  151         uint16_t        st_close_ttl;   /* TCP fin expire */
  152         uint16_t        st_estab_ttl;   /* TCP established expire */
  153         uint16_t        st_udp_ttl;     /* UDP expire */
  154         uint16_t        st_icmp_ttl;    /* ICMP expire */
  155         uint8_t         set;            /* Named instance set [0..31] */
  156         uint8_t         spare;
  157 } ipfw_nat64lsn_cfg;
  158 
  159 typedef struct _ipfw_nat64lsn_state {
  160         struct in_addr  daddr;          /* Remote IPv4 address */
  161         uint16_t        dport;          /* Remote destination port */
  162         uint16_t        aport;          /* Local alias port */
  163         uint16_t        sport;          /* Source port */
  164         uint8_t         flags;          /* State flags */
  165         uint8_t         spare[3];
  166         uint16_t        idle;           /* Last used time */
  167 } ipfw_nat64lsn_state;
  168 
  169 typedef struct _ipfw_nat64lsn_stg {
  170         uint64_t        next_idx;       /* next state index */
  171         struct in_addr  alias4;         /* IPv4 alias address */
  172         uint8_t         proto;          /* protocol */
  173         uint8_t         flags;
  174         uint16_t        spare;
  175         struct in6_addr host6;          /* Bound IPv6 host */
  176         uint32_t        count;          /* Number of states */
  177         uint32_t        spare2;
  178 } ipfw_nat64lsn_stg;
  179 
  180 #endif /* _NETINET6_IP_FW_NAT64_H_ */
  181 

Cache object: 75c17e4279e6035dfc47d029f45c97c7


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.