diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-25 18:19:23 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-25 18:19:23 +0900 |
commit | 633e14d4d768766b6f74236415661f364778daa1 (patch) | |
tree | 2ff96d5870e9dbebd9e2497cee137d641d220bcf | |
parent | ae41a9f07ef745369510ce19856956f2bdcf55f8 (diff) |
packet: multiple flow spec fragmentation flags
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | packet/bgp.go | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/packet/bgp.go b/packet/bgp.go index a1b797c1..1b798ee1 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -2266,20 +2266,22 @@ func flowSpecFragmentParser(rf RouteFamily, args []string) (FlowSpecComponentInt return nil, fmt.Errorf("invalid flowspec fragment specifier") } value := 0 - switch args[1] { - case "not-a-fragment": - if afi, _ := RouteFamilyToAfiSafi(rf); afi == AFI_IP6 { - return nil, fmt.Errorf("can't specify not-a-fragment for ipv6") + for _, a := range args[1:] { + switch a { + case "not-a-fragment": + if afi, _ := RouteFamilyToAfiSafi(rf); afi == AFI_IP6 { + return nil, fmt.Errorf("can't specify not-a-fragment for ipv6") + } + value |= 0x1 + case "is-a-fragment": + value |= 0x2 + case "first-fragment": + value |= 0x4 + case "last-fragment": + value |= 0x8 + default: + return nil, fmt.Errorf("invalid flowspec fragment specifier") } - value = 0x1 - case "is-a-fragment": - value = 0x2 - case "first-fragment": - value = 0x4 - case "last-fragment": - value = 0x8 - default: - return nil, fmt.Errorf("invalid flowspec fragment specifier") } items := []*FlowSpecComponentItem{NewFlowSpecComponentItem(0, value)} return NewFlowSpecComponent(FlowSpecValueMap[args[0]], items), nil |