inet icon indicating copy to clipboard operation
inet copied to clipboard

Wrong advertisement implementation of learned routes over iBGP session.

Open PasqualeDiDio opened this issue 9 years ago • 0 comments

Component: "BGPRouting::updateSendProcess" method line 402

OS: Linux Inet Version: INET-3.2.1 Stable Release Available (Jan 22, 2016)

Summary: INET BGP implementation, concerning iBGP routes advertisment, it is not compliant to the RFC 4271. All BGP routers, advertise routes learned over an iBGP session to another iBGP session. But on an iBGP session, a router have to advertise only its best routes learned over eBGP sessions. A route learned on an iBGP session is never advertised over another iBGP session.

From RFC :

When a BGP speaker receives an UPDATE message from an internal peer, the receiving BGP speaker SHALL NOT re-distribute the routing information contained in that UPDATE message to other internal peers (unless the speaker acts as a BGP Route Reflector [RFC2796]).

RFC 4271

Description: I have 4 BGP Router connected into ring topology in iBGP session each one with an eBGP session to external AS.

1.Router1 and Router2 send the eBGP routing entries learned to the other router and viceversa. 2.Router2 (that already have Router 1 entries) and Router3 share their routing entries; Router2 advertise also the Router1 entries to Router3.

PATCH I checked the "BGPRouting::updateSendProcess" method (line 402) of BGRRouting.cc

       if (isInTable(_prefixListOUT, entry) != (unsigned long)-1 || isInASList(_ASListOUT, entry) ||
            ((elem).first == sessionIndex && type != NEW_SESSION_ESTABLISHED) ||
            (type == NEW_SESSION_ESTABLISHED && (elem).first != sessionIndex) ||
            !(elem).second->isEstablished())
        {
            continue;
        }
        if ((_BGPSessions[sessionIndex]->getType() == IGP && (elem).second->getType() == EGP) ||
              _BGPSessions[sessionIndex]->getType() == EGP ||
              type == ROUTE_DESTINATION_CHANGED ||
line402       type == NEW_SESSION_ESTABLISHED)             <--------------------------------------


Router2 sends learned entries from Router1 to Router3 because of this line. Correctly not sending for this other condition into the previous if block:

((elem).first == sessionIndex && type != NEW_SESSION_ESTABLISHED) ||
(type == NEW_SESSION_ESTABLISHED && (elem).first != sessionIndex) ||

I patched the "BGPRouting::updateSendProcess" method line 402

//type == NEW_SESSION_ESTABLISHED
// If is a new session, and is a iBGP session, and the entry is different from iBGP (EGP or INCOMPLETE) then do this
(type == NEW_SESSION_ESTABLISHED && _BGPSessions[sessionIndex]->getType() == IGP && (int)entry->getPathType() != IGP)

PasqualeDiDio avatar Mar 08 '16 15:03 PasqualeDiDio