From 41ac785aa3ab70608538a35cb62c02eeb53171cc Mon Sep 17 00:00:00 2001 From: jay vyas Date: Mon, 21 Oct 2019 08:48:36 -0400 Subject: [PATCH] s/ isSource->ipsSource --- dataplane/linux/xdp_state.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/dataplane/linux/xdp_state.go b/dataplane/linux/xdp_state.go index 60d51c836a..55175dacff 100644 --- a/dataplane/linux/xdp_state.go +++ b/dataplane/linux/xdp_state.go @@ -158,7 +158,7 @@ func (x *xdpState) ProcessPendingDiffState(epSourceV4 endpointsSource) { } } -func (x *xdpState) ResyncIfNeeded(isSourceV4 ipsetsSource) error { +func (x *xdpState) ResyncIfNeeded(ipsSourceV4 ipsetsSource) error { var err error if !x.common.needResync { return nil @@ -170,7 +170,7 @@ func (x *xdpState) ResyncIfNeeded(isSourceV4 ipsetsSource) error { log.Info("Retrying after an XDP update failure...") } log.Info("Resyncing XDP state with dataplane.") - err = x.tryResync(newConvertingIPSetsSource(isSourceV4)) + err = x.tryResync(newConvertingIPSetsSource(ipsSourceV4)) if err == nil { success = true break @@ -183,10 +183,10 @@ func (x *xdpState) ResyncIfNeeded(isSourceV4 ipsetsSource) error { return nil } -func (x *xdpState) ApplyBPFActions(isSource ipsetsSource) error { +func (x *xdpState) ApplyBPFActions(ipsSource ipsetsSource) error { if x.ipV4State != nil { memberCacheV4 := newXDPMemberCache(x.ipV4State.getBpfIPFamily(), x.common.bpfLib) - err := x.ipV4State.bpfActions.apply(memberCacheV4, x.ipV4State.ipsetIDsToMembers, newConvertingIPSetsSource(isSource), x.common.xdpModes) + err := x.ipV4State.bpfActions.apply(memberCacheV4, x.ipV4State.ipsetIDsToMembers, newConvertingIPSetsSource(ipsSource), x.common.xdpModes) x.ipV4State.bpfActions = newXDPBPFActions() if err != nil { log.WithError(err).Info("Applying BPF actions did not succeed. Queueing XDP resync.") @@ -235,18 +235,18 @@ func (x *xdpState) WipeXDP() error { // because we are about to drop everything, and when // we only drop stuff, the code does not call // ipsetsSource functions at all. - isSource := &nilIPSetsSource{} - if err := x.tryResync(isSource); err != nil { + ipsSource := &nilIPSetsSource{} + if err := x.tryResync(ipsSource); err != nil { return err } - if err := x.ApplyBPFActions(isSource); err != nil { + if err := x.ApplyBPFActions(ipsSource); err != nil { return err } x.QueueResync() return nil } -func (x *xdpState) tryResync(isSourceV4 ipsetsSource) error { +func (x *xdpState) tryResync(ipsSourceV4 ipsetsSource) error { if x.common.programTag == "" { tag, err := x.common.bpfLib.GetXDPObjTagAuto() if err != nil { @@ -255,7 +255,7 @@ func (x *xdpState) tryResync(isSourceV4 ipsetsSource) error { x.common.programTag = tag } if x.ipV4State != nil { - if err := x.ipV4State.tryResync(&x.common, isSourceV4); err != nil { + if err := x.ipV4State.tryResync(&x.common, ipsSourceV4); err != nil { return err } } @@ -428,7 +428,7 @@ func (s *xdpIPState) getBpfIPFamily() bpf.IPFamily { } // newXDPResyncState creates the xdpResyncState object which represents the -func (s *xdpIPState) newXDPResyncState(bpfLib bpf.BPFDataplane, isSource ipsetsSource, programTag string, xpdModes []bpf.XDPMode) (*xdpResyncState, error) { +func (s *xdpIPState) newXDPResyncState(bpfLib bpf.BPFDataplane, ipsSource ipsetsSource, programTag string, xpdModes []bpf.XDPMode) (*xdpResyncState, error) { xdpIfaces, err := bpfLib.GetXDPIfaces() if err != nil { return nil, err @@ -508,7 +508,7 @@ func (s *xdpIPState) newXDPResyncState(bpfLib bpf.BPFDataplane, isSource ipsetsS if visited.Contains(setID) { return nil } - members, err := s.getIPSetMembers(setID, isSource) + members, err := s.getIPSetMembers(setID, ipsSource) if err != nil { opErr = err return set.StopIteration @@ -542,8 +542,8 @@ func isValidMode(mode bpf.XDPMode, xdpModes []bpf.XDPMode) bool { return false } -func (s *xdpIPState) getIPSetMembers(setID string, isSource ipsetsSource) (set.Set, error) { - return getIPSetMembers(s.ipsetIDsToMembers, setID, isSource) +func (s *xdpIPState) getIPSetMembers(setID string, ipsSource ipsetsSource) (set.Set, error) { + return getIPSetMembers(s.ipsetIDsToMembers, setID, ipsSource) } // tryResync performs reconciles global XDP state with the by using input ipSets @@ -1753,7 +1753,7 @@ func newXDPBPFActions() *xdpBPFActions { // installs XDP programs, creates and removes BPF maps, adds and // removes whole ipsets into/from the BPF maps, adds and removes // certain members to/from BPF maps. -func (a *xdpBPFActions) apply(memberCache *xdpMemberCache, ipsetIDsToMembers *ipsetIDsToMembers, isSource ipsetsSource, xdpModes []bpf.XDPMode) error { +func (a *xdpBPFActions) apply(memberCache *xdpMemberCache, ipsetIDsToMembers *ipsetIDsToMembers, ipsSource ipsetsSource, xdpModes []bpf.XDPMode) error { var opErr error logCxt := log.WithField("family", memberCache.GetFamily().String()) @@ -1827,7 +1827,7 @@ func (a *xdpBPFActions) apply(memberCache *xdpMemberCache, ipsetIDsToMembers *ip "setID": setID, "refCount": refCount, }).Debug("Adding members of ipset to BPF blacklist map.") - members, err := getIPSetMembers(ipsetIDsToMembers, setID, isSource) + members, err := getIPSetMembers(ipsetIDsToMembers, setID, ipsSource) if err != nil { return err } @@ -1913,13 +1913,13 @@ func getXDPModes(allowGenericXDP bool) []bpf.XDPMode { return modes } -func getIPSetMembers(ipsetIDsToMembers *ipsetIDsToMembers, setID string, isSource ipsetsSource) (set.Set, error) { +func getIPSetMembers(ipsetIDsToMembers *ipsetIDsToMembers, setID string, ipsSource ipsetsSource) (set.Set, error) { members, ok := ipsetIDsToMembers.GetCached(setID) if ok { return members, nil } - members, err := isSource.GetIPSetMembers(setID) + members, err := ipsSource.GetIPSetMembers(setID) if err != nil { return nil, err }