Hello.
I have found two inconsistency about bgp error handling.
First:  
I found that in RFC 4271 for the next hop syntactically incorrect, need to set 
invalid next hop. RFC Document fragmen as follow:


If the NEXT_HOP attribute field is syntactically incorrect, then the Error 
Subcode MUST be set to Invalid NEXT_HOP Attribute.  The Data field MUST contain 
the incorrect attribute (type, length, and value).   Syntactic correctness 
means that the NEXT_HOP attribute represents a valid IP host address.


We find that in the code of the openbgpd6.8, it's error code is ERR_UPD_NETWORK.


                /*
                 * Check if the nexthop is a valid IP address. We consider
                 * multicast and experimental addresses as invalid.
                 */
                tmp32 = ntohl(nexthop.v4.s_addr);
                if (IN_MULTICAST(tmp32) || IN_BADCLASS(tmp32)) {
                        rde_update_err(peer, ERR_UPDATE, ERR_UPD_NETWORK,
                            op, len);
                        return (-1);
                }


Second: 
I found that in RFC 6286 for bgp identifer, it has two check. One is to zero, 
the other is to local bgp id. RFC Document fragmen as follow:


 For a BGP speaker that supports the AS-wide Unique BGP Identifier, the OPEN 
message error handling related to the BGP Identifier is  modified as follows:
 If the BGP Identifier field of the OPEN message is zero, or if it  is the same 
as the BGP Identifier of the local BGP speaker and the message is from an 
internal peer, then the Error Subcode is set to  "Bad BGP Identifier".


In the code of the openbgpd6.8, there missing the bgp id is the same check.  
(If openbgpd does not support RFC 6286, you can ignore it)


        /* check bgpid for validity - just disallow 0 */
        if (ntohl(bgpid) == 0) {
                log_peer_warnx(&peer->conf, "peer BGPID %u unacceptable",
                    ntohl(bgpid));
                session_notification(peer, ERR_OPEN, ERR_OPEN_BGPID,
                    NULL, 0);
                change_state(peer, STATE_IDLE, EVNT_RCVD_OPEN);
                return (-1);
        }

Reply via email to