veyron/runtimes/google/ipc: take care to use an IP host address and never an IP network address.
Change-Id: I9fec54c9647fc890cf6d0993e613c80940638873
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index 20047c5..a737391 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -173,7 +173,12 @@
addrs, err := netstate.GetAccessibleIPs()
if err == nil {
if a, err := s.preferredAddress(protocol, addrs); err == nil {
- iep.Address = net.JoinHostPort(a.String(), port)
+ if ip := netstate.AsIP(a); ip != nil {
+ // a may be an IPNet or an IPAddr under the covers,
+ // but we really want the IP portion without any
+ // netmask so we use AsIP to ensure that.
+ iep.Address = net.JoinHostPort(ip.String(), port)
+ }
}
}
}