summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack
diff options
context:
space:
mode:
authorIan Gudger <igudger@google.com>2019-02-07 23:14:06 -0800
committerShentubot <shentubot@google.com>2019-02-07 23:15:23 -0800
commit80f901b16b8bb8fe397cc44578035173f5155b24 (patch)
tree91707e2f2b424f71f7bac661c05a830b56244255 /pkg/tcpip/stack
parentfda4d1f4f11201c34bd15d41ba4c94279d135d95 (diff)
Plumb IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP to netstack.
Also includes a few fixes for IPv4 multicast support. IPv6 support is coming in a followup CL. PiperOrigin-RevId: 233008638 Change-Id: If7dae6222fef43fda48033f0292af77832d95e82
Diffstat (limited to 'pkg/tcpip/stack')
-rw-r--r--pkg/tcpip/stack/stack.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/stack.go b/pkg/tcpip/stack/stack.go
index 7aa9dbd46..854ebe1bb 100644
--- a/pkg/tcpip/stack/stack.go
+++ b/pkg/tcpip/stack/stack.go
@@ -742,6 +742,9 @@ func (s *Stack) FindRoute(id tcpip.NICID, localAddr, remoteAddr tcpip.Address, n
return Route{}, tcpip.ErrNoRoute
}
+ // TODO: Route multicast packets with no specified local
+ // address or NIC.
+
for i := range s.routeTable {
if (id != 0 && id != s.routeTable[i].NIC) || (len(remoteAddr) != 0 && !s.routeTable[i].Match(remoteAddr)) {
continue
@@ -768,6 +771,10 @@ func (s *Stack) FindRoute(id tcpip.NICID, localAddr, remoteAddr tcpip.Address, n
return r, nil
}
+ if isMulticast {
+ return Route{}, tcpip.ErrNetworkUnreachable
+ }
+
return Route{}, tcpip.ErrNoRoute
}