Skip to content

Commit

Permalink
Fix unit-string conversions (antrea-io#1161)
Browse files Browse the repository at this point in the history
Conversion from uint32 to string yields a string of one rune, not a
string of digits.

Signed-off-by: Weiqiang Tang <weiqiangt@vmware.com>
  • Loading branch information
weiqiangt authored and antoninbas committed Aug 27, 2020
1 parent 92304ac commit 114f129
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/agent/openflow/network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ func (c *policyRuleConjunction) getAllFlowKeys() []string {
}

func (c *client) getPolicyRuleConjunction(ruleID uint32) *policyRuleConjunction {
conj, found, _ := c.policyCache.GetByKey(string(ruleID))
conj, found, _ := c.policyCache.GetByKey(fmt.Sprint(ruleID))
if !found {
return nil
}
Expand Down Expand Up @@ -1305,7 +1305,7 @@ func (c *client) ReassignFlowPriorities(updates map[uint16]uint16, table binding
return err
}
for conjID, actionUpdates := range conjFlowUpdates {
originalConj, _, _ := c.policyCache.GetByKey(string(conjID))
originalConj, _, _ := c.policyCache.GetByKey(fmt.Sprint(conjID))
conj := originalConj.(*policyRuleConjunction)
updatedConj := c.updateConjunctionActionFlows(conj, actionUpdates)
c.updateConjunctionMatchFlows(updatedConj, actionUpdates.newPriority)
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/openflow/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ func (c *client) serviceEndpointGroup(groupID binding.GroupIDType, withSessionAf
// policyConjKeyFuncKeyFunc knows how to get key of a *policyRuleConjunction.
func policyConjKeyFunc(obj interface{}) (string, error) {
conj := obj.(*policyRuleConjunction)
return string(conj.id), nil
return fmt.Sprint(conj.id), nil
}

// priorityIndexFunc knows how to get priority of actionFlows in a *policyRuleConjunction.
Expand Down

0 comments on commit 114f129

Please sign in to comment.