diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-11-28 11:39:42 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-11-28 15:23:04 +0900 |
commit | 76c289ea3624502f12d03ee9a5a34340d571df88 (patch) | |
tree | 15120098ecd56f831b119edfb87503cd8b69c1bf /packet/bgp/constant.go | |
parent | 5440f32fcd85264b659d126573f447a80eb3db31 (diff) |
packet/bgp: Use fixed len types in FlowSpec components
Currently, the "FlowSpecComponentItem" uses int type for the "Op" and
"Value" fields, but Golang int type has 4 bytes length on the 32-bit
env and 8 bytes length on the 64-bit env.
For example, to support the SNAP (Type 20) rule, which has 5 bytes
value field, int type has not enough length on 32-bit env.
This patch fixes to use the fixed length integer types for the
FlowSpec components and avoid overflows of value range.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'packet/bgp/constant.go')
-rw-r--r-- | packet/bgp/constant.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packet/bgp/constant.go b/packet/bgp/constant.go index d4120471..5ea7b414 100644 --- a/packet/bgp/constant.go +++ b/packet/bgp/constant.go @@ -126,7 +126,7 @@ func (f TCPFlag) String() string { return strings.Join(flags, "") } -type BitmaskFlagOp int +type BitmaskFlagOp uint8 const ( BITMASK_FLAG_OP_OR BitmaskFlagOp = iota @@ -215,7 +215,7 @@ func (f FragmentFlag) String() string { return strings.Join(flags, "+") } -type DECNumOp int +type DECNumOp uint8 const ( DEC_NUM_OP_TRUE DECNumOp = iota // true always with END bit set |