diff options
author | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-06-19 16:32:38 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-10 15:39:14 +0900 |
commit | 4b5e13376c70481aacc1c2c508738279f8cc9e5c (patch) | |
tree | eb653f3d42af5e31dc90c186834a49384f8dfd0f /packet/bgp/constant.go | |
parent | 15cd58e01f47357be5280ef6aa0775f42b811854 (diff) |
packet: Use bitmask operand format to fragment
RFC 5575 suggests using "bitmask operand format" for fragmentation
field, but GoBGP does not have an interface to configure it.
This patch introduce the way to configure bitmask operands for
"fragment" field.
The syntax is similar to TCP flags rules.
For example:
=not-a-fragment
=is-fragment&!last-fragment
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'packet/bgp/constant.go')
-rw-r--r-- | packet/bgp/constant.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/packet/bgp/constant.go b/packet/bgp/constant.go index 2cee1f31..0741d8e8 100644 --- a/packet/bgp/constant.go +++ b/packet/bgp/constant.go @@ -154,6 +154,32 @@ var BitmaskFlagOpValueMap = map[string]BitmaskFlagOp{ BitmaskFlagOpNameMap[BITMASK_FLAG_OP_MATCH]: BITMASK_FLAG_OP_MATCH, } +type FragmentFlag int + +const ( + FRAG_FLAG_NOT = 0x00 + FRAG_FLAG_DONT = 0x01 + FRAG_FLAG_IS = 0x02 + FRAG_FLAG_FIRST = 0x04 + FRAG_FLAG_LAST = 0x08 +) + +var FragmentFlagNameMap = map[FragmentFlag]string{ + FRAG_FLAG_NOT: "not-a-fragment", + FRAG_FLAG_DONT: "dont-fragment", + FRAG_FLAG_IS: "is-fragment", + FRAG_FLAG_FIRST: "first-fragment", + FRAG_FLAG_LAST: "last-fragment", +} + +var FragmentFlagValueMap = map[string]FragmentFlag{ + FragmentFlagNameMap[FRAG_FLAG_NOT]: FRAG_FLAG_NOT, + FragmentFlagNameMap[FRAG_FLAG_DONT]: FRAG_FLAG_DONT, + FragmentFlagNameMap[FRAG_FLAG_IS]: FRAG_FLAG_IS, + FragmentFlagNameMap[FRAG_FLAG_FIRST]: FRAG_FLAG_FIRST, + FragmentFlagNameMap[FRAG_FLAG_LAST]: FRAG_FLAG_LAST, +} + type DECNumOp int const ( |