Skip to content

Commit 6d382cd

Browse files
author
Arko Dasgupta
committed
Remove vlanLinkExists and dummyLinkExists since these are redundant
Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
1 parent ea744fb commit 6d382cd

2 files changed

Lines changed: 0 additions & 54 deletions

File tree

drivers/ipvlan/ipvlan_setup.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,8 @@ func parentExists(ifaceStr string) bool {
7070
return true
7171
}
7272

73-
// vlanLinkExists checks if specified vlan link exists in the default namespace
74-
func vlanLinkExists(linkStr string) bool {
75-
_, err := ns.NlHandle().LinkByName(linkStr)
76-
if err != nil {
77-
return false
78-
}
79-
return true
80-
}
81-
8273
// createVlanLink parses sub-interfaces and vlan id for creation
8374
func createVlanLink(parentName string) error {
84-
if vlanLinkExists(parentName) {
85-
logrus.Debugf("Parent Sub Interface %s already exists", parentName)
86-
return nil
87-
}
88-
8975
if strings.Contains(parentName, ".") {
9076
parent, vidInt, err := parseVlan(parentName)
9177
if err != nil {
@@ -170,22 +156,8 @@ func parseVlan(linkName string) (string, int, error) {
170156
return parent, vidInt, nil
171157
}
172158

173-
// dummyLinkExists checks if dummylink exists in the default namespace
174-
func dummyLinkExists(dummyName string) bool {
175-
_, err := ns.NlHandle().LinkByName(dummyName)
176-
if err != nil {
177-
return false
178-
}
179-
return true
180-
}
181-
182159
// createDummyLink creates a dummy0 parent link
183160
func createDummyLink(dummyName, truncNetID string) error {
184-
// check if dummyLinkExists and return if it does
185-
if dummyLinkExists(truncNetID) {
186-
logrus.Debugf("Dummy Link %s for ipvlan already exists", truncNetID)
187-
return nil
188-
}
189161
// create a parent interface since one was not specified
190162
parent := &netlink.Dummy{
191163
LinkAttrs: netlink.LinkAttrs{

drivers/macvlan/macvlan_setup.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,8 @@ func parentExists(ifaceStr string) bool {
7474
return true
7575
}
7676

77-
// vlanLinkExists checks if specified vlan link exists in the default namespace
78-
func vlanLinkExists(linkStr string) bool {
79-
_, err := ns.NlHandle().LinkByName(linkStr)
80-
if err != nil {
81-
return false
82-
}
83-
return true
84-
}
85-
8677
// createVlanLink parses sub-interfaces and vlan id for creation
8778
func createVlanLink(parentName string) error {
88-
if vlanLinkExists(parentName) {
89-
logrus.Debugf("Parent Sub Interface %s already exists", parentName)
90-
return nil
91-
}
9279
if strings.Contains(parentName, ".") {
9380
parent, vidInt, err := parseVlan(parentName)
9481
if err != nil {
@@ -173,21 +160,8 @@ func parseVlan(linkName string) (string, int, error) {
173160
return parent, vidInt, nil
174161
}
175162

176-
// dummyLinkExists checks if dummylink exists in the default namespace
177-
func dummyLinkExists(dummyName string) bool {
178-
_, err := ns.NlHandle().LinkByName(dummyName)
179-
if err != nil {
180-
return false
181-
}
182-
return true
183-
}
184-
185163
// createDummyLink creates a dummy0 parent link
186164
func createDummyLink(dummyName, truncNetID string) error {
187-
if dummyLinkExists(truncNetID) {
188-
logrus.Debugf("Dummy Link %s for Mac Vlan already exists", truncNetID)
189-
return nil
190-
}
191165
// create a parent interface since one was not specified
192166
parent := &netlink.Dummy{
193167
LinkAttrs: netlink.LinkAttrs{

0 commit comments

Comments
 (0)