diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-07-06 11:21:38 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-07-06 11:21:38 +0900 |
commit | 69f866a77cb83db8925fb95fb55d6086fbfe899c (patch) | |
tree | ccab74cc11b14639734bda30c794271461e7bb33 | |
parent | 9ae30060eb399b825f035160d5b77df74789ffb6 (diff) |
Fixing all megacheck errors.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | api/policy.go | 6 | ||||
-rw-r--r-- | config/default.go | 4 | ||||
-rw-r--r-- | table/destination.go | 42 |
3 files changed, 4 insertions, 48 deletions
diff --git a/api/policy.go b/api/policy.go index 102e2e02..01d55473 100644 --- a/api/policy.go +++ b/api/policy.go @@ -25,9 +25,9 @@ import ( ) var ( - repexpCommunity = regexp.MustCompile("(\\d+.)*\\d+:\\d+") - regexpLargeCommunity = regexp.MustCompile("\\d+:\\d+:\\d+") - regexpCommunityString = regexp.MustCompile("[\\^\\$]") + repexpCommunity = regexp.MustCompile(`(\d+.)*\d+:\d+`) + regexpLargeCommunity = regexp.MustCompile(`\d+:\d+:\d+`) + regexpCommunityString = regexp.MustCompile(`[\^\$]`) ) func ParseCommunityRegexp(arg string) (*regexp.Regexp, error) { diff --git a/config/default.go b/config/default.go index afe9af42..a6f7fc91 100644 --- a/config/default.go +++ b/config/default.go @@ -496,9 +496,7 @@ func OverwriteNeighborConfigWithPeerGroup(c *Neighbor, pg *PeerGroup) error { overwriteConfig(&c.TtlSecurity.Config, &pg.TtlSecurity.Config, "neighbor.ttl-security.config", v) if !v.IsSet("neighbor.afi-safis") { - for _, afiSafi := range pg.AfiSafis { - c.AfiSafis = append(c.AfiSafis, afiSafi) - } + c.AfiSafis = append(c.AfiSafis, pg.AfiSafis...) } return nil diff --git a/table/destination.go b/table/destination.go index e0d0bc90..49dceaa7 100644 --- a/table/destination.go +++ b/table/destination.go @@ -1039,45 +1039,3 @@ func (d *Destination) Select(option ...DestinationSelectOption) *Destination { } return NewDestination(d.nlri, 0, paths...) } - -type destinations []*Destination - -func (d destinations) Len() int { - return len(d) -} - -func (d destinations) Swap(i, j int) { - d[i], d[j] = d[j], d[i] -} - -func (d destinations) Less(i, j int) bool { - switch d[i].routeFamily { - case bgp.RF_FS_IPv4_UC, bgp.RF_FS_IPv6_UC, bgp.RF_FS_IPv4_VPN, bgp.RF_FS_IPv6_VPN, bgp.RF_FS_L2_VPN: - var s, t *bgp.FlowSpecNLRI - switch d[i].routeFamily { - case bgp.RF_FS_IPv4_UC: - s = &d[i].nlri.(*bgp.FlowSpecIPv4Unicast).FlowSpecNLRI - t = &d[j].nlri.(*bgp.FlowSpecIPv4Unicast).FlowSpecNLRI - case bgp.RF_FS_IPv6_UC: - s = &d[i].nlri.(*bgp.FlowSpecIPv6Unicast).FlowSpecNLRI - t = &d[j].nlri.(*bgp.FlowSpecIPv6Unicast).FlowSpecNLRI - case bgp.RF_FS_IPv4_VPN: - s = &d[i].nlri.(*bgp.FlowSpecIPv4VPN).FlowSpecNLRI - t = &d[j].nlri.(*bgp.FlowSpecIPv4VPN).FlowSpecNLRI - case bgp.RF_FS_IPv6_VPN: - s = &d[i].nlri.(*bgp.FlowSpecIPv6VPN).FlowSpecNLRI - t = &d[j].nlri.(*bgp.FlowSpecIPv6VPN).FlowSpecNLRI - case bgp.RF_FS_L2_VPN: - s = &d[i].nlri.(*bgp.FlowSpecL2VPN).FlowSpecNLRI - t = &d[j].nlri.(*bgp.FlowSpecL2VPN).FlowSpecNLRI - } - if r, _ := bgp.CompareFlowSpecNLRI(s, t); r >= 0 { - return true - } else { - return false - } - default: - strings := sort.StringSlice{d[i].nlri.String(), d[j].nlri.String()} - return strings.Less(0, 1) - } -} |