/dev/net/ip/top

< /dev‎ | net

Socket Ioctls

Fill me in!

Function Progress

Request Number Name Input Output Notes
0x1 SOAccept (int socket, struct ptr?) secret
0x2 SOBind (int socket, struct sockaddr_in *address) 0
0x3 SOClose 4 bytes?
0x4 SOConnect (int socket, struct sockaddr_in *address) 0
0x5 SOFcntl
0x6 SOGetPeerName
0x7 SOGetSockName
0x8 SOGetSockOpt 0 0x18 bytes
0x9 SOSetSockOpt 0x24 bytes? 0
0xA SOListen (s32 socket, s32 backlog) secret
0xB SOPoll
0xC SORecvFrom (int socket, char * message, int msg_len, int flags)
0xD SOSendTo (int socket, char * message, int msg_len, int flags)
0xE SOShutdown 8 bytes?
0xF SOSocket 0xC bytes (int domain, int type, int protocol) 0
0x10 SOGetHostId none none returns 32-bit numeric IP
0x11 SOGetHostByName (char *hostname) hostent
0x12 SOGetHostByAddr
0x13 SOGetNameInfo (vector) ?
0x15 SOInetAtoN IPv4 address (string) IPv4 address (4 bytes) inet_aton()
0x16 SOInetPtoN
0x17 SOInetNtoP secret
0x18 SOGetAddrInfo (vector) ?
0x19 SOSockAtMark secret
0x1C SOGetInterfaceOpt (vector 1 in 2 out) 8 bytes (u32 level, u32 optname) optval, sizeof(optval) see below for options
0x1D SOSetInterfaceOpt (vector) ?
0x1E SOSetInterface secret
0x1F SOStartup 0 0
0x30 ICMPSocket int domain returns new socket
0x31 ICMPEcho (vector 2 in 0 out) struct {int socket, u32 has_addr, u64 timeout, struct sockaddr_in addr}, u8 echodata[] echodata is optional/size limited by MTU
0x32 ICMPCancel int socket Cancels an outstanding echo request
0x33 ICMPClose int socket

GetInterfaceOpt

SOGetInterfaceOpt works like SOGetSockOpt, except level is always 0xFFFE. The following is a list of possible values for optname and the appropriate matching optval sizes:

Value Size Description Typical Hex Value (for IOS58)
0x1001 4 internal function pointer 13B59089
0x1002 4 internal function pointer 13B59089
0x1003 4 00000000
0x1004 6 active interface MAC address 000DC38A 3410
0x1005 4 00000001
0x1006 56 global packet/byte counters? 00000000 00019B96 00000055 00000003 00000000 00000000 00000000 00000058 00000000 0000180B 00000007 00..
0x1007 4 00000000
0x2001 4 0000000A
0x2002 4 00000002
0x2003 4 00000005
0x2004 4 00000003
0x2005 256 bytes max zeroes
0x3001 4 hardcoded value 00000010
0x3002 multiple of 16 arp cache struct {u32 ?, u32 ip, u8 mac[6], u8 pad[2]}[]
0x4001 64 00000057 00000000 00000000 00000000 00000000 00000057 0000005A 00000000 00..
0x4002 4 hardcoded value 00000002
0x4003 any ip settings If size >= 12 bytes, returns {u32 ip, u32 netmask, u32 subnet_broadcast}

followed by { u32 x0; u32 x4; u16 x8; u16 xa; } if size >= 24 bytes [check]

Writes 0, 12 or 24 to the size parameter depending on the amount of information returned.

0x4004 4 MTU? 000005DC
0x4005 4 routing table size most IOS' are hardcoded to return 0x20
0x4006 multiple of 24 routing table struct {u32 dest_ip, u32 netmask, u32 gw, u32 flags, u64 tick?}[]
0x4009 4 00000000
0x5001 104 ICMP stats? zeroes
0x6001 72 IPV6 stats? zeroes
0x6002 4 00000000
0x6003 4 harcoded value 00000080
0x6004
0x6009 4
0x600A 4 hardcoded value 00000080
0x600B
0x600C 4 hardcoded value 00000080
0x600D
0x600E 00000080
0x600F
0x6010 00000080
0x6011
0x7001 136 zeroes
0x8001 16 00000005 00000000 00000002 00000000
0x8002 4 active UDP sockets? 00000003
0x8003 multiple of 16 open UDP sockets? struct {u8 localsize (8), u8 localfamily (2), u16 localport, u32 localip, u8 remotesize(8), u8 remotefamily(2), u16 remoteport, u32 remoteip}[]
0x8004 4 00000000
0x8005
0x9001 40 00000002 00000001 00000000 00000002 00000000 00000050 00000007 00000000 00000000 00000003
0x9002 4 active TCP sockets? 00000001
0x9003 multiple of 20 TCP sockets struct {u32 state, u8 localsize (8), u8 localfamily (2), u16 localport, u32 localip, u8 remotesize(8), u8 remotefamily(2), u16 remoteport, u32 remoteip}[]
0x9004 4 00000000
0x9005
0x9006 4 00000078
0x9007 4 000001F4
0x9008 4 000000F0
0x9009 4 00000003
0xA001 4 IGMP version 00000002
0xB001 256 bytes max zeroes
0xB002 4 hardcoded value 00000002
0xB003 multiple of 4 DNS Servers u32 dns_ips[]
0xC001 4 DHCP lease time remaining? 000029EF