Skip to content

Commit 3bdf99d

Browse files
committed
libn/osl: drop unused AddNeighbor force parameter
func (*Namespace) AddNeighbor is only ever called with the force parameter set to false. Remove the parameter and eliminate dead code. Signed-off-by: Cory Snider <[email protected]>
1 parent 458e69f commit 3bdf99d

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

libnetwork/drivers/overlay/peerdb.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (d *driver) peerAddOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask
321321
}
322322

323323
// Add neighbor entry for the peer IP
324-
if err := sbox.AddNeighbor(peerIP, peerMac, false, osl.WithLinkName(s.vxlanName)); err != nil {
324+
if err := sbox.AddNeighbor(peerIP, peerMac, osl.WithLinkName(s.vxlanName)); err != nil {
325325
if _, ok := err.(osl.NeighborSearchError); ok && dbEntries > 1 {
326326
// We are in the transient case so only the first configuration is programmed into the kernel
327327
// Upon deletion if the active configuration is deleted the next one from the database will be restored
@@ -332,7 +332,7 @@ func (d *driver) peerAddOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask
332332
}
333333

334334
// Add fdb entry to the bridge for the peer mac
335-
if err := sbox.AddNeighbor(vtep, peerMac, false, osl.WithLinkName(s.vxlanName), osl.WithFamily(syscall.AF_BRIDGE)); err != nil {
335+
if err := sbox.AddNeighbor(vtep, peerMac, osl.WithLinkName(s.vxlanName), osl.WithFamily(syscall.AF_BRIDGE)); err != nil {
336336
return fmt.Errorf("could not add fdb entry for nid:%s eid:%s into the sandbox:%v", nid, eid, err)
337337
}
338338

libnetwork/osl/neigh_linux.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,16 @@ func (n *Namespace) DeleteNeighbor(dstIP net.IP, dstMac net.HardwareAddr) error
110110
}
111111

112112
// AddNeighbor adds a neighbor entry into the sandbox.
113-
func (n *Namespace) AddNeighbor(dstIP net.IP, dstMac net.HardwareAddr, force bool, options ...NeighOption) error {
113+
func (n *Namespace) AddNeighbor(dstIP net.IP, dstMac net.HardwareAddr, options ...NeighOption) error {
114114
var (
115-
iface netlink.Link
116-
err error
117-
neighborAlreadyPresent bool
115+
iface netlink.Link
116+
err error
118117
)
119118

120-
// If the namespace already has the neighbor entry but the AddNeighbor is called
121-
// because of a miss notification (force flag) program the kernel anyway.
122119
nh := n.findNeighbor(dstIP, dstMac)
123120
if nh != nil {
124-
neighborAlreadyPresent = true
125-
log.G(context.TODO()).Warnf("Neighbor entry already present for IP %v, mac %v neighbor:%+v forceUpdate:%t", dstIP, dstMac, nh, force)
126-
if !force {
127-
return NeighborSearchError{dstIP, dstMac, true}
128-
}
121+
log.G(context.TODO()).Warnf("Neighbor entry already present for IP %v, mac %v neighbor:%+v", dstIP, dstMac, nh)
122+
return NeighborSearchError{dstIP, dstMac, true}
129123
}
130124

131125
nh = &neigh{
@@ -172,10 +166,6 @@ func (n *Namespace) AddNeighbor(dstIP net.IP, dstMac net.HardwareAddr, force boo
172166
return fmt.Errorf("could not add neighbor entry:%+v error:%v", nlnh, err)
173167
}
174168

175-
if neighborAlreadyPresent {
176-
return nil
177-
}
178-
179169
n.mu.Lock()
180170
n.neighbors = append(n.neighbors, nh)
181171
n.mu.Unlock()

0 commit comments

Comments
 (0)