github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/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_MTP = 92 36 IPPROTO_BEETPH = 94 37 IPPROTO_ENCAP = 98 38 IPPROTO_PIM = 103 39 IPPROTO_COMP = 108 40 IPPROTO_SCTP = 132 41 IPPROTO_UDPLITE = 136 42 IPPROTO_MPLS = 137 43 IPPROTO_RAW = 255 44 ) 45 46 // Socket options from uapi/linux/in.h 47 const ( 48 IP_TOS = 1 49 IP_TTL = 2 50 IP_HDRINCL = 3 51 IP_OPTIONS = 4 52 IP_ROUTER_ALERT = 5 53 IP_RECVOPTS = 6 54 IP_RETOPTS = 7 55 IP_PKTINFO = 8 56 IP_PKTOPTIONS = 9 57 IP_MTU_DISCOVER = 10 58 IP_RECVERR = 11 59 IP_RECVTTL = 12 60 IP_RECVTOS = 13 61 IP_MTU = 14 62 IP_FREEBIND = 15 63 IP_IPSEC_POLICY = 16 64 IP_XFRM_POLICY = 17 65 IP_PASSSEC = 18 66 IP_TRANSPARENT = 19 67 IP_ORIGDSTADDR = 20 68 IP_RECVORIGDSTADDR = IP_ORIGDSTADDR 69 IP_MINTTL = 21 70 IP_NODEFRAG = 22 71 IP_CHECKSUM = 23 72 IP_BIND_ADDRESS_NO_PORT = 24 73 IP_RECVFRAGSIZE = 25 74 IP_MULTICAST_IF = 32 75 IP_MULTICAST_TTL = 33 76 IP_MULTICAST_LOOP = 34 77 IP_ADD_MEMBERSHIP = 35 78 IP_DROP_MEMBERSHIP = 36 79 IP_UNBLOCK_SOURCE = 37 80 IP_BLOCK_SOURCE = 38 81 IP_ADD_SOURCE_MEMBERSHIP = 39 82 IP_DROP_SOURCE_MEMBERSHIP = 40 83 IP_MSFILTER = 41 84 MCAST_JOIN_GROUP = 42 85 MCAST_BLOCK_SOURCE = 43 86 MCAST_UNBLOCK_SOURCE = 44 87 MCAST_LEAVE_GROUP = 45 88 MCAST_JOIN_SOURCE_GROUP = 46 89 MCAST_LEAVE_SOURCE_GROUP = 47 90 MCAST_MSFILTER = 48 91 IP_MULTICAST_ALL = 49 92 IP_UNICAST_IF = 50 93 ) 94 95 // IP_MTU_DISCOVER values from uapi/linux/in.h 96 const ( 97 IP_PMTUDISC_DONT = 0 98 IP_PMTUDISC_WANT = 1 99 IP_PMTUDISC_DO = 2 100 IP_PMTUDISC_PROBE = 3 101 IP_PMTUDISC_INTERFACE = 4 102 IP_PMTUDISC_OMIT = 5 103 ) 104 105 // Socket options from uapi/linux/in6.h 106 const ( 107 IPV6_ADDRFORM = 1 108 IPV6_2292PKTINFO = 2 109 IPV6_2292HOPOPTS = 3 110 IPV6_2292DSTOPTS = 4 111 IPV6_2292RTHDR = 5 112 IPV6_2292PKTOPTIONS = 6 113 IPV6_CHECKSUM = 7 114 IPV6_2292HOPLIMIT = 8 115 IPV6_NEXTHOP = 9 116 IPV6_FLOWINFO = 11 117 IPV6_UNICAST_HOPS = 16 118 IPV6_MULTICAST_IF = 17 119 IPV6_MULTICAST_HOPS = 18 120 IPV6_MULTICAST_LOOP = 19 121 IPV6_ADD_MEMBERSHIP = 20 122 IPV6_DROP_MEMBERSHIP = 21 123 IPV6_ROUTER_ALERT = 22 124 IPV6_MTU_DISCOVER = 23 125 IPV6_MTU = 24 126 IPV6_RECVERR = 25 127 IPV6_V6ONLY = 26 128 IPV6_JOIN_ANYCAST = 27 129 IPV6_LEAVE_ANYCAST = 28 130 IPV6_MULTICAST_ALL = 29 131 IPV6_FLOWLABEL_MGR = 32 132 IPV6_FLOWINFO_SEND = 33 133 IPV6_IPSEC_POLICY = 34 134 IPV6_XFRM_POLICY = 35 135 IPV6_HDRINCL = 36 136 IPV6_RECVPKTINFO = 49 137 IPV6_PKTINFO = 50 138 IPV6_RECVHOPLIMIT = 51 139 IPV6_HOPLIMIT = 52 140 IPV6_RECVHOPOPTS = 53 141 IPV6_HOPOPTS = 54 142 IPV6_RTHDRDSTOPTS = 55 143 IPV6_RECVRTHDR = 56 144 IPV6_RTHDR = 57 145 IPV6_RECVDSTOPTS = 58 146 IPV6_DSTOPTS = 59 147 IPV6_RECVPATHMTU = 60 148 IPV6_PATHMTU = 61 149 IPV6_DONTFRAG = 62 150 IPV6_RECVTCLASS = 66 151 IPV6_TCLASS = 67 152 IPV6_AUTOFLOWLABEL = 70 153 IPV6_ADDR_PREFERENCES = 72 154 IPV6_MINHOPCOUNT = 73 155 IPV6_ORIGDSTADDR = 74 156 IPV6_RECVORIGDSTADDR = IPV6_ORIGDSTADDR 157 IPV6_TRANSPARENT = 75 158 IPV6_UNICAST_IF = 76 159 IPV6_RECVFRAGSIZE = 77 160 IPV6_FREEBIND = 78 161 )