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

Reply via email to