...
Source file
src/syscall/route_openbsd.go
Documentation: syscall
1
2
3
4
5 package syscall
6
7 import "unsafe"
8
9 func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
10 switch any.Type {
11 case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
12 p := (*RouteMessage)(unsafe.Pointer(any))
13
14 p.Header.Addrs &= RTA_DST | RTA_GATEWAY | RTA_NETMASK | RTA_GENMASK | RTA_IFA | RTA_IFP | RTA_BRD | RTA_AUTHOR | RTA_SRC | RTA_SRCMASK
15 return &RouteMessage{Header: p.Header, Data: b[p.Header.Hdrlen:any.Msglen]}
16 case RTM_IFINFO:
17 p := (*InterfaceMessage)(unsafe.Pointer(any))
18 return &InterfaceMessage{Header: p.Header, Data: b[p.Header.Hdrlen:any.Msglen]}
19 case RTM_IFANNOUNCE:
20 p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any))
21 return &InterfaceAnnounceMessage{Header: p.Header}
22 case RTM_NEWADDR, RTM_DELADDR:
23 p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
24 return &InterfaceAddrMessage{Header: p.Header, Data: b[p.Header.Hdrlen:any.Msglen]}
25 }
26 return nil
27 }
28
29
30
31
32
33 type InterfaceAnnounceMessage struct {
34 Header IfAnnounceMsghdr
35 }
36
37 func (m *InterfaceAnnounceMessage) sockaddr() ([]Sockaddr, error) { return nil, nil }
38
View as plain text