Skip to content

Commit

Permalink
Flush conntrack entry when UDP service endpoint is deleted (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
murali-reddy authored Dec 24, 2017
1 parent 8ce5e4f commit 94a2ec7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apk add --no-cache \
ipset \
iproute2 \
ipvsadm \
conntrack-tools \
curl \
bash && \
mkdir -p /var/lib/gobgp && \
Expand Down
9 changes: 9 additions & 0 deletions app/controllers/network_services_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,15 @@ func (nsc *NetworkServicesController) syncIpvsServices(serviceInfoMap serviceInf
glog.Errorf("Failed to delete destination %s from ipvs service %s",
ipvsDestinationString(dst), ipvsServiceString(ipvsSvc))
}

// flush conntrack when endpoint for a UDP service changes
if ipvsSvc.Protocol == syscall.IPPROTO_UDP {
_, err := exec.Command("conntrack", "-D", "--orig-dst", dst.Address.String(), "-p", "udp", "--dport", strconv.Itoa(int(dst.Port))).Output()
if err != nil {
glog.Error("Failed to delete conntrack entry for endpoint: " + dst.Address.String() + ":" + strconv.Itoa(int(dst.Port)) + " due to " + err.Error())
}
glog.Infof("Deleted conntrack entry for endpoint: " + dst.Address.String() + ":" + strconv.Itoa(int(dst.Port)))
}
}
}
}
Expand Down

0 comments on commit 94a2ec7

Please sign in to comment.