github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/abi/linux/ip.go (about)

     1  // Copyright 2018 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package linux
    16  
    17  // IP protocols
    18  const (
    19  	IPPROTO_IP      = 0
    20  	IPPROTO_ICMP    = 1
    21  	IPPROTO_IGMP    = 2
    22  	IPPROTO_IPIP    = 4
    23  	IPPROTO_TCP     = 6
    24  	IPPROTO_EGP     = 8
    25  	IPPROTO_PUP     = 12
    26  	IPPROTO_UDP     = 17
    27  	IPPROTO_IDP     = 22
    28  	IPPROTO_TP      = 29
    29  	IPPROTO_DCCP    = 33
    30  	IPPROTO_IPV6    = 41
    31  	IPPROTO_RSVP    = 46
    32  	IPPROTO_GRE     = 47
    33  	IPPROTO_ESP     = 50
    34  	IPPROTO_AH      = 51
    35  	IPPROTO_ICMPV6  = 58
    36  	IPPROTO_MTP     = 92
    37  	IPPROTO_BEETPH  = 94
    38  	IPPROTO_ENCAP   = 98
    39  	IPPROTO_PIM     = 103
    40  	IPPROTO_COMP    = 108
    41  	IPPROTO_SCTP    = 132
    42  	IPPROTO_UDPLITE = 136
    43  	IPPROTO_MPLS    = 137
    44  	IPPROTO_RAW     = 255
    45  )
    46  
    47  // Socket options from uapi/linux/in.h
    48  const (
    49  	IP_TOS                    = 1
    50  	IP_TTL                    = 2
    51  	IP_HDRINCL                = 3
    52  	IP_OPTIONS                = 4
    53  	IP_ROUTER_ALERT           = 5
    54  	IP_RECVOPTS               = 6
    55  	IP_RETOPTS                = 7
    56  	IP_PKTINFO                = 8
    57  	IP_PKTOPTIONS             = 9
    58  	IP_MTU_DISCOVER           = 10
    59  	IP_RECVERR                = 11
    60  	IP_RECVTTL                = 12
    61  	IP_RECVTOS                = 13
    62  	IP_MTU                    = 14
    63  	IP_FREEBIND               = 15
    64  	IP_IPSEC_POLICY           = 16
    65  	IP_XFRM_POLICY            = 17
    66  	IP_PASSSEC                = 18
    67  	IP_TRANSPARENT            = 19
    68  	IP_ORIGDSTADDR            = 20
    69  	IP_RECVORIGDSTADDR        = IP_ORIGDSTADDR
    70  	IP_MINTTL                 = 21
    71  	IP_NODEFRAG               = 22
    72  	IP_CHECKSUM               = 23
    73  	IP_BIND_ADDRESS_NO_PORT   = 24
    74  	IP_RECVFRAGSIZE           = 25
    75  	IP_MULTICAST_IF           = 32
    76  	IP_MULTICAST_TTL          = 33
    77  	IP_MULTICAST_LOOP         = 34
    78  	IP_ADD_MEMBERSHIP         = 35
    79  	IP_DROP_MEMBERSHIP        = 36
    80  	IP_UNBLOCK_SOURCE         = 37
    81  	IP_BLOCK_SOURCE           = 38
    82  	IP_ADD_SOURCE_MEMBERSHIP  = 39
    83  	IP_DROP_SOURCE_MEMBERSHIP = 40
    84  	IP_MSFILTER               = 41
    85  	MCAST_JOIN_GROUP          = 42
    86  	MCAST_BLOCK_SOURCE        = 43
    87  	MCAST_UNBLOCK_SOURCE      = 44
    88  	MCAST_LEAVE_GROUP         = 45
    89  	MCAST_JOIN_SOURCE_GROUP   = 46
    90  	MCAST_LEAVE_SOURCE_GROUP  = 47
    91  	MCAST_MSFILTER            = 48
    92  	IP_MULTICAST_ALL          = 49
    93  	IP_UNICAST_IF             = 50
    94  )
    95  
    96  // IP_MTU_DISCOVER values from uapi/linux/in.h
    97  const (
    98  	IP_PMTUDISC_DONT      = 0
    99  	IP_PMTUDISC_WANT      = 1
   100  	IP_PMTUDISC_DO        = 2
   101  	IP_PMTUDISC_PROBE     = 3
   102  	IP_PMTUDISC_INTERFACE = 4
   103  	IP_PMTUDISC_OMIT      = 5
   104  )
   105  
   106  // Socket options from uapi/linux/in6.h
   107  const (
   108  	IPV6_ADDRFORM         = 1
   109  	IPV6_2292PKTINFO      = 2
   110  	IPV6_2292HOPOPTS      = 3
   111  	IPV6_2292DSTOPTS      = 4
   112  	IPV6_2292RTHDR        = 5
   113  	IPV6_2292PKTOPTIONS   = 6
   114  	IPV6_CHECKSUM         = 7
   115  	IPV6_2292HOPLIMIT     = 8
   116  	IPV6_NEXTHOP          = 9
   117  	IPV6_FLOWINFO         = 11
   118  	IPV6_UNICAST_HOPS     = 16
   119  	IPV6_MULTICAST_IF     = 17
   120  	IPV6_MULTICAST_HOPS   = 18
   121  	IPV6_MULTICAST_LOOP   = 19
   122  	IPV6_ADD_MEMBERSHIP   = 20
   123  	IPV6_DROP_MEMBERSHIP  = 21
   124  	IPV6_ROUTER_ALERT     = 22
   125  	IPV6_MTU_DISCOVER     = 23
   126  	IPV6_MTU              = 24
   127  	IPV6_RECVERR          = 25
   128  	IPV6_V6ONLY           = 26
   129  	IPV6_JOIN_ANYCAST     = 27
   130  	IPV6_LEAVE_ANYCAST    = 28
   131  	IPV6_MULTICAST_ALL    = 29
   132  	IPV6_FLOWLABEL_MGR    = 32
   133  	IPV6_FLOWINFO_SEND    = 33
   134  	IPV6_IPSEC_POLICY     = 34
   135  	IPV6_XFRM_POLICY      = 35
   136  	IPV6_HDRINCL          = 36
   137  	IPV6_RECVPKTINFO      = 49
   138  	IPV6_PKTINFO          = 50
   139  	IPV6_RECVHOPLIMIT     = 51
   140  	IPV6_HOPLIMIT         = 52
   141  	IPV6_RECVHOPOPTS      = 53
   142  	IPV6_HOPOPTS          = 54
   143  	IPV6_RTHDRDSTOPTS     = 55
   144  	IPV6_RECVRTHDR        = 56
   145  	IPV6_RTHDR            = 57
   146  	IPV6_RECVDSTOPTS      = 58
   147  	IPV6_DSTOPTS          = 59
   148  	IPV6_RECVPATHMTU      = 60
   149  	IPV6_PATHMTU          = 61
   150  	IPV6_DONTFRAG         = 62
   151  	IPV6_RECVTCLASS       = 66
   152  	IPV6_TCLASS           = 67
   153  	IPV6_AUTOFLOWLABEL    = 70
   154  	IPV6_ADDR_PREFERENCES = 72
   155  	IPV6_MINHOPCOUNT      = 73
   156  	IPV6_ORIGDSTADDR      = 74
   157  	IPV6_RECVORIGDSTADDR  = IPV6_ORIGDSTADDR
   158  	IPV6_TRANSPARENT      = 75
   159  	IPV6_UNICAST_IF       = 76
   160  	IPV6_RECVFRAGSIZE     = 77
   161  	IPV6_FREEBIND         = 78
   162  )
   163  
   164  // Socket options from uapi/linux/icmpv6.h
   165  const (
   166  	ICMPV6_FILTER = 1
   167  )