Bgp: gr_time in configure file can change gr_flag
cjt
melissa_cjt at 163.com
Tue Dec 24 09:57:10 CET 2019
Hello
I find that the graceful restart time number configuration can accept 32bits.
bgp_proto GRACEFUL RESTART TIME expr ';' { BGP_CFG->gr_time = $5; }
While in the RFC 4724 section 3 it says the graceful restart time is 12bits and restart flags is 4bits.
+--------------------------------------------------+
| Restart Flags (4 bits) |
+--------------------------------------------------+
| Restart Time in seconds (12 bits) |
+--------------------------------------------------+
| Address Family Identifier (16 bits) |
+--------------------------------------------------+
| Subsequent Address Family Identifier (8 bits) |
+--------------------------------------------------+
| Flags for Address Family (8 bits) |
+--------------------------------------------------+
so ,when I set the graceful restart time like 32768.,it will cover the gr_flag. Becasue ,in the bgp_write_capabilites() function ,it first put the gr_time in. Then use "|" to put gr_flags. This will casue the value in gr_time first four bits keep in the gr_flags。
put_u16(buf, caps->gr_time);
buf[0] |= caps->gr_flags;
Also ,I have find in RFC 4724,it required gr_flag expect the first bit ,the remaining bits are reserved and MUST be set to zero by the sender and ignored by the receiver. gr_time in the configure also can change the remaining bits. Meanwhile, in the bgp_read_capabilites() function, it use "& 0xf0" will remain the wrong 4 bits.
caps->gr_flags = pos[2] & 0xf0;
caps->gr_time = get_u16(pos + 2) & 0x0fff;
I try this on the bird 2.0.7
Thanks
Jingting Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20191224/be4b18fb/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reproduce.png
Type: image/png
Size: 27031 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20191224/be4b18fb/attachment.png>
More information about the Bird-users
mailing list