golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/ipv4/sys_aix.go (about) 1 // Copyright 2019 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Added for go1.11 compatibility 6 //go:build aix 7 8 package ipv4 9 10 import ( 11 "net" 12 "syscall" 13 14 "golang.org/x/net/internal/iana" 15 "golang.org/x/net/internal/socket" 16 17 "golang.org/x/sys/unix" 18 ) 19 20 // IP_RECVIF is defined on AIX but doesn't work. IP_RECVINTERFACE must be used instead. 21 const sockoptReceiveInterface = unix.IP_RECVINTERFACE 22 23 var ( 24 ctlOpts = [ctlMax]ctlOpt{ 25 ctlTTL: {unix.IP_RECVTTL, 1, marshalTTL, parseTTL}, 26 ctlDst: {unix.IP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, 27 ctlInterface: {unix.IP_RECVINTERFACE, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, 28 } 29 30 sockOpts = map[int]*sockOpt{ 31 ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, 32 ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, 33 ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, 34 ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: 4}}, 35 ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 1}}, 36 ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, 37 ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVDSTADDR, Len: 4}}, 38 ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVINTERFACE, Len: 4}}, 39 ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, 40 ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 41 ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 42 } 43 )