Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distinguish-portSecurity-with-security-group #4134

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 7 additions & 10 deletions pkg/controller/security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,6 @@ func (c *Controller) updateDenyAllSgPorts() error {

addPorts := make([]string, 0, len(lsps))
for _, lsp := range lsps {
// skip lsp which only have mac addresses,address is in port.PortSecurity[0]
if len(lsp.PortSecurity) == 0 || len(strings.Split(lsp.PortSecurity[0], " ")) < 2 {
continue
}

/* skip lsp which security_group does not exist */
// sgs format: sg1/sg2/sg3
sgs := strings.Split(lsp.ExternalIDs[sgsKey], "/")
Expand Down Expand Up @@ -449,14 +444,16 @@ func (c *Controller) syncSgLogicalPort(key string) error {
return err
}

var ports, v4s, v6s []string
var ports, v4s, v6s, addresses []string
for _, lsp := range sgPorts {
ports = append(ports, lsp.Name)
if len(lsp.PortSecurity) == 0 {
continue
if len(lsp.PortSecurity) != 0 {
addresses = lsp.PortSecurity
} else {
addresses = lsp.Addresses
}
for _, ps := range lsp.PortSecurity {
fields := strings.Fields(ps)
for _, as := range addresses {
fields := strings.Fields(as)
if len(fields) < 2 {
continue
}
Expand Down