diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-07 00:05:13 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-08 01:25:40 +0900 |
commit | d0b26ae700e8c0d424f666b44c473d1ee52a96a2 (patch) | |
tree | c87a2e80f0c0714c3f562ebf3229073b811b68b2 /packet/constant.go | |
parent | bf98af5a968491059c01729d613098133eb32788 (diff) |
packet: support cisco-ish flowspec tcp-flag serializing
// same as juniper matching ack+syn
$ gobgp global rib -a ipv4-flowspec match tcp-flags ack syn then discard
// [NEW] same as cisco matching ack+syn
$ gobgp global rib -a ipv4-flowspec match tcp-flags 'ack&syn' then discard
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet/constant.go')
-rw-r--r-- | packet/constant.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packet/constant.go b/packet/constant.go index c8de8007..65101dc1 100644 --- a/packet/constant.go +++ b/packet/constant.go @@ -125,9 +125,9 @@ var TCPFlagValueMap = map[string]TCPFlag{ func (f TCPFlag) String() string { ss := make([]string, 0, 6) - for k, v := range TCPFlagNameMap { - if f&k > 0 { - ss = append(ss, v) + for _, v := range []TCPFlag{TCP_FLAG_FIN, TCP_FLAG_SYN, TCP_FLAG_RST, TCP_FLAG_PUSH, TCP_FLAG_ACK, TCP_FLAG_URGENT} { + if f&v > 0 { + ss = append(ss, TCPFlagNameMap[v]) } } return strings.Join(ss, "|") |