diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-11-17 14:35:58 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-11-24 11:45:20 +0900 |
commit | 412548f7e5363c502d26434bbc68ffa03e99c75e (patch) | |
tree | ed801e9247f263f38dd12e6ab96b05cdcb804fce /table | |
parent | d3adb6d680a409d00791f95445f75689338f56af (diff) |
packet/bgp: Sort FlowSpec rules when decoding/creating
Currently, we sort the FlowSpec rules when creating a new path
containing the FlowSpec NLRI and when parsing CLI arguments for
the FlowSpec rules.
This patch moves sorting the rules into the inside of the "packet"
module and sorts them when decoding binary and creating new NLRI.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'table')
-rw-r--r-- | table/path.go | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/table/path.go b/table/path.go index cf4603f2..9f041786 100644 --- a/table/path.go +++ b/table/path.go @@ -136,20 +136,6 @@ type Validation struct { UnmatchedLength []*ROA } -type FlowSpecComponents []bgp.FlowSpecComponentInterface - -func (c FlowSpecComponents) Len() int { - return len(c) -} - -func (c FlowSpecComponents) Swap(i, j int) { - c[i], c[j] = c[j], c[i] -} - -func (c FlowSpecComponents) Less(i, j int) bool { - return c[i].Type() < c[j].Type() -} - type Path struct { info *originInfo IsWithdraw bool @@ -173,25 +159,6 @@ func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pa return nil } - if nlri != nil && (nlri.SAFI() == bgp.SAFI_FLOW_SPEC_UNICAST || nlri.SAFI() == bgp.SAFI_FLOW_SPEC_VPN) { - var coms FlowSpecComponents - var f *bgp.FlowSpecNLRI - switch nlri.(type) { - case *bgp.FlowSpecIPv4Unicast: - f = &nlri.(*bgp.FlowSpecIPv4Unicast).FlowSpecNLRI - case *bgp.FlowSpecIPv4VPN: - f = &nlri.(*bgp.FlowSpecIPv4VPN).FlowSpecNLRI - case *bgp.FlowSpecIPv6Unicast: - f = &nlri.(*bgp.FlowSpecIPv6Unicast).FlowSpecNLRI - case *bgp.FlowSpecIPv6VPN: - f = &nlri.(*bgp.FlowSpecIPv6VPN).FlowSpecNLRI - } - if f != nil { - coms = f.Value - sort.Sort(coms) - } - } - return &Path{ info: &originInfo{ nlri: nlri, |