Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1429)

Delta Between Two Patch Sets: ipv4/sys.go

Issue 97800043: code review 97800043: go.net/ipv4: add support for dragonfly (Closed)
Left Patch Set: diff -r 424a15ce8b2f https://code.google.com/p/go.net Created 9 years, 11 months ago
Right Patch Set: diff -r 9c33002573cb https://code.google.com/p/go.net Created 9 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « ipv4/sockopt_windows.go ('k') | ipv4/sys_bsd.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2014 The Go Authors. All rights reserved. 1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package ipv4 5 package ipv4
6 6
7 import "net" 7 // supportsPacketInfo reports whether the platform supports
8 8 // IP_PKTINFO.
9 type sysSockoptLen uint32 9 var supportsPacketInfo bool
10
11 const (
12 » sysSizeofMulticastReq = 0x8
13 )
14
15 type sysMulticastReq struct {
16 » IP [4]byte
17 » Interface [4]byte
18 }
19
20 func (mreq *sysMulticastReq) setInterface(ifi *net.Interface) error {
21 » if ifi == nil {
22 » » return nil
23 » }
24 » ifat, err := ifi.Addrs()
25 » if err != nil {
26 » » return err
27 » }
28 » for _, ifa := range ifat {
29 » » switch v := ifa.(type) {
30 » » case *net.IPAddr:
31 » » » if ip := v.IP.To4(); ip != nil {
32 » » » » copy(mreq.Interface[:], ip)
33 » » » » return nil
34 » » » }
35 » » case *net.IPNet:
36 » » » if ip := v.IP.To4(); ip != nil {
37 » » » » copy(mreq.Interface[:], ip)
38 » » » » return nil
39 » » » }
40 » » }
41 » }
42 » return errNoSuchInterface
43 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b