aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-11-29 16:51:56 +0100
committerGitHub <noreply@github.com>2016-11-29 16:51:56 +0100
commit72e9b239f4d6b71e43acee4ca76de04e893400e8 (patch)
tree738f4d5b78ecf30aa6bb4b9f800c76029eb9bdac /sys
parent4278c63e64234425ea1655e3207d85b627fc17f2 (diff)
parent2429a7b0340cfbc809470c0c124be7c471ac3eb1 (diff)
Merge pull request #97 from xairy/inaddr-template
Move inaddr and sockaddr descriptions to templates
Diffstat (limited to 'sys')
-rw-r--r--sys/decl.go2
-rw-r--r--sys/socket.txt16
-rw-r--r--sys/sys.txt46
3 files changed, 45 insertions, 19 deletions
diff --git a/sys/decl.go b/sys/decl.go
index 0533c3770..bb82cfa18 100644
--- a/sys/decl.go
+++ b/sys/decl.go
@@ -104,7 +104,6 @@ const (
BufferBlobRange
BufferString
BufferFilename
- BufferSockaddr
)
type BufferType struct {
@@ -206,7 +205,6 @@ type IntKind int
const (
IntPlain IntKind = iota
IntSignalno
- IntInaddr
IntFileoff // offset within a file
IntRange
)
diff --git a/sys/socket.txt b/sys/socket.txt
index f33627855..7c17497f4 100644
--- a/sys/socket.txt
+++ b/sys/socket.txt
@@ -117,6 +117,22 @@ ip_mtu_discover = IP_PMTUDISC_DONT, IP_PMTUDISC_WANT, IP_PMTUDISC_DO, IP_PMTUDIS
sockopt_opt_ipv6_int = IPV6_ADDRFORM, IPV6_MTU, IPV6_MULTICAST_HOPS, IPV6_MULTICAST_IF, IPV6_MULTICAST_LOOP, IPV6_RECVPKTINFO, IPV6_RECVERR, IPV6_ROUTER_ALERT, IPV6_UNICAST_HOPS, IPV6_V6ONLY, IPV6_RTHDR, IPV6_AUTHHDR, IPV6_DSTOPTS, IPV6_HOPOPTS, IPV6_FLOWINFO, IPV6_HOPLIMIT, IPV6_CHECKSUM, IPV6_2292PKTINFO, IPV6_2292HOPOPTS, IPV6_2292DSTOPTS, IPV6_2292RTHDR, IPV6_2292HOPLIMIT
sockopt_opt_ipv6_mreq = IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_JOIN_ANYCAST, IPV6_LEAVE_ANYCAST
+sockaddr [
+ un sockaddr_un
+ in sockaddr_in
+ in6 sockaddr_in6
+ nl sockaddr_nl
+ ax25 sockaddr_ax25
+ alg sockaddr_alg
+ nfc sockaddr_nfc
+ nfc_llcp sockaddr_nfc_llcp
+ hci sockaddr_hci
+ sco sockaddr_sco
+ l2 sockaddr_l2
+ rc sockaddr_rc
+# TODO: other kinds of sockaddrs
+] [varlen]
+
sockaddr_in {
family const[AF_INET, int16]
port proc[int16be, 20000, 4]
diff --git a/sys/sys.txt b/sys/sys.txt
index 76920b37e..6e0edada6 100644
--- a/sys/sys.txt
+++ b/sys/sys.txt
@@ -962,7 +962,7 @@ xfrm_userpolicy_info {
xfrm_user_tmpl {
id xfrm_id
fam int16
- saddr in_addr_any
+ saddr xfrm_in_addr
reqid int32
mode int8
share int8
@@ -973,8 +973,8 @@ xfrm_user_tmpl {
}
xfrm_selector {
- daddr in_addr_any
- saddr in_addr_any
+ daddr xfrm_in_addr
+ saddr xfrm_in_addr
dport proc[int16be, 20000, 4]
dmask int16
sport proc[int16be, 20000, 4]
@@ -1006,28 +1006,40 @@ xfrm_lifetime_cur {
}
xfrm_id {
- daddr in_addr_any
+ daddr xfrm_in_addr
spi int32
proto int8
}
-# in_addr or in6_addr
-# prog knows about this struct
-in_addr_any {
- a0 in_addr
- a1 int32
- a2 int32
- a3 int32
+xfrm_in_addr [
+ in in_addr
+ in6 in6_addr
+]
+
+in_addr [
+# 0.0.0.0
+ empty const[0x00000000, int32be]
+# 127.0.0.1
+ loopback const[0x7f000001, int32be]
+# 255.255.255.255
+ broadcast const[0xffffffff, int32be]
+}
+
+in6_addr_empty {
+ a0 const[0, int64be]
+ a1 const[0, int64be]
}
-# prog knows about this struct
-in6_addr {
- a0 int32
- a1 int32
- a2 int32
- a3 int32
+in6_addr_loopback {
+ a0 const[0, int64be]
+ a1 const[1, int64be]
}
+in6_addr [
+ empty in6_addr_empty
+ loopback in6_addr_loopback
+]
+
ipv6_mreq {
multi in6_addr
ifindex int32