From 3ed6a3a883875c37dc56962b9010b2b645578a60 Mon Sep 17 00:00:00 2001 From: Hongjiang Zhang Date: Mon, 15 May 2017 14:08:34 +0800 Subject: [PATCH] Minor changes to allow libnetwork to compile on FreeBSD --- iptables/conntrack.go | 1 + resolver_unix.go | 2 +- service_unsupported.go | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/iptables/conntrack.go b/iptables/conntrack.go index 08317c33..f4f213b6 100644 --- a/iptables/conntrack.go +++ b/iptables/conntrack.go @@ -1,3 +1,4 @@ +// +build !freebsd package iptables import ( diff --git a/resolver_unix.go b/resolver_unix.go index b35009ee..243ad242 100644 --- a/resolver_unix.go +++ b/resolver_unix.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows,!freebsd package libnetwork diff --git a/service_unsupported.go b/service_unsupported.go index 37b98281..5f0d38d2 100644 --- a/service_unsupported.go +++ b/service_unsupported.go @@ -18,6 +18,26 @@ func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, in return fmt.Errorf("not supported") } +func (c *controller) getLBIndex(sid, nid string, ingressPorts []*PortConfig) int { + skey := serviceKey{ + id: sid, + ports: portConfigs(ingressPorts).String(), + } + c.Lock() + s, ok := c.serviceBindings[skey] + c.Unlock() + + if !ok { + return 0 + } + + s.Lock() + lb := s.loadBalancers[nid] + s.Unlock() + + return int(lb.fwMark) +} + func (sb *sandbox) populateLoadbalancers(ep *endpoint) { }