Skip to content

Commit 294915c

Browse files
committed
fix
Signed-off-by: clyi <clyi@alauda.io>
1 parent dc909e8 commit 294915c

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

pkg/daemon/flow_rules_linux.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,15 @@ func buildFlowKey(kind, ip string, port uint16, protocol, extra string) string {
7474
}
7575
return fmt.Sprintf("%s-%s-%s-%d-%s", kind, ip, protocol, port, extra)
7676
}
77+
78+
func (c *Controller) getPortID(bridgeName, portName string) (int, error) {
79+
if c.ovsClient == nil {
80+
return 0, fmt.Errorf("ovs client not initialized")
81+
}
82+
83+
portInfo, err := c.ovsClient.OpenFlow.DumpPort(bridgeName, portName)
84+
if err != nil {
85+
return 0, fmt.Errorf("failed to dump port %s on bridge %s: %w", portName, bridgeName, err)
86+
}
87+
return portInfo.PortID, nil
88+
}

pkg/daemon/flow_sync_linux.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package daemon
22

33
import (
4-
"errors"
5-
"fmt"
64
"strconv"
75
"strings"
86
"time"
@@ -171,18 +169,6 @@ func (c *Controller) runFlowSync(stopCh <-chan struct{}) {
171169
}
172170
}
173171

174-
func (c *Controller) getPortID(bridgeName, portName string) (int, error) {
175-
if c.ovsClient == nil {
176-
return 0, errors.New("ovs client not initialized")
177-
}
178-
179-
portInfo, err := c.ovsClient.OpenFlow.DumpPort(bridgeName, portName)
180-
if err != nil {
181-
return 0, fmt.Errorf("failed to dump port %s on bridge %s: %w", portName, bridgeName, err)
182-
}
183-
return portInfo.PortID, nil
184-
}
185-
186172
func (c *Controller) setFlowCache(cache map[string]map[string][]string, bridgeName, key string, flows []string) {
187173
c.flowCacheMutex.Lock()
188174
defer c.flowCacheMutex.Unlock()

0 commit comments

Comments
 (0)