Skip to content

Commit 4e4ba9d

Browse files
committed
Vendoring libnetwork v0.5.5
Signed-off-by: Alessandro Boch <[email protected]>
1 parent 812d95c commit 4e4ba9d

7 files changed

Lines changed: 91 additions & 8 deletions

File tree

hack/vendor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ clone git github.com/docker/engine-api v0.2.2
2626
clone git github.com/RackSec/srslog 6eb773f331e46fbba8eecb8e794e635e75fc04de
2727

2828
#get libnetwork packages
29-
clone git github.com/docker/libnetwork v0.5.4
29+
clone git github.com/docker/libnetwork v0.5.5
3030
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
3131
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
3232
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4

vendor/src/github.com/docker/libnetwork/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ bin/
88
integration-tmp/
99
_obj
1010
_test
11+
.vagrant
12+
1113

1214
# Architecture specific extensions/prefixes
1315
*.[568vq]

vendor/src/github.com/docker/libnetwork/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.5.5 (2016-01-14)
4+
- Allow network-scoped alias to be resolved for anonymous endpoint
5+
- Self repair corrupted IP database that could happen in 1.9.0 & 1.9.1
6+
- Skip IPTables cleanup if --iptables=false is set. Fixes docker/docker#19063
7+
38
## 0.5.4 (2016-01-12)
49
- Removed the isNodeAlive protection when user forces an endpoint delete
510

vendor/src/github.com/docker/libnetwork/bitseq/sequence.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"fmt"
1010
"sync"
1111

12+
log "github.com/Sirupsen/logrus"
1213
"github.com/docker/libnetwork/datastore"
1314
"github.com/docker/libnetwork/types"
1415
)
@@ -243,6 +244,58 @@ func (h *Handle) IsSet(ordinal uint64) bool {
243244
return err != nil
244245
}
245246

247+
func (h *Handle) runConsistencyCheck() bool {
248+
corrupted := false
249+
for p, c := h.head, h.head.next; c != nil; c = c.next {
250+
if c.count == 0 {
251+
corrupted = true
252+
p.next = c.next
253+
continue // keep same p
254+
}
255+
p = c
256+
}
257+
return corrupted
258+
}
259+
260+
// CheckConsistency checks if the bit sequence is in an inconsistent state and attempts to fix it.
261+
// It looks for a corruption signature that may happen in docker 1.9.0 and 1.9.1.
262+
func (h *Handle) CheckConsistency() error {
263+
for {
264+
h.Lock()
265+
store := h.store
266+
h.Unlock()
267+
268+
if store != nil {
269+
if err := store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
270+
return err
271+
}
272+
}
273+
274+
h.Lock()
275+
nh := h.getCopy()
276+
h.Unlock()
277+
278+
if !nh.runConsistencyCheck() {
279+
return nil
280+
}
281+
282+
if err := nh.writeToStore(); err != nil {
283+
if _, ok := err.(types.RetryError); !ok {
284+
return fmt.Errorf("internal failure while fixing inconsistent bitsequence: %v", err)
285+
}
286+
continue
287+
}
288+
289+
log.Infof("Fixed inconsistent bit sequence in datastore:\n%s\n%s", h, nh)
290+
291+
h.Lock()
292+
h.head = nh.head
293+
h.Unlock()
294+
295+
return nil
296+
}
297+
}
298+
246299
// set/reset the bit
247300
func (h *Handle) set(ordinal, start, end uint64, any bool, release bool) (uint64, error) {
248301
var (

vendor/src/github.com/docker/libnetwork/drivers/bridge/bridge.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
135135
if err := iptables.FirewalldInit(); err != nil {
136136
logrus.Debugf("Fail to initialize firewalld: %v, using raw iptables instead", err)
137137
}
138-
removeIPChains()
138+
139139
d := newDriver()
140140
if err := d.configure(config); err != nil {
141141
return err
@@ -378,6 +378,7 @@ func (d *driver) configure(option map[string]interface{}) error {
378378
}
379379

380380
if config.EnableIPTables {
381+
removeIPChains()
381382
natChain, filterChain, isolationChain, err = setupIPChains(config)
382383
if err != nil {
383384
return err

vendor/src/github.com/docker/libnetwork/ipam/allocator.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ func NewAllocator(lcDs, glDs datastore.DataStore) (*Allocator, error) {
7070
}
7171
}
7272

73+
a.checkConsistency(localAddressSpace)
74+
a.checkConsistency(globalAddressSpace)
75+
7376
return a, nil
7477
}
7578

@@ -115,6 +118,25 @@ func (a *Allocator) updateBitMasks(aSpace *addrSpace) error {
115118
return nil
116119
}
117120

121+
// Checks for and fixes damaged bitmask. Meant to be called in constructor only.
122+
func (a *Allocator) checkConsistency(as string) {
123+
// Retrieve this address space's configuration and bitmasks from the datastore
124+
a.refresh(as)
125+
aSpace, ok := a.addrSpaces[as]
126+
if !ok {
127+
return
128+
}
129+
a.updateBitMasks(aSpace)
130+
for sk, pd := range aSpace.subnets {
131+
if pd.Range != nil {
132+
continue
133+
}
134+
if err := a.addresses[sk].CheckConsistency(); err != nil {
135+
log.Warnf("Error while running consistency check for %s: %v", sk, err)
136+
}
137+
}
138+
}
139+
118140
// GetDefaultAddressSpaces returns the local and global default address spaces
119141
func (a *Allocator) GetDefaultAddressSpaces() (string, string, error) {
120142
return localAddressSpace, globalAddressSpace, nil

vendor/src/github.com/docker/libnetwork/network.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -822,20 +822,20 @@ func (n *network) EndpointByID(id string) (Endpoint, error) {
822822
}
823823

824824
func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
825-
if ep.isAnonymous() {
826-
return
827-
}
828-
829825
epName := ep.Name()
830826
if iface := ep.Iface(); iface.Address() != nil {
831827
myAliases := ep.MyAliases()
832828
if isAdd {
833-
n.addSvcRecords(epName, iface.Address().IP, true)
829+
if !ep.isAnonymous() {
830+
n.addSvcRecords(epName, iface.Address().IP, true)
831+
}
834832
for _, alias := range myAliases {
835833
n.addSvcRecords(alias, iface.Address().IP, false)
836834
}
837835
} else {
838-
n.deleteSvcRecords(epName, iface.Address().IP, true)
836+
if !ep.isAnonymous() {
837+
n.deleteSvcRecords(epName, iface.Address().IP, true)
838+
}
839839
for _, alias := range myAliases {
840840
n.deleteSvcRecords(alias, iface.Address().IP, false)
841841
}

0 commit comments

Comments
 (0)