INET Framework for OMNeT++/OMNEST
inet::bgp::BgpRouter Class Reference

#include <BgpRouter.h>

Inheritance diagram for inet::bgp::BgpRouter:
inet::TcpSocket::ReceiveQueueBasedCallback inet::TcpSocket::ICallback

Classes

struct  redistributeOspfType_t
 

Public Member Functions

 BgpRouter (cSimpleModule *bgpModule, IInterfaceTable *ift, IIpv4RoutingTable *rt)
 
virtual ~BgpRouter ()
 
RouterId getRouterId ()
 
void setAsId (AsId myAsId)
 
AsId getAsId ()
 
int getNumBgpSessions ()
 
int getNumEgpSessions ()
 
int getNumIgpSessions ()
 
void setDefaultConfig ()
 
Ipv4Address getInternalAddress ()
 
void setInternalAddress (Ipv4Address x)
 
bool getRedistributeInternal ()
 
void setRedistributeInternal (bool x)
 
bool getRedistributeRip ()
 
void setRedistributeRip (bool x)
 
bool getRedistributeOspf ()
 
void setRedistributeOspf (std::string x)
 
void printSessionSummary ()
 
void addWatches ()
 
void recordStatistics ()
 
SessionId createEbgpSession (const char *peerAddr, SessionInfo &externalInfo)
 
SessionId createIbgpSession (const char *peerAddr)
 
void setTimer (SessionId id, simtime_t *delayTab)
 
void setSocketListen (SessionId id)
 
void addToAdvertiseList (Ipv4Address address)
 
void addToPrefixList (std::string nodeName, BgpRoutingTableEntry *entry)
 
void addToAsList (std::string nodeName, AsId id)
 
void setNextHopSelf (Ipv4Address peer, bool nextHopSelf)
 
void setLocalPreference (Ipv4Address peer, int localPref)
 
bool isExternalAddress (const Ipv4Route &rtEntry)
 
void processMessageFromTCP (cMessage *msg)
 
void printOpenMessage (const BgpOpenMessage &msg)
 
void printUpdateMessage (const BgpUpdateMessage &msg)
 
void printKeepAliveMessage (const BgpKeepAliveMessage &msg)
 
- Public Member Functions inherited from inet::TcpSocket::ICallback
virtual ~ICallback ()
 

Private Types

typedef std::vector< BgpRoutingTableEntry * > RoutingTableEntryVector
 

Private Attributes

IInterfaceTableift = nullptr
 
IIpv4RoutingTablert = nullptr
 
cSimpleModule * bgpModule = nullptr
 
ospfv2::Ospfv2ospfModule = nullptr
 
AsId myAsId = 0
 
bool redistributeInternal = false
 
bool redistributeRip = false
 
bool redistributeOspf = false
 
redistributeOspfType_t redistributeOspfType = {}
 
SocketMap _socketMap
 
SessionId _currSessionId = 0
 
std::map< SessionId, BgpSession * > _BGPSessions
 
uint32_t numEgpSessions = 0
 
uint32_t numIgpSessions = 0
 
Ipv4Address internalAddress = Ipv4Address::UNSPECIFIED_ADDRESS
 
RoutingTableEntryVector bgpRoutingTable
 
std::vector< Ipv4AddressadvertiseList
 
RoutingTableEntryVector _prefixListIN
 
RoutingTableEntryVector _prefixListOUT
 
RoutingTableEntryVector _prefixListINOUT
 
std::vector< AsId_ASListIN
 
std::vector< AsId_ASListOUT
 

TcpSocket::ICallback callback methods

class BgpSession
 
virtual void socketDataArrived (TcpSocket *socket) override
 
virtual void socketDataArrived (TcpSocket *socket, Packet *packet, bool urgent) override
 Notifies about data arrival, packet ownership is transferred to the callee. More...
 
virtual void socketAvailable (TcpSocket *socket, TcpAvailableInfo *availableInfo) override
 
virtual void socketEstablished (TcpSocket *socket) override
 
virtual void socketPeerClosed (TcpSocket *socket) override
 
virtual void socketClosed (TcpSocket *socket) override
 
virtual void socketFailure (TcpSocket *socket, int code) override
 
virtual void socketStatusArrived (TcpSocket *socket, TcpStatusInfo *status) override
 
virtual void socketDeleted (TcpSocket *socket) override
 
void getScheduleAt (simtime_t t, cMessage *msg)
 
void getCancelAndDelete (cMessage *msg)
 
cMessage * getCancelEvent (cMessage *msg)
 
IIpv4RoutingTablegetIPRoutingTable ()
 
std::vector< BgpRoutingTableEntry * > getBGPRoutingTable ()
 
void listenConnectionFromPeer (SessionId sessionID)
 active listenSocket for a given session (used by fsm) More...
 
void openTCPConnectionToPeer (SessionId sessionID)
 active TcpConnection for a given session (used by fsm) More...
 
void updateSendProcess (const unsigned char decisionProcessResult, SessionId sessionIndex, BgpRoutingTableEntry *entry)
 RFC 4271, 9.2 : Update-Send Process / Sent or not new UPDATE messages to its peers. More...
 
SessionId findNextSession (BgpSessionType type, bool startSession=false)
 find the next SessionId compared to his type and start this session if boolean is true More...
 
void processChunks (const BgpHeader &ptrHdr)
 
void processMessage (const BgpOpenMessage &msg)
 
void processMessage (const BgpKeepAliveMessage &msg)
 
void processMessage (const BgpUpdateMessage &msg)
 
bool deleteBGPRoutingEntry (BgpRoutingTableEntry *entry)
 
unsigned char decisionProcess (const BgpUpdateMessage &msg, BgpRoutingTableEntry *entry, SessionId sessionIndex)
 RFC 4271: 9.1. More...
 
bool tieBreakingProcess (BgpRoutingTableEntry *oldEntry, BgpRoutingTableEntry *entry)
 RFC 4271: 9.1.2.2 Breaking Ties used when BGP speaker may have several routes to the same destination that have the same degree of preference. More...
 
bool isInASList (std::vector< AsId > ASList, BgpRoutingTableEntry *entry)
 
unsigned long isInTable (std::vector< BgpRoutingTableEntry * > rtTable, BgpRoutingTableEntry *entry)
 
bool ospfExist (IIpv4RoutingTable *rtTable)
 
int checkExternalRoute (const Ipv4Route *ospfRoute)
 
unsigned char asLoopDetection (BgpRoutingTableEntry *entry, AsId myAS)
 
int isInRoutingTable (IIpv4RoutingTable *rtTable, Ipv4Address addr)
 
SessionId findIdFromPeerAddr (std::map< SessionId, BgpSession * > sessions, Ipv4Address peerAddr)
 
SessionId findIdFromSocketConnId (std::map< SessionId, BgpSession * > sessions, int connId)
 
bool isRouteExcluded (const Ipv4Route &rtEntry)
 
bool isDefaultRoute (const Ipv4Route *entry) const
 
bool isReachable (const Ipv4Address addr) const
 

Member Typedef Documentation

◆ RoutingTableEntryVector

Constructor & Destructor Documentation

◆ BgpRouter()

inet::bgp::BgpRouter::BgpRouter ( cSimpleModule *  bgpModule,
IInterfaceTable ift,
IIpv4RoutingTable rt 
)
18 {
19  this->bgpModule = bgpModule;
20  this->ift = ift;
21  this->rt = rt;
22 
23  ospfModule = findModuleFromPar<ospfv2::Ospfv2>(bgpModule->par("ospfRoutingModule"), bgpModule);
24 }

◆ ~BgpRouter()

inet::bgp::BgpRouter::~BgpRouter ( )
virtual
27 {
28  for (auto& elem : _BGPSessions)
29  delete (elem).second;
30 
31  for (auto& elem : _prefixListINOUT)
32  delete elem;
33 }

Member Function Documentation

◆ addToAdvertiseList()

void inet::bgp::BgpRouter::addToAdvertiseList ( Ipv4Address  address)
169 {
170  bool routeFound = false;
171  const Ipv4Route *rtEntry = nullptr;
172  for (int i = 0; i < rt->getNumRoutes(); i++) {
173  rtEntry = rt->getRoute(i);
174  if (rtEntry->getDestination() == address) {
175  routeFound = true;
176  break;
177  }
178  }
179  if (!routeFound)
180  throw cRuntimeError("Network address '%s' is not found in the routing table of %s", address.str(false).c_str(), bgpModule->getOwner()->getFullName());
181 
182  auto position = std::find_if(advertiseList.begin(), advertiseList.end(),
183  [&] (const Ipv4Address m) -> bool { return m == address; });
184  if (position != advertiseList.end())
185  throw cRuntimeError("Network address '%s' is already added to the advertised list of %s", address.str(false).c_str(), bgpModule->getOwner()->getFullName());
186  advertiseList.push_back(address);
187 
188  BgpRoutingTableEntry *BGPEntry = new BgpRoutingTableEntry(rtEntry);
189  BGPEntry->addAS(myAsId);
190  BGPEntry->setPathType(IGP);
191  BGPEntry->setLocalPreference(bgpModule->par("localPreference").intValue());
192  bgpRoutingTable.push_back(BGPEntry);
193 }

Referenced by inet::bgp::BgpConfigReader::loadASConfig().

◆ addToAsList()

void inet::bgp::BgpRouter::addToAsList ( std::string  nodeName,
AsId  id 
)
213 {
214  if (nodeName == "DenyASIN") {
215  _ASListIN.push_back(id);
216  }
217  else if (nodeName == "DenyASOUT") {
218  _ASListOUT.push_back(id);
219  }
220  else {
221  _ASListIN.push_back(id);
222  _ASListOUT.push_back(id);
223  }
224 }

Referenced by inet::bgp::BgpConfigReader::loadASConfig().

◆ addToPrefixList()

void inet::bgp::BgpRouter::addToPrefixList ( std::string  nodeName,
BgpRoutingTableEntry entry 
)
196 {
197  if (nodeName == "DenyRouteIN") {
198  _prefixListIN.push_back(entry);
199  _prefixListINOUT.push_back(entry);
200  }
201  else if (nodeName == "DenyRouteOUT") {
202  _prefixListOUT.push_back(entry);
203  _prefixListINOUT.push_back(entry);
204  }
205  else {
206  _prefixListIN.push_back(entry);
207  _prefixListOUT.push_back(entry);
208  _prefixListINOUT.push_back(entry);
209  }
210 }

Referenced by inet::bgp::BgpConfigReader::loadASConfig().

◆ addWatches()

void inet::bgp::BgpRouter::addWatches ( )
57 {
58  WATCH(myAsId);
59  WATCH_PTRMAP(_BGPSessions);
60  WATCH_PTRVECTOR(bgpRoutingTable);
62 }

Referenced by inet::bgp::Bgp::createBgpRouter().

◆ asLoopDetection()

unsigned char inet::bgp::BgpRouter::asLoopDetection ( BgpRoutingTableEntry entry,
AsId  myAS 
)
private
519 {
520  for (unsigned int i = 1; i < entry->getASCount(); i++) {
521  if (myAS == entry->getAS(i))
522  return ASLOOP_DETECTED;
523  }
524  return ASLOOP_NO_DETECTED;
525 }

Referenced by processMessage().

◆ checkExternalRoute()

int inet::bgp::BgpRouter::checkExternalRoute ( const Ipv4Route ospfRoute)
inlineprivate
166 { return ospfModule->checkExternalRoute(ospfRoute->getDestination()); }

Referenced by isRouteExcluded().

◆ createEbgpSession()

SessionId inet::bgp::BgpRouter::createEbgpSession ( const char *  peerAddr,
SessionInfo externalInfo 
)
104 {
105  SessionInfo info;
106 
107  // set external info
108  info.myAddr = externalInfo.myAddr;
109  info.checkConnection = externalInfo.checkConnection;
110  info.ebgpMultihop = externalInfo.ebgpMultihop;
111 
112  info.sessionType = EGP;
113  info.ASValue = myAsId;
114  info.routerID = rt->getRouterId();
115  info.peerAddr.set(peerAddr);
116  info.linkIntf = rt->getInterfaceForDestAddr(info.peerAddr);
117  if (!info.linkIntf) {
118  if (info.checkConnection)
119  throw cRuntimeError("BGP Error: External BGP neighbor at address %s is not directly connected to BGP router %s", peerAddr, bgpModule->getOwner()->getFullName());
120  else
121  info.linkIntf = rt->getInterfaceForDestAddr(info.myAddr);
122  }
123  ASSERT(info.linkIntf);
124  info.sessionID = info.peerAddr.getInt() + info.linkIntf->getProtocolData<Ipv4InterfaceData>()->getIPAddress().getInt();
125  numEgpSessions++;
126 
127  SessionId newSessionId;
128  newSessionId = info.sessionID;
129 
130  BgpSession *newSession = new BgpSession(*this);
131  newSession->setInfo(info);
132 
133  _BGPSessions[newSessionId] = newSession;
134 
135  return newSessionId;
136 }

Referenced by inet::bgp::BgpConfigReader::loadEbgpSessionConfig().

◆ createIbgpSession()

SessionId inet::bgp::BgpRouter::createIbgpSession ( const char *  peerAddr)
82 {
83  SessionInfo info;
84  info.sessionType = IGP;
85  info.ASValue = myAsId;
86  info.routerID = rt->getRouterId();
87  info.peerAddr.set(peerAddr);
88  info.sessionID = info.peerAddr.getInt() + info.routerID.getInt();
89 
91 
92  SessionId newSessionId;
93  newSessionId = info.sessionID;
94 
95  BgpSession *newSession = new BgpSession(*this);
96  newSession->setInfo(info);
97 
98  _BGPSessions[newSessionId] = newSession;
99 
100  return newSessionId;
101 }

Referenced by inet::bgp::BgpConfigReader::loadConfigFromXML().

◆ decisionProcess()

unsigned char inet::bgp::BgpRouter::decisionProcess ( const BgpUpdateMessage msg,
BgpRoutingTableEntry entry,
SessionId  sessionIndex 
)
private

RFC 4271: 9.1.

: Decision Process used when an UPDATE message is received As matches, routes are sent or not to UpdateSentProcess The result can be ROUTE_DESTINATION_CHANGED, NEW_ROUTE_ADDED or 0 if no routingTable modification

529 {
530  // Don't add the route if it exists in PrefixListINTable or in ASListINTable
531  if (isInTable(_prefixListIN, entry) != (unsigned long)-1 || isInASList(_ASListIN, entry)) {
532  delete entry;
533  return 0;
534  }
535 
536  /*If the AS_PATH attribute of a BGP route contains an AS loop, the BGP
537  route should be excluded from the decision process. */
538 #if 0
539  entry->setPathType(msg.getPathAttributeList(0).getOrigin().getValue());
540  entry->setGateway(msg.getPathAttributeList(0).getNextHop().getValue());
541  if (msg.getPathAttributeList(0).getLocalPrefArraySize() != 0)
542  entry->setLocalPreference(msg.getPathAttributeList(0).getLocalPref(0).getValue());
543 #else
544  for (size_t i = 0; i < msg.getPathAttributesArraySize(); i++) {
545  switch (msg.getPathAttributes(i)->getTypeCode()) {
547  auto attr = check_and_cast<const BgpUpdatePathAttributesOrigin *>(msg.getPathAttributes(i));
548  entry->setPathType(attr->getValue());
549  break;
550  }
552  auto attr = check_and_cast<const BgpUpdatePathAttributesNextHop *>(msg.getPathAttributes(i));
553  entry->setGateway(attr->getValue());
554  break;
555  }
557  auto attr = check_and_cast<const BgpUpdatePathAttributesLocalPref *>(msg.getPathAttributes(i));
558  entry->setLocalPreference(attr->getValue());
559  break;
560  }
561  default:
562  break;
563  }
564  }
565 #endif
566 
567  BgpSessionType type = _BGPSessions[sessionIndex]->getType();
568  if (type == IGP) {
569  entry->setAdminDist(Ipv4Route::dBGPInternal);
570  entry->setIBgpLearned(true);
571  }
572  else if (type == EGP)
573  entry->setAdminDist(Ipv4Route::dBGPExternal);
574  else
575  entry->setAdminDist(Ipv4Route::dUnknown);
576 
577  // if the route already exists in BGP routing table, tieBreakingProcess();
578  // (RFC 4271: 9.1.2.2 Breaking Ties)
579  unsigned long BGPindex = isInTable(bgpRoutingTable, entry);
580  if (BGPindex != (unsigned long)-1) {
581  if (tieBreakingProcess(bgpRoutingTable[BGPindex], entry)) {
582  delete entry;
583  return 0;
584  }
585  else {
586  entry->setInterface(_BGPSessions[sessionIndex]->getLinkIntf());
587  bgpRoutingTable.push_back(entry);
588  rt->addRoute(entry);
590  }
591  }
592 
593  int indexIP = isInRoutingTable(rt, entry->getDestination());
594  // if the route already exists in the IPv4 routing table
595  if (indexIP != -1) {
596  // and it was not added by BGP before
597  if (rt->getRoute(indexIP)->getSourceType() != IRoute::BGP) {
598  // and the Update msg is coming from IGP session
599  if (_BGPSessions[sessionIndex]->getType() == IGP) {
600  Ipv4Route *oldEntry = rt->getRoute(indexIP);
601  BgpRoutingTableEntry *BGPEntry = new BgpRoutingTableEntry(oldEntry);
602  BGPEntry->addAS(myAsId);
603  BGPEntry->setPathType(IGP);
604  BGPEntry->setAdminDist(Ipv4Route::dBGPInternal);
605  BGPEntry->setIBgpLearned(true);
606  BGPEntry->setLocalPreference(entry->getLocalPreference());
607  rt->addRoute(BGPEntry);
608  // Note: No need to delete the existing route. Let the administrative distance decides.
609 // rt->deleteRoute(oldEntry);
610  }
611  else {
612  delete entry;
613  return 0;
614  }
615  }
616  }
617  else {
618  // and the Update msg is coming from IGP session
619  if (_BGPSessions[sessionIndex]->getType() == IGP) {
620  // if the next hop is reachable
621  if (isReachable(entry->getGateway())) {
622  entry->setInterface(_BGPSessions[sessionIndex]->getLinkIntf());
623  rt->addRoute(entry);
624  }
625  }
626  }
627 
628  entry->setInterface(_BGPSessions[sessionIndex]->getLinkIntf());
629  bgpRoutingTable.push_back(entry);
630 
631  if (_BGPSessions[sessionIndex]->getType() == EGP) {
632  if (isReachable(entry->getGateway()))
633  rt->addRoute(entry);
634 
635  // if redistributeInternal is true, then insert the new external route into the OSPF (if exists).
636  // The OSPF module then floods AS-External LSA into the AS and lets other routers know
637  // about the new external route.
639  NetworkInterface *ie = entry->getInterface();
640  if (!ie)
641  throw cRuntimeError("Model error: interface entry is nullptr");
642  ospfv2::Ipv4AddressRange OSPFnetAddr;
643  OSPFnetAddr.address = entry->getDestination();
644  OSPFnetAddr.mask = entry->getNetmask();
645  if (!ospfModule)
646  throw cRuntimeError("Cannot find the OSPF module on router %s", bgpModule->getFullName());
647  ospfModule->insertExternalRoute(ie->getInterfaceId(), OSPFnetAddr);
648  }
649  }
650  return NEW_ROUTE_ADDED; // FIXME model error: When returns NEW_ROUTE_ADDED then entry stored in bgpRoutingTable, but sometimes not stored in rt
651 }

Referenced by processMessage().

◆ deleteBGPRoutingEntry()

bool inet::bgp::BgpRouter::deleteBGPRoutingEntry ( BgpRoutingTableEntry entry)
private
780 {
781  for (auto it = bgpRoutingTable.begin();
782  it != bgpRoutingTable.end(); it++)
783  {
784  if (((*it)->getDestination().getInt() & (*it)->getNetmask().getInt()) ==
785  (entry->getDestination().getInt() & entry->getNetmask().getInt()))
786  {
787  bgpRoutingTable.erase(it);
788  rt->deleteRoute(entry);
789  return true;
790  }
791  }
792  return false;
793 }

Referenced by tieBreakingProcess().

◆ findIdFromPeerAddr()

SessionId inet::bgp::BgpRouter::findIdFromPeerAddr ( std::map< SessionId, BgpSession * >  sessions,
Ipv4Address  peerAddr 
)
private
883 {
884  for (auto& session : sessions) {
885  if ((session).second->getPeerAddr().equals(peerAddr))
886  return (session).first;
887  }
888  return -1;
889 }

Referenced by processMessageFromTCP().

◆ findIdFromSocketConnId()

SessionId inet::bgp::BgpRouter::findIdFromSocketConnId ( std::map< SessionId, BgpSession * >  sessions,
int  connId 
)
private
811 {
812  for (auto& session : sessions) {
813  TcpSocket *socket = (session).second->getSocket();
814  if (socket->getSocketId() == connId) {
815  return (session).first;
816  }
817  }
818  return -1;
819 }

Referenced by socketDataArrived(), socketEstablished(), and socketFailure().

◆ findNextSession()

SessionId inet::bgp::BgpRouter::findNextSession ( BgpSessionType  type,
bool  startSession = false 
)
protected

find the next SessionId compared to his type and start this session if boolean is true

861 {
862  SessionId sessionID = -1;
863  for (auto& elem : _BGPSessions) {
864  if ((elem).second->getType() == type && !(elem).second->isEstablished()) {
865  sessionID = (elem).first;
866  break;
867  }
868  }
869  if (startSession == true && type == IGP && sessionID != static_cast<SessionId>(-1)) {
870  // note: if the internal peer is not directly-connected to us, then we should know how to reach it.
871  // this is done with the help of an intra-AS routing protocol (RIP, OSPF, EIGRP).
872  NetworkInterface *linkIntf = rt->getInterfaceForDestAddr(_BGPSessions[sessionID]->getPeerAddr());
873  if (linkIntf == nullptr)
874  throw cRuntimeError("No configuration interface for peer address: %s", _BGPSessions[sessionID]->getPeerAddr().str().c_str());
875 
876  _BGPSessions[sessionID]->setlinkIntf(linkIntf);
877  _BGPSessions[sessionID]->startConnection();
878  }
879  return sessionID;
880 }

Referenced by inet::bgp::BgpSession::findAndStartNextSession(), and socketEstablished().

◆ getAsId()

AsId inet::bgp::BgpRouter::getAsId ( )
inline
66 { return myAsId; }

Referenced by inet::bgp::BgpConfigReader::loadASConfig().

◆ getBGPRoutingTable()

std::vector<BgpRoutingTableEntry *> inet::bgp::BgpRouter::getBGPRoutingTable ( )
inlineprotected

◆ getCancelAndDelete()

void inet::bgp::BgpRouter::getCancelAndDelete ( cMessage *  msg)
inlineprotected
117 { bgpModule->cancelAndDelete(msg); }

Referenced by inet::bgp::BgpSession::~BgpSession().

◆ getCancelEvent()

cMessage* inet::bgp::BgpRouter::getCancelEvent ( cMessage *  msg)
inlineprotected

◆ getInternalAddress()

Ipv4Address inet::bgp::BgpRouter::getInternalAddress ( )
inline
71 { return internalAddress; }

◆ getIPRoutingTable()

IIpv4RoutingTable* inet::bgp::BgpRouter::getIPRoutingTable ( )
inlineprotected
119 { return rt; }

Referenced by inet::bgp::BgpSession::getIPRoutingTable().

◆ getNumBgpSessions()

int inet::bgp::BgpRouter::getNumBgpSessions ( )
inline
67 { return _BGPSessions.size(); }

◆ getNumEgpSessions()

int inet::bgp::BgpRouter::getNumEgpSessions ( )
inline
68 { return numEgpSessions; }

Referenced by inet::bgp::BgpSession::setTimers().

◆ getNumIgpSessions()

int inet::bgp::BgpRouter::getNumIgpSessions ( )
inline
69 { return numIgpSessions; }

◆ getRedistributeInternal()

bool inet::bgp::BgpRouter::getRedistributeInternal ( )
inline
73 { return redistributeInternal; }

◆ getRedistributeOspf()

bool inet::bgp::BgpRouter::getRedistributeOspf ( )
inline
77 { return redistributeOspf; }

◆ getRedistributeRip()

bool inet::bgp::BgpRouter::getRedistributeRip ( )
inline
75 { return redistributeRip; }

◆ getRouterId()

RouterId inet::bgp::BgpRouter::getRouterId ( )
inline

◆ getScheduleAt()

void inet::bgp::BgpRouter::getScheduleAt ( simtime_t  t,
cMessage *  msg 
)
inlineprotected

◆ isDefaultRoute()

bool inet::bgp::BgpRouter::isDefaultRoute ( const Ipv4Route entry) const
private
1077 {
1078  if (entry->getDestination().getInt() == 0 && entry->getNetmask().getInt() == 0)
1079  return true;
1080  return false;
1081 }

Referenced by isInRoutingTable(), and isReachable().

◆ isExternalAddress()

bool inet::bgp::BgpRouter::isExternalAddress ( const Ipv4Route rtEntry)
1064 {
1065  for (auto& session : _BGPSessions) {
1066  if (session.second->getType() == EGP) {
1067  NetworkInterface *exIntf = rt->getInterfaceForDestAddr(session.second->getPeerAddr());
1068  if (exIntf == rtEntry.getInterface())
1069  return true;
1070  }
1071  }
1072 
1073  return false;
1074 }

Referenced by isRouteExcluded().

◆ isInASList()

bool inet::bgp::BgpRouter::isInASList ( std::vector< AsId ASList,
BgpRoutingTableEntry entry 
)
private
837 {
838  for (auto& elem : ASList) {
839  for (unsigned int i = 0; i < entry->getASCount(); i++) {
840  if ((elem) == entry->getAS(i)) {
841  return true;
842  }
843  }
844  }
845  return false;
846 }

Referenced by decisionProcess(), and updateSendProcess().

◆ isInRoutingTable()

int inet::bgp::BgpRouter::isInRoutingTable ( IIpv4RoutingTable rtTable,
Ipv4Address  addr 
)
private
797 {
798  for (int i = 0; i < rtTable->getNumRoutes(); i++) {
799  const Ipv4Route *entry = rtTable->getRoute(i);
800  if (Ipv4Address::maskedAddrAreEqual(addr, entry->getDestination(), entry->getNetmask())) {
801  if (isDefaultRoute(entry) && addr.getInt() != 0)
802  continue;
803  else
804  return i;
805  }
806  }
807  return -1;
808 }

Referenced by decisionProcess().

◆ isInTable()

unsigned long inet::bgp::BgpRouter::isInTable ( std::vector< BgpRoutingTableEntry * >  rtTable,
BgpRoutingTableEntry entry 
)
private
823 {
824  for (unsigned long i = 0; i < rtTable.size(); i++) {
825  BgpRoutingTableEntry *entryCur = rtTable[i];
826  if ((entry->getDestination().getInt() & entry->getNetmask().getInt()) ==
827  (entryCur->getDestination().getInt() & entryCur->getNetmask().getInt()))
828  {
829  return i;
830  }
831  }
832  return -1;
833 }

Referenced by decisionProcess(), and updateSendProcess().

◆ isReachable()

bool inet::bgp::BgpRouter::isReachable ( const Ipv4Address  addr) const
private
1084 {
1085  if (addr.isUnspecified())
1086  return true;
1087 
1088  for (int i = 0; i < rt->getNumRoutes(); i++) {
1089  Ipv4Route *route = rt->getRoute(i);
1090  if (!isDefaultRoute(route) && route->getSourceType() != IRoute::BGP) {
1091  if (addr.doAnd(route->getNetmask()) == route->getDestination().doAnd(route->getNetmask()))
1092  return true;
1093  }
1094  }
1095 
1096  return false;
1097 }

Referenced by decisionProcess(), and updateSendProcess().

◆ isRouteExcluded()

bool inet::bgp::BgpRouter::isRouteExcluded ( const Ipv4Route rtEntry)
private
987 {
988  // all host-specific routes are excluded
989  if (rtEntry.getNetmask() == Ipv4Address::ALLONES_ADDRESS)
990  return true;
991 
992  // all static routes are excluded
993  if (rtEntry.getSourceType() == IRoute::MANUAL)
994  return true;
995 
996  // all BGP routes are excluded
997  if (rtEntry.getSourceType() == IRoute::BGP)
998  return true;
999 
1000  // all RIP routes are excluded when redistributeRip is false
1001  if (rtEntry.getSourceType() == IRoute::RIP) {
1002  if (!redistributeRip)
1003  return true;
1004  else
1005  return false;
1006  }
1007 
1008  if (rtEntry.getSourceType() == IRoute::OSPF) {
1009  // all OSPF routes are excluded when redistributeOspf is false
1010  if (!redistributeOspf)
1011  return true;
1012 
1013  auto entry = static_cast<const ospfv2::Ospfv2RoutingTableEntry *>(&rtEntry);
1014  ASSERT(entry);
1015 
1016  if (entry->getPathType() == ospfv2::Ospfv2RoutingTableEntry::INTRAAREA) {
1018  return false;
1019  else
1020  return true;
1021  }
1022 
1023  if (entry->getPathType() == ospfv2::Ospfv2RoutingTableEntry::INTERAREA) {
1025  return false;
1026  else
1027  return true;
1028  }
1029 
1030  int externalType = checkExternalRoute(&rtEntry);
1031 
1032  if (externalType == 1) {
1034  return false;
1035  else
1036  return true;
1037  }
1038 
1039  if (externalType == 2) {
1041  return false;
1042  else
1043  return true;
1044  }
1045 
1046  // exclude all other OSPF route types
1047  return true;
1048  }
1049 
1050  if (rtEntry.getSourceType() == IRoute::IFACENETMASK) {
1051  if (rtEntry.getInterface()->isLoopback())
1052  return true;
1053  else if (!redistributeRip && !redistributeOspf)
1054  return true;
1055  else
1056  return isExternalAddress(rtEntry);
1057  }
1058 
1059  // exclude all other routes
1060  return true;
1061 }

Referenced by inet::bgp::BgpSession::isRouteExcluded().

◆ listenConnectionFromPeer()

void inet::bgp::BgpRouter::listenConnectionFromPeer ( SessionId  sessionID)
protected

active listenSocket for a given session (used by fsm)

308 {
309  if (_BGPSessions[sessionID]->getSocketListen()->getState() == TcpSocket::CLOSED) {
310  // session StartDelayTime error, it's anormal that listenSocket is closed.
311  _socketMap.removeSocket(_BGPSessions[sessionID]->getSocketListen());
312  _BGPSessions[sessionID]->getSocketListen()->abort();
313  _BGPSessions[sessionID]->getSocketListen()->renewSocket();
314  }
315 
316  if (_BGPSessions[sessionID]->getSocketListen()->getState() != TcpSocket::LISTENING) {
317  _BGPSessions[sessionID]->getSocketListen()->setOutputGate(bgpModule->gate("socketOut"));
318  if (_BGPSessions[sessionID]->getType() == EGP) {
319  NetworkInterface *intf = _BGPSessions[sessionID]->getLinkIntf();
320  ASSERT(intf);
321  Ipv4Address localAddr = intf->getProtocolData<Ipv4InterfaceData>()->getIPAddress();
322  _BGPSessions[sessionID]->getSocketListen()->bind(localAddr, TCP_PORT);
323  }
324  else
325  _BGPSessions[sessionID]->getSocketListen()->bind(TCP_PORT);
326  _BGPSessions[sessionID]->getSocketListen()->listen();
327  _socketMap.addSocket(_BGPSessions[sessionID]->getSocketListen());
328 
329  EV_DEBUG << "Start listening to incoming TCP connections on "
330  << _BGPSessions[sessionID]->getSocketListen()->getLocalAddress()
331  << ":" << (int)TCP_PORT
332  << " for " << BgpSession::getTypeString(_BGPSessions[sessionID]->getType()) << " session"
333  << " to peer " << _BGPSessions[sessionID]->getPeerAddr() << std::endl;
334  }
335 }

Referenced by inet::bgp::BgpSession::listenConnectionFromPeer().

◆ openTCPConnectionToPeer()

void inet::bgp::BgpRouter::openTCPConnectionToPeer ( SessionId  sessionID)
protected

active TcpConnection for a given session (used by fsm)

338 {
339  EV_DEBUG << "Opening a TCP connection to "
340  << _BGPSessions[sessionID]->getPeerAddr()
341  << ":" << (int)TCP_PORT << std::endl;
342 
343  TcpSocket *socket = _BGPSessions[sessionID]->getSocket();
344  if (socket->getState() != TcpSocket::NOT_BOUND) {
345  _socketMap.removeSocket(socket);
346  socket->abort();
347  socket->renewSocket();
348  }
349  socket->setCallback(this);
350  socket->setUserData((void *)(uintptr_t)sessionID);
351  socket->setOutputGate(bgpModule->gate("socketOut"));
352  if (_BGPSessions[sessionID]->getType() == EGP) {
353  NetworkInterface *intfEntry = _BGPSessions[sessionID]->getLinkIntf();
354  if (intfEntry == nullptr)
355  throw cRuntimeError("No configuration interface for external peer address: %s", _BGPSessions[sessionID]->getPeerAddr().str().c_str());
356  socket->bind(intfEntry->getProtocolData<Ipv4InterfaceData>()->getIPAddress(), 0);
357 
358  int ebgpMH = _BGPSessions[sessionID]->getEbgpMultihop();
359  if (ebgpMH > 1)
360  socket->setTimeToLive(ebgpMH);
361  else if (ebgpMH == 1)
362  socket->setTimeToLive(1);
363  else
364  throw cRuntimeError("ebgpMultihop should be >=1");
365  }
366  else if (_BGPSessions[sessionID]->getType() == IGP) {
367  NetworkInterface *intfEntry = _BGPSessions[sessionID]->getLinkIntf();
368  if (!intfEntry)
369  intfEntry = rt->getInterfaceForDestAddr(_BGPSessions[sessionID]->getPeerAddr());
370  if (intfEntry == nullptr)
371  throw cRuntimeError("No configuration interface for internal peer address: %s", _BGPSessions[sessionID]->getPeerAddr().str().c_str());
372  _BGPSessions[sessionID]->setlinkIntf(intfEntry);
374  throw cRuntimeError("Internal address is not specified for router %s", bgpModule->getOwner()->getFullName());
375  socket->bind(internalAddress, 0);
376  }
377  _socketMap.addSocket(socket);
378 
379  socket->connect(_BGPSessions[sessionID]->getPeerAddr(), TCP_PORT);
380 }

Referenced by inet::bgp::BgpSession::openTCPConnectionToPeer().

◆ ospfExist()

bool inet::bgp::BgpRouter::ospfExist ( IIpv4RoutingTable rtTable)
private
850 {
851  for (int i = 0; i < rtTable->getNumRoutes(); i++) {
852  if (rtTable->getRoute(i)->getSourceType() == IRoute::OSPF) {
853  return true;
854  }
855  }
856  return false;
857 }

Referenced by decisionProcess().

◆ printKeepAliveMessage()

void inet::bgp::BgpRouter::printKeepAliveMessage ( const BgpKeepAliveMessage msg)
982 {
983  // TODO add code once implemented
984 }

Referenced by processMessage(), and inet::bgp::BgpSession::sendKeepAliveMessage().

◆ printOpenMessage()

void inet::bgp::BgpRouter::printOpenMessage ( const BgpOpenMessage msg)
892 {
893  EV_INFO << " My AS: " << openMsg.getMyAS() << "\n";
894  EV_INFO << " Hold time: " << openMsg.getHoldTime() << "s \n";
895  EV_INFO << " BGP Id: " << openMsg.getBGPIdentifier() << "\n";
896  if (openMsg.getOptionalParameterArraySize() == 0)
897  EV_INFO << " Optional parameters: empty \n";
898  for (uint32_t i = 0; i < openMsg.getOptionalParameterArraySize(); i++) {
899  auto optParam = openMsg.getOptionalParameter(i);
900  ASSERT(optParam != nullptr);
901  EV_INFO << " Optional parameter " << i + 1 << ": \n";
902  EV_INFO << " Parameter type: " << optParam->getParameterType() << "\n";
903  EV_INFO << " Parameter length: " << optParam->getParameterValueLength() << "\n";
904  }
905 }

Referenced by processMessage(), and inet::bgp::BgpSession::sendOpenMessage().

◆ printSessionSummary()

void inet::bgp::BgpRouter::printSessionSummary ( )
36 {
37  EV_DEBUG << "summary of BGP sessions: \n";
38  for (auto& entry : _BGPSessions) {
39  BgpSession *session = entry.second;
40  BgpSessionType type = session->getType();
41  if (type == IGP) {
42  EV_DEBUG << " IGP session to internal peer '" << session->getPeerAddr().str(false)
43  << "' starts at " << session->getStartEventTime() << "s \n";
44  }
45  else if (type == EGP) {
46  EV_DEBUG << " EGP session to external peer '" << session->getPeerAddr().str(false)
47  << "' starts at " << session->getStartEventTime() << "s \n";
48  }
49  else {
50  EV_DEBUG << " Unknown session to peer '" << session->getPeerAddr().str(false)
51  << "' starts at " << session->getStartEventTime() << "s \n";
52  }
53  }
54 }

Referenced by inet::bgp::Bgp::createBgpRouter().

◆ printUpdateMessage()

void inet::bgp::BgpRouter::printUpdateMessage ( const BgpUpdateMessage msg)
908 {
909  if (updateMsg.getWithdrawnRoutesArraySize() == 0)
910  EV_INFO << " Withdrawn routes: empty \n";
911  for (uint32_t i = 0; i < updateMsg.getWithdrawnRoutesArraySize(); i++) {
912  const BgpUpdateWithdrawnRoutes& withdrwan = updateMsg.getWithdrawnRoutes(i);
913  EV_INFO << " Withdrawn route " << i + 1 << ": \n";
914  EV_INFO << " length: " << (int)withdrwan.length << "\n";
915  EV_INFO << " prefix: " << withdrwan.prefix << "\n";
916  }
917  if (updateMsg.getPathAttributesArraySize() == 0)
918  EV_INFO << " Path attribute: empty \n";
919  for (uint32_t i = 0; i < updateMsg.getPathAttributesArraySize(); i++) {
920  EV_INFO << " Path attribute " << i + 1 << ": [len:" << updateMsg.getPathAttributes(i)->getLength() << "]\n";
921  switch (updateMsg.getPathAttributes(i)->getTypeCode()) {
923  auto& attr = *check_and_cast<const BgpUpdatePathAttributesOrigin *>(updateMsg.getPathAttributes(i));
924  EV_INFO << " ORIGIN: " << BgpSession::getTypeString(attr.getValue()) << "\n";
925  break;
926  }
928  auto& asPath = *check_and_cast<const BgpUpdatePathAttributesAsPath *>(updateMsg.getPathAttributes(i));
929  EV_INFO << " AS_PATH:";
930  for (uint32_t k = 0; k < asPath.getValueArraySize(); k++) {
931  const BgpAsPathSegment& asPathVal = asPath.getValue(k);
932  for (uint32_t n = 0; n < asPathVal.getAsValueArraySize(); n++) {
933  EV_INFO << " " << asPathVal.getAsValue(n);
934  }
935  }
936  EV_INFO << "\n";
937  break;
938  }
940  auto& attr = *check_and_cast<const BgpUpdatePathAttributesNextHop *>(updateMsg.getPathAttributes(i));
941  EV_INFO << " NEXT_HOP: " << attr.getValue().str(false) << "\n";
942  break;
943  }
945  auto& attr = *check_and_cast<const BgpUpdatePathAttributesLocalPref *>(updateMsg.getPathAttributes(i));
946  EV_INFO << " LOCAL_PREF: " << attr.getValue() << "\n";
947  break;
948  }
950  auto& attr = *check_and_cast<const BgpUpdatePathAttributesAtomicAggregate *>(updateMsg.getPathAttributes(i));
951  (void)attr;
952  EV_INFO << " ATOMIC_AGGREGATE" << "\n";
953  break;
954  }
956  auto& attr = *check_and_cast<const BgpUpdatePathAttributesAggregator *>(updateMsg.getPathAttributes(i));
957  EV_INFO << " AGGREGATOR: " << attr.getAsNumber() << ", " << attr.getBgpSpeaker() << "\n";
958  break;
959  }
961  auto& attr = *check_and_cast<const BgpUpdatePathAttributesMultiExitDisc *>(updateMsg.getPathAttributes(i));
962  EV_INFO << " MULTI_EXIT_DISC: " << attr.getValue() << "\n";
963  break;
964  }
965  }
966  }
967 
968  if (updateMsg.getNLRIArraySize() > 0) {
969  auto NLRI_Base = updateMsg.getNLRI(0);
970  EV_INFO << " Network Layer Reachability Information (NLRI): \n";
971  EV_INFO << " NLRI length: " << (int)NLRI_Base.length << "\n";
972  EV_INFO << " NLRI prefix: " << NLRI_Base.prefix << "\n";
973  }
974 }

Referenced by processMessage(), and inet::bgp::BgpSession::sendUpdateMessage().

◆ processChunks()

void inet::bgp::BgpRouter::processChunks ( const BgpHeader ptrHdr)
private
437 {
438  switch (ptrHdr.getType()) {
439  case BGP_OPEN:
440  processMessage(*check_and_cast<const BgpOpenMessage *>(&ptrHdr));
441  break;
442 
443  case BGP_KEEPALIVE:
444  processMessage(*check_and_cast<const BgpKeepAliveMessage *>(&ptrHdr));
445  break;
446 
447  case BGP_UPDATE:
448  processMessage(*check_and_cast<const BgpUpdateMessage *>(&ptrHdr));
449  break;
450 
451  default:
452  throw cRuntimeError("Invalid BGP message type %d", ptrHdr.getType());
453  }
454 }

Referenced by socketDataArrived().

◆ processMessage() [1/3]

void inet::bgp::BgpRouter::processMessage ( const BgpKeepAliveMessage msg)
private
467 {
469  EV_INFO << "Processing BGP Keep Alive message from "
470  << session->getPeerAddr().str(false)
471  << " with contents: \n";
473  session->getFSM()->KeepAliveMsgEvent();
474 }

◆ processMessage() [2/3]

void inet::bgp::BgpRouter::processMessage ( const BgpOpenMessage msg)
private
457 {
459  EV_INFO << "Processing BGP OPEN message from "
460  << session->getPeerAddr().str(false)
461  << " with contents: \n";
462  printOpenMessage(msg);
463  session->getFSM()->OpenMsgEvent();
464 }

Referenced by processChunks().

◆ processMessage() [3/3]

void inet::bgp::BgpRouter::processMessage ( const BgpUpdateMessage msg)
private
477 {
479  EV_INFO << "Processing BGP Update message from "
480  << session->getPeerAddr().str(false)
481  << " with contents: \n";
482  printUpdateMessage(msg);
483  session->getFSM()->UpdateMsgEvent();
484 
485  BgpRoutingTableEntry *entry = new BgpRoutingTableEntry();
486  entry->setLocalPreference(bgpModule->par("localPreference").intValue());
487  entry->setDestination(msg.getNLRI(0).prefix);
488 
489  Ipv4Address netMask(Ipv4Address::ALLONES_ADDRESS);
490  netMask = Ipv4Address::makeNetmask(msg.getNLRI(0).length);
491  entry->setNetmask(netMask);
492 
493  for (size_t i = 0; i < msg.getPathAttributesArraySize(); i++) {
494  if (msg.getPathAttributes(i)->getTypeCode() == BgpUpdateAttributeTypeCode::AS_PATH) {
495  auto& asPath = *check_and_cast<const BgpUpdatePathAttributesAsPath *>(msg.getPathAttributes(i));
496  for (uint32_t k = 0; k < asPath.getValueArraySize(); k++) {
497  const BgpAsPathSegment& asPathVal = asPath.getValue(k);
498  for (uint32_t n = 0; n < asPathVal.getAsValueArraySize(); n++) {
499  entry->addAS(asPathVal.getAsValue(n));
500  }
501  }
502  }
503  }
504 
505  unsigned char decisionProcessResult = asLoopDetection(entry, myAsId);
506 
507  if (decisionProcessResult == ASLOOP_NO_DETECTED) {
508  // RFC 4271, 9.1. Decision Process
509  decisionProcessResult = decisionProcess(msg, entry, _currSessionId);
510  // RFC 4271, 9.2. Update-Send Process
511  if (decisionProcessResult != 0)
512  updateSendProcess(decisionProcessResult, _currSessionId, entry);
513  }
514  else
515  delete entry;
516 }

◆ processMessageFromTCP()

void inet::bgp::BgpRouter::processMessageFromTCP ( cMessage *  msg)
280 {
281  TcpSocket *socket = check_and_cast_nullable<TcpSocket *>(_socketMap.findSocketFor(msg));
282  if (!socket) {
283  socket = new TcpSocket(msg);
284  socket->setOutputGate(bgpModule->gate("socketOut"));
285  Ipv4Address peerAddr = socket->getRemoteAddress().toIpv4();
287  if (i == static_cast<SessionId>(-1)) {
288  socket->close();
289  _socketMap.removeSocket(socket);
290  delete socket;
291  socket = nullptr;
292  delete msg;
293  return;
294  }
295  socket->setCallback(this);
296  socket->setUserData((void *)(uintptr_t)i);
297 
298  _socketMap.addSocket(socket);
299  _BGPSessions[i]->getSocket()->abort();
300  _socketMap.removeSocket(_BGPSessions[i]->getSocket());
301  _BGPSessions[i]->setSocket(socket);
302  }
303 
304  socket->processMessage(msg);
305 }

Referenced by inet::bgp::Bgp::handleMessage().

◆ recordStatistics()

void inet::bgp::BgpRouter::recordStatistics ( )
65 {
66  unsigned int statTab[NB_STATS] = {
67  0, 0, 0, 0, 0, 0
68  };
69 
70  for (auto& elem : _BGPSessions)
71  (elem).second->getStatistics(statTab);
72 
73  bgpModule->recordScalar("OPENMsgSent", statTab[0]);
74  bgpModule->recordScalar("OPENMsgRecv", statTab[1]);
75  bgpModule->recordScalar("KeepAliveMsgSent", statTab[2]);
76  bgpModule->recordScalar("KeepAliveMsgRcv", statTab[3]);
77  bgpModule->recordScalar("UpdateMsgSent", statTab[4]);
78  bgpModule->recordScalar("UpdateMsgRcv", statTab[5]);
79 }

Referenced by inet::bgp::Bgp::finish().

◆ setAsId()

void inet::bgp::BgpRouter::setAsId ( AsId  myAsId)
inline

◆ setDefaultConfig()

void inet::bgp::BgpRouter::setDefaultConfig ( )
150 {
151  // per router params
152  bool redistributeInternal = bgpModule->par("redistributeInternal").boolValue();
153  std::string redistributeOspf = bgpModule->par("redistributeOspf").stdstringValue();
154  bool redistributeRip = bgpModule->par("redistributeRip").boolValue();
158 
159  // per session params
160  bool nextHopSelf = bgpModule->par("nextHopSelf").boolValue();
161  int localPreference = bgpModule->par("localPreference").intValue();
162  for (auto& session : _BGPSessions) {
163  session.second->setNextHopSelf(nextHopSelf);
164  session.second->setLocalPreference(localPreference);
165  }
166 }

Referenced by inet::bgp::BgpConfigReader::loadASConfig().

◆ setInternalAddress()

void inet::bgp::BgpRouter::setInternalAddress ( Ipv4Address  x)
inline

◆ setLocalPreference()

void inet::bgp::BgpRouter::setLocalPreference ( Ipv4Address  peer,
int  localPref 
)
241 {
242  bool found = false;
243  for (auto& session : _BGPSessions) {
244  if (session.second->getPeerAddr() == peer) {
245  found = true;
246  session.second->setLocalPreference(localPref);
247  break;
248  }
249  }
250  if (!found)
251  throw cRuntimeError("Neighbor address '%s' cannot be found in BGP router %s", peer.str(false).c_str(), bgpModule->getOwner()->getFullName());
252 }

Referenced by inet::bgp::BgpConfigReader::loadASConfig().

◆ setNextHopSelf()

void inet::bgp::BgpRouter::setNextHopSelf ( Ipv4Address  peer,
bool  nextHopSelf 
)
227 {
228  bool found = false;
229  for (auto& session : _BGPSessions) {
230  if (session.second->getPeerAddr() == peer) {
231  found = true;
232  session.second->setNextHopSelf(nextHopSelf);
233  break;
234  }
235  }
236  if (!found)
237  throw cRuntimeError("Neighbor address '%s' cannot be found in BGP router %s", peer.str(false).c_str(), bgpModule->getOwner()->getFullName());
238 }

Referenced by inet::bgp::BgpConfigReader::loadASConfig().

◆ setRedistributeInternal()

void inet::bgp::BgpRouter::setRedistributeInternal ( bool  x)
inline

◆ setRedistributeOspf()

void inet::bgp::BgpRouter::setRedistributeOspf ( std::string  x)
255 {
256  if (str == "") {
257  redistributeOspf = false;
258  return;
259  }
260 
261  redistributeOspf = true;
262  std::vector<std::string> tokens = cStringTokenizer(str.c_str()).asVector();
263 
264  for (auto& Ospfv2RouteType : tokens) {
265  std::transform(Ospfv2RouteType.begin(), Ospfv2RouteType.end(), Ospfv2RouteType.begin(), ::tolower);
266  if (Ospfv2RouteType == "o")
268  else if (Ospfv2RouteType == "ia")
270  else if (Ospfv2RouteType == "e1")
272  else if (Ospfv2RouteType == "e2")
274  else
275  throw cRuntimeError("Unknown OSPF redistribute type '%s' in BGP router %s", Ospfv2RouteType.c_str(), bgpModule->getOwner()->getFullName());
276  }
277 }

Referenced by inet::bgp::BgpConfigReader::loadASConfig(), and setDefaultConfig().

◆ setRedistributeRip()

void inet::bgp::BgpRouter::setRedistributeRip ( bool  x)
inline

◆ setSocketListen()

void inet::bgp::BgpRouter::setSocketListen ( SessionId  id)
144 {
145  TcpSocket *socketListen = new TcpSocket();
146  _BGPSessions[id]->setSocketListen(socketListen);
147 }

Referenced by inet::bgp::BgpConfigReader::loadConfigFromXML(), and inet::bgp::BgpConfigReader::loadEbgpSessionConfig().

◆ setTimer()

void inet::bgp::BgpRouter::setTimer ( SessionId  id,
simtime_t *  delayTab 
)

◆ socketAvailable()

virtual void inet::bgp::BgpRouter::socketAvailable ( TcpSocket socket,
TcpAvailableInfo availableInfo 
)
inlineoverrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

105 { socket->accept(availableInfo->getNewSocketId()); } // TODO

◆ socketClosed()

virtual void inet::bgp::BgpRouter::socketClosed ( TcpSocket socket)
inlineoverrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

108 {}

◆ socketDataArrived() [1/2]

void inet::bgp::BgpRouter::socketDataArrived ( TcpSocket socket)
overrideprotectedvirtual

Implements inet::TcpSocket::ReceiveQueueBasedCallback.

419 {
420  auto queue = socket->getReceiveQueue();
421  while (queue->has<BgpHeader>()) {
422  auto header = queue->pop<BgpHeader>();
423  processChunks(*header.get());
424  }
425 }

◆ socketDataArrived() [2/2]

void inet::bgp::BgpRouter::socketDataArrived ( TcpSocket socket,
Packet packet,
bool  urgent 
)
overrideprotectedvirtual

Notifies about data arrival, packet ownership is transferred to the callee.

Reimplemented from inet::TcpSocket::ReceiveQueueBasedCallback.

428 {
429  _currSessionId = findIdFromSocketConnId(_BGPSessions, socket->getSocketId());
430  if (_currSessionId != static_cast<SessionId>(-1))
431  ReceiveQueueBasedCallback::socketDataArrived(socket, packet, urgent);
432  else
433  delete packet;
434 }

◆ socketDeleted()

virtual void inet::bgp::BgpRouter::socketDeleted ( TcpSocket socket)
inlineoverrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

111 {}

◆ socketEstablished()

void inet::bgp::BgpRouter::socketEstablished ( TcpSocket socket)
overrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

383 {
384  int connId = socket->getSocketId();
386  if (_currSessionId == static_cast<SessionId>(-1)) {
387  throw cRuntimeError("socket id=%d is not established", connId);
388  }
389 
390  // if it's an IGP Session, TCPConnectionConfirmed only if all EGP Sessions established
391  if (_BGPSessions[_currSessionId]->getType() == IGP &&
392  this->findNextSession(EGP) != static_cast<SessionId>(-1))
393  {
394  _BGPSessions[_currSessionId]->getFSM()->TcpConnectionFails();
395  }
396  else {
397  _BGPSessions[_currSessionId]->getFSM()->TcpConnectionConfirmed();
398  _BGPSessions[_currSessionId]->getSocketListen()->abort();
399  }
400 
401  if (_BGPSessions[_currSessionId]->getSocketListen()->getSocketId() != connId &&
402  _BGPSessions[_currSessionId]->getType() == EGP &&
403  this->findNextSession(EGP) != static_cast<SessionId>(-1))
404  {
405  _BGPSessions[_currSessionId]->getSocketListen()->abort();
406  }
407 }

◆ socketFailure()

void inet::bgp::BgpRouter::socketFailure ( TcpSocket socket,
int  code 
)
overrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

410 {
411  int connId = socket->getSocketId();
413  if (_currSessionId != static_cast<SessionId>(-1)) {
414  _BGPSessions[_currSessionId]->getFSM()->TcpConnectionFails();
415  }
416 }

◆ socketPeerClosed()

virtual void inet::bgp::BgpRouter::socketPeerClosed ( TcpSocket socket)
inlineoverrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

107 {}

◆ socketStatusArrived()

virtual void inet::bgp::BgpRouter::socketStatusArrived ( TcpSocket socket,
TcpStatusInfo status 
)
inlineoverrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

110 {}

◆ tieBreakingProcess()

bool inet::bgp::BgpRouter::tieBreakingProcess ( BgpRoutingTableEntry oldEntry,
BgpRoutingTableEntry entry 
)
private

RFC 4271: 9.1.2.2 Breaking Ties used when BGP speaker may have several routes to the same destination that have the same degree of preference.

Returns
bool, true if this process changed the route, false else
654 {
655  if (entry->getLocalPreference() > oldEntry->getLocalPreference()) {
656  deleteBGPRoutingEntry(oldEntry);
657  return false;
658  }
659 
660  /* Remove from consideration all routes that are not tied for
661  having the smallest number of AS numbers present in their
662  AS_PATH attributes.*/
663  if (entry->getASCount() < oldEntry->getASCount()) {
664  deleteBGPRoutingEntry(oldEntry);
665  return false;
666  }
667 
668  /* Remove from consideration all routes that are not tied for
669  having the lowest Origin number in their Origin attribute.*/
670  if (entry->getPathType() < oldEntry->getPathType()) {
671  deleteBGPRoutingEntry(oldEntry);
672  return false;
673  }
674 
675  return true;
676 }

Referenced by decisionProcess().

◆ updateSendProcess()

void inet::bgp::BgpRouter::updateSendProcess ( const unsigned char  decisionProcessResult,
SessionId  sessionIndex,
BgpRoutingTableEntry entry 
)
protected

RFC 4271, 9.2 : Update-Send Process / Sent or not new UPDATE messages to its peers.

679 {
680  // Don't send the update Message if the route exists in listOUTTable
681  // SESSION = EGP : send an update message to all BGP Peer (EGP && IGP)
682  // if it is not the currentSession and if the session is already established
683  // SESSION = IGP : send an update message to External BGP Peer (EGP) only
684  // if it is not the currentSession and if the session is already established
685  for (auto& elem : _BGPSessions) {
686  if (isInTable(_prefixListOUT, entry) != (unsigned long)-1 || isInASList(_ASListOUT, entry) ||
687  ((elem).first == sessionIndex && type != NEW_SESSION_ESTABLISHED) ||
688  (type == NEW_SESSION_ESTABLISHED && (elem).first != sessionIndex) ||
689  !(elem).second->isEstablished())
690  {
691  continue;
692  }
693 
694  // if the next hop is not reachable
695  if (!isReachable(entry->getGateway()))
696  continue;
697 
698  BgpSessionType sType = _BGPSessions[sessionIndex]->getType();
699 
700  // BGP split horizon: skip if this prefix is learned over I-BGP and we are
701  // advertising it to another internal peer.
702  if (entry->isIBgpLearned() && sType == IGP && elem.second->getType() == IGP) {
703  EV_INFO << "BGP Split Horizon: prevent advertisement of network "
704  << entry->getDestination() << "\\" << entry->getNetmask();
705  continue;
706  }
707 
708  if ((sType == IGP && (elem).second->getType() == EGP) ||
709  sType == EGP ||
712  {
713  BgpUpdateNlri NLRI;
714  std::vector<BgpUpdatePathAttributes *> content;
715 
716  unsigned int nbAS = entry->getASCount();
717  auto asPath = new BgpUpdatePathAttributesAsPath();
718  content.push_back(asPath);
719  asPath->setValueArraySize(1);
720  asPath->getValueForUpdate(0).setType(AS_SEQUENCE);
721  asPath->getValueForUpdate(0).setLength(0);
722  if ((elem).second->getType() == EGP) {
723  // RFC 4271 : set My AS in first position if it is not already
724  if (entry->getAS(0) != myAsId) {
725  asPath->getValueForUpdate(0).setAsValueArraySize(nbAS + 1);
726  asPath->getValueForUpdate(0).setLength(nbAS + 1);
727  asPath->getValueForUpdate(0).setAsValue(0, myAsId);
728  for (unsigned int j = 1; j < nbAS + 1; j++)
729  asPath->getValueForUpdate(0).setAsValue(j, entry->getAS(j - 1));
730  }
731  else {
732  asPath->getValueForUpdate(0).setAsValueArraySize(nbAS);
733  asPath->getValueForUpdate(0).setLength(nbAS);
734  for (unsigned int j = 0; j < nbAS; j++)
735  asPath->getValueForUpdate(0).setAsValue(j, entry->getAS(j));
736  }
737  }
738  // no AS number is added when the route is being advertised between internal peers
739  else if ((elem).second->getType() == IGP) {
740  asPath->getValueForUpdate(0).setAsValueArraySize(nbAS);
741  asPath->getValueForUpdate(0).setLength(nbAS);
742  for (unsigned int j = 0; j < nbAS; j++)
743  asPath->getValueForUpdate(0).setAsValue(j, entry->getAS(j));
744 
745  auto localPref = new BgpUpdatePathAttributesLocalPref();
746  content.push_back(localPref);
747  localPref->setLength(4);
748  localPref->setValue(_BGPSessions[sessionIndex]->getLocalPreference());
749  }
750  asPath->setLength(2 + 2 * asPath->getValue(0).getAsValueArraySize());
751 
752  auto nextHopAttr = new BgpUpdatePathAttributesNextHop;
753  content.push_back(nextHopAttr);
754  if (sType == EGP || _BGPSessions[sessionIndex]->getNextHopSelf()) {
755  NetworkInterface *iftEntry = (elem).second->getLinkIntf();
756  nextHopAttr->setValue(iftEntry->getProtocolData<Ipv4InterfaceData>()->getIPAddress());
757  }
758  else
759  nextHopAttr->setValue(entry->getGateway());
760 
761  auto originAttr = new BgpUpdatePathAttributesOrigin;
762  content.push_back(originAttr);
763  originAttr->setValue((BgpSessionType)entry->getPathType());
764 
765  Ipv4Address netMask = entry->getNetmask();
766  NLRI.prefix = entry->getDestination().doAnd(netMask);
767  NLRI.length = (unsigned char)netMask.getNetmaskLength();
768 
769  (elem).second->sendUpdateMessage(content, NLRI);
770  }
771  }
772 }

Referenced by processMessage(), and inet::bgp::BgpSession::updateSendProcess().

Friends And Related Function Documentation

◆ BgpSession

friend class BgpSession
friend

Member Data Documentation

◆ _ASListIN

std::vector<AsId> inet::bgp::BgpRouter::_ASListIN
private

Referenced by addToAsList(), and decisionProcess().

◆ _ASListOUT

std::vector<AsId> inet::bgp::BgpRouter::_ASListOUT
private

Referenced by addToAsList(), and updateSendProcess().

◆ _BGPSessions

◆ _currSessionId

SessionId inet::bgp::BgpRouter::_currSessionId = 0
private

◆ _prefixListIN

RoutingTableEntryVector inet::bgp::BgpRouter::_prefixListIN
private

Referenced by addToPrefixList(), and decisionProcess().

◆ _prefixListINOUT

RoutingTableEntryVector inet::bgp::BgpRouter::_prefixListINOUT
private

Referenced by addToPrefixList(), and ~BgpRouter().

◆ _prefixListOUT

RoutingTableEntryVector inet::bgp::BgpRouter::_prefixListOUT
private

◆ _socketMap

SocketMap inet::bgp::BgpRouter::_socketMap
private

◆ advertiseList

std::vector<Ipv4Address> inet::bgp::BgpRouter::advertiseList
private

Referenced by addToAdvertiseList().

◆ bgpModule

◆ bgpRoutingTable

RoutingTableEntryVector inet::bgp::BgpRouter::bgpRoutingTable
private

◆ ift

IInterfaceTable* inet::bgp::BgpRouter::ift = nullptr
private

Referenced by BgpRouter().

◆ internalAddress

Ipv4Address inet::bgp::BgpRouter::internalAddress = Ipv4Address::UNSPECIFIED_ADDRESS
private

Referenced by openTCPConnectionToPeer().

◆ myAsId

◆ numEgpSessions

uint32_t inet::bgp::BgpRouter::numEgpSessions = 0
private

Referenced by createEbgpSession().

◆ numIgpSessions

uint32_t inet::bgp::BgpRouter::numIgpSessions = 0
private

Referenced by createIbgpSession().

◆ ospfModule

ospfv2::Ospfv2* inet::bgp::BgpRouter::ospfModule = nullptr
private

Referenced by BgpRouter(), and decisionProcess().

◆ redistributeInternal

bool inet::bgp::BgpRouter::redistributeInternal = false
private

◆ redistributeOspf

bool inet::bgp::BgpRouter::redistributeOspf = false
private

◆ redistributeOspfType

redistributeOspfType_t inet::bgp::BgpRouter::redistributeOspfType = {}
private

◆ redistributeRip

bool inet::bgp::BgpRouter::redistributeRip = false
private

◆ rt


The documentation for this class was generated from the following files:
inet::bgp::BgpRouter::processChunks
void processChunks(const BgpHeader &ptrHdr)
Definition: BgpRouter.cc:436
inet::bgp::SessionId
unsigned long SessionId
Definition: BgpCommon.h:52
inet::bgp::EGP
@ EGP
Definition: BgpCommon_m.h:57
inet::bgp::ASLOOP_DETECTED
const unsigned char ASLOOP_DETECTED
Definition: BgpCommon.h:36
inet::bgp::BgpRouter::isReachable
bool isReachable(const Ipv4Address addr) const
Definition: BgpRouter.cc:1083
inet::bgp::ORIGIN
@ ORIGIN
Definition: BgpHeader_m.h:425
inet::bgp::BgpRouter::rt
IIpv4RoutingTable * rt
Definition: BgpRouter.h:30
inet::IIpv4RoutingTable::getRouterId
virtual Ipv4Address getRouterId() const =0
Returns routerId.
inet::Ipv4Route::getSourceType
SourceType getSourceType() const override
Source of route.
Definition: Ipv4Route.h:89
inet::IRoute::RIP
@ RIP
managed by the given routing protocol
Definition: IRoute.h:34
inet::TcpSocket::LISTENING
@ LISTENING
Definition: TcpSocket.h:153
inet::bgp::BgpRouter::redistributeOspfType
redistributeOspfType_t redistributeOspfType
Definition: BgpRouter.h:43
inet::bgp::BgpRouter::ospfModule
ospfv2::Ospfv2 * ospfModule
Definition: BgpRouter.h:32
inet::IRoute::MANUAL
@ MANUAL
manually added static route
Definition: IRoute.h:29
inet::bgp::BgpSession::getTypeString
static const std::string getTypeString(BgpSessionType sessionType)
Definition: BgpSession.cc:205
inet::TcpSocket::NOT_BOUND
@ NOT_BOUND
Definition: TcpSocket.h:153
inet::bgp::ASLOOP_NO_DETECTED
const unsigned char ASLOOP_NO_DETECTED
Definition: BgpCommon.h:35
inet::bgp::BgpRouter::setRedistributeOspf
void setRedistributeOspf(std::string x)
Definition: BgpRouter.cc:254
inet::bgp::BgpRouter::ospfExist
bool ospfExist(IIpv4RoutingTable *rtTable)
Definition: BgpRouter.cc:849
inet::bgp::BgpRouter::_prefixListOUT
RoutingTableEntryVector _prefixListOUT
Definition: BgpRouter.h:55
inet::bgp::ATOMIC_AGGREGATE
@ ATOMIC_AGGREGATE
Definition: BgpHeader_m.h:430
inet::bgp::BgpRouter::_BGPSessions
std::map< SessionId, BgpSession * > _BGPSessions
Definition: BgpRouter.h:46
inet::bgp::BgpRouter::advertiseList
std::vector< Ipv4Address > advertiseList
Definition: BgpRouter.h:53
inet::IIpv4RoutingTable::getInterfaceForDestAddr
virtual NetworkInterface * getInterfaceForDestAddr(const Ipv4Address &dest) const =0
Convenience function based on findBestMatchingRoute().
inet::bgp::BgpRouter::redistributeOspfType_t::intraArea
bool intraArea
Definition: BgpRouter.h:39
inet::bgp::BgpRouter::redistributeOspfType_t::externalType1
bool externalType1
Definition: BgpRouter.h:40
inet::bgp::BgpRouter::setRedistributeInternal
void setRedistributeInternal(bool x)
Definition: BgpRouter.h:74
inet::bgp::NEW_SESSION_ESTABLISHED
const unsigned char NEW_SESSION_ESTABLISHED
Definition: BgpCommon.h:34
inet::bgp::BgpRouter::_prefixListINOUT
RoutingTableEntryVector _prefixListINOUT
Definition: BgpRouter.h:56
inet::bgp::BgpRouter::findIdFromSocketConnId
SessionId findIdFromSocketConnId(std::map< SessionId, BgpSession * > sessions, int connId)
Definition: BgpRouter.cc:810
inet::IRoute::BGP
@ BGP
managed by the given routing protocol
Definition: IRoute.h:36
connId
az accept haszálja pcb új connId
Definition: lwip_tcp.txt:42
inet::bgp::BgpRouter::BgpSession
friend class BgpSession
Definition: BgpRouter.h:114
inet::bgp::BgpRouter::redistributeInternal
bool redistributeInternal
Definition: BgpRouter.h:34
inet::bgp::BgpRouter::checkExternalRoute
int checkExternalRoute(const Ipv4Route *ospfRoute)
Definition: BgpRouter.h:166
inet::IRoute::dBGPInternal
@ dBGPInternal
Definition: IRoute.h:73
inet::bgp::BgpRouter::printUpdateMessage
void printUpdateMessage(const BgpUpdateMessage &msg)
Definition: BgpRouter.cc:907
inet::bgp::AS_SEQUENCE
@ AS_SEQUENCE
Definition: BgpCommon_m.h:76
inet::bgp::BgpRouter::isInASList
bool isInASList(std::vector< AsId > ASList, BgpRoutingTableEntry *entry)
Definition: BgpRouter.cc:836
inet::SocketMap::findSocketFor
ISocket * findSocketFor(cMessage *msg)
Finds the socket for the given message.
Definition: SocketMap.cc:19
inet::bgp::BgpRouter::isInTable
unsigned long isInTable(std::vector< BgpRoutingTableEntry * > rtTable, BgpRoutingTableEntry *entry)
Definition: BgpRouter.cc:822
inet::Ipv4Address::ALLONES_ADDRESS
static const Ipv4Address ALLONES_ADDRESS
255.255.255.255
Definition: Ipv4Address.h:94
inet::bgp::BgpRouter::tieBreakingProcess
bool tieBreakingProcess(BgpRoutingTableEntry *oldEntry, BgpRoutingTableEntry *entry)
RFC 4271: 9.1.2.2 Breaking Ties used when BGP speaker may have several routes to the same destination...
Definition: BgpRouter.cc:653
inet::bgp::IGP
@ IGP
Definition: BgpCommon_m.h:56
inet::bgp::NEXT_HOP
@ NEXT_HOP
Definition: BgpHeader_m.h:427
inet::SocketMap::addSocket
void addSocket(ISocket *socket)
Adds the given socket.
Definition: SocketMap.cc:28
inet::bgp::BgpRouter::numIgpSessions
uint32_t numIgpSessions
Definition: BgpRouter.h:48
inet::bgp::BgpRouter::isExternalAddress
bool isExternalAddress(const Ipv4Route &rtEntry)
Definition: BgpRouter.cc:1063
inet::IIpv4RoutingTable::getRoute
virtual Ipv4Route * getRoute(int k) const override=0
Returns the kth route.
inet::bgp::BgpRouter::setRedistributeRip
void setRedistributeRip(bool x)
Definition: BgpRouter.h:76
inet::ospfv2::Ospfv2::checkExternalRoute
int checkExternalRoute(const Ipv4Address &route)
Checks if the route is in OSPF external LSA Table.
Definition: Ospfv2.cc:176
inet::IRoute::OSPF
@ OSPF
managed by the given routing protocol
Definition: IRoute.h:35
inet::Ipv4Address::maskedAddrAreEqual
static bool maskedAddrAreEqual(const Ipv4Address &addr1, const Ipv4Address &addr2, const Ipv4Address &netmask)
Test if the masked addresses (ie the mask is applied to addr1 and addr2) are equal.
Definition: Ipv4Address.cc:249
inet::bgp::BgpRouter::deleteBGPRoutingEntry
bool deleteBGPRoutingEntry(BgpRoutingTableEntry *entry)
Definition: BgpRouter.cc:779
inet::ospfv2::Ospfv2RoutingTableEntry::INTERAREA
@ INTERAREA
Definition: Ospfv2RoutingTableEntry.h:27
inet::Ipv4Address::makeNetmask
static Ipv4Address makeNetmask(int length)
Creates and returns a netmask with the given length.
Definition: Ipv4Address.h:329
inet::bgp::BgpRouter::bgpRoutingTable
RoutingTableEntryVector bgpRoutingTable
Definition: BgpRouter.h:52
inet::bgp::BgpRouter::bgpModule
cSimpleModule * bgpModule
Definition: BgpRouter.h:31
inet::bgp::BgpRouter::numEgpSessions
uint32_t numEgpSessions
Definition: BgpRouter.h:47
type
removed type
Definition: IUdp-gates.txt:7
inet::bgp::BgpRouter::findNextSession
SessionId findNextSession(BgpSessionType type, bool startSession=false)
find the next SessionId compared to his type and start this session if boolean is true
Definition: BgpRouter.cc:860
inet::bgp::BgpRouter::_prefixListIN
RoutingTableEntryVector _prefixListIN
Definition: BgpRouter.h:54
inet::bgp::AS_PATH
@ AS_PATH
Definition: BgpHeader_m.h:426
inet::Ipv4Address::set
void set(uint32_t ip)
name Setting the address
Definition: Ipv4Address.h:142
inet::IIpv4RoutingTable::deleteRoute
virtual bool deleteRoute(Ipv4Route *entry)=0
Deletes the given route from the routing table.
inet::bgp::BgpRouter::processMessage
void processMessage(const BgpOpenMessage &msg)
Definition: BgpRouter.cc:456
inet::IRoutingTable::getNumRoutes
virtual int getNumRoutes() const =0
Returns the total number of unicast routes.
inet::ospfv2::Ospfv2::insertExternalRoute
void insertExternalRoute(int ifIndex, const Ipv4AddressRange &netAddr)
Insert a route learn by BGP in OSPF routingTable as an external route.
Definition: Ospfv2.cc:159
inet::IIpv4RoutingTable::addRoute
virtual void addRoute(Ipv4Route *entry)=0
Adds a route to the routing table.
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::bgp::LOCAL_PREF
@ LOCAL_PREF
Definition: BgpHeader_m.h:429
inet::bgp::BgpRouter::myAsId
AsId myAsId
Definition: BgpRouter.h:33
inet::IRoute::dBGPExternal
@ dBGPExternal
Definition: IRoute.h:64
inet::bgp::BgpRouter::_socketMap
SocketMap _socketMap
Definition: BgpRouter.h:44
inet::bgp::ROUTE_DESTINATION_CHANGED
const unsigned char ROUTE_DESTINATION_CHANGED
Definition: BgpCommon.h:32
inet::bgp::BgpRouter::findIdFromPeerAddr
SessionId findIdFromPeerAddr(std::map< SessionId, BgpSession * > sessions, Ipv4Address peerAddr)
Definition: BgpRouter.cc:882
inet::Ipv4Address::UNSPECIFIED_ADDRESS
static const Ipv4Address UNSPECIFIED_ADDRESS
0.0.0.0
Definition: Ipv4Address.h:91
inet::bgp::NEW_ROUTE_ADDED
const unsigned char NEW_ROUTE_ADDED
Definition: BgpCommon.h:33
inet::bgp::BgpRouter::redistributeOspfType_t::interArea
bool interArea
Definition: BgpRouter.h:38
inet::bgp::NB_STATS
const unsigned char NB_STATS
Definition: BgpCommon.h:28
inet::bgp::AGGREGATOR
@ AGGREGATOR
Definition: BgpHeader_m.h:431
inet::TcpSocket::CLOSED
@ CLOSED
Definition: TcpSocket.h:153
inet::IRoute::dUnknown
@ dUnknown
Definition: IRoute.h:77
inet::bgp::BGP_KEEPALIVE
@ BGP_KEEPALIVE
Definition: BgpHeader_m.h:151
inet::bgp::BgpRouter::redistributeOspf
bool redistributeOspf
Definition: BgpRouter.h:36
inet::bgp::BGP_OPEN
@ BGP_OPEN
Definition: BgpHeader_m.h:148
inet::bgp::BgpRouter::printOpenMessage
void printOpenMessage(const BgpOpenMessage &msg)
Definition: BgpRouter.cc:891
inet::bgp::BgpRouter::updateSendProcess
void updateSendProcess(const unsigned char decisionProcessResult, SessionId sessionIndex, BgpRoutingTableEntry *entry)
RFC 4271, 9.2 : Update-Send Process / Sent or not new UPDATE messages to its peers.
Definition: BgpRouter.cc:678
inet::bgp::BgpRouter::isInRoutingTable
int isInRoutingTable(IIpv4RoutingTable *rtTable, Ipv4Address addr)
Definition: BgpRouter.cc:796
inet::bgp::BgpSessionType
BgpSessionType
Enum generated from inet/routing/bgpv4/BgpCommon.msg:12 by opp_msgtool.
Definition: BgpCommon_m.h:55
inet::bgp::MULTI_EXIT_DISC
@ MULTI_EXIT_DISC
Definition: BgpHeader_m.h:428
inet::bgp::TCP_PORT
const unsigned char TCP_PORT
Definition: BgpCommon.h:21
inet::bgp::BgpRouter::isDefaultRoute
bool isDefaultRoute(const Ipv4Route *entry) const
Definition: BgpRouter.cc:1076
inet::bgp::BgpRouter::redistributeRip
bool redistributeRip
Definition: BgpRouter.h:35
inet::units::values::m
value< double, units::m > m
Definition: Units.h:1233
inet::SocketMap::addWatch
void addWatch()
Definition: SocketMap.cc:51
inet::bgp::BgpRouter::_ASListOUT
std::vector< AsId > _ASListOUT
Definition: BgpRouter.h:58
inet::ospfv2::Ospfv2RoutingTableEntry::INTRAAREA
@ INTRAAREA
Definition: Ospfv2RoutingTableEntry.h:26
inet::bgp::BgpRouter::printKeepAliveMessage
void printKeepAliveMessage(const BgpKeepAliveMessage &msg)
Definition: BgpRouter.cc:981
inet::bgp::BgpRouter::decisionProcess
unsigned char decisionProcess(const BgpUpdateMessage &msg, BgpRoutingTableEntry *entry, SessionId sessionIndex)
RFC 4271: 9.1.
Definition: BgpRouter.cc:528
inet::bgp::BgpRouter::internalAddress
Ipv4Address internalAddress
Definition: BgpRouter.h:49
inet::bgp::BgpRouter::_currSessionId
SessionId _currSessionId
Definition: BgpRouter.h:45
inet::bgp::BgpRouter::asLoopDetection
unsigned char asLoopDetection(BgpRoutingTableEntry *entry, AsId myAS)
Definition: BgpRouter.cc:518
inet::SocketMap::removeSocket
ISocket * removeSocket(ISocket *socket)
Removes the given socket.
Definition: SocketMap.cc:34
inet::bgp::BgpRouter::_ASListIN
std::vector< AsId > _ASListIN
Definition: BgpRouter.h:57
inet::bgp::BgpRouter::redistributeOspfType_t::externalType2
bool externalType2
Definition: BgpRouter.h:41
inet::IRoute::IFACENETMASK
@ IFACENETMASK
comes from an interface's netmask
Definition: IRoute.h:30
inet::bgp::BgpRouter::ift
IInterfaceTable * ift
Definition: BgpRouter.h:29
inet::bgp::BGP_UPDATE
@ BGP_UPDATE
Definition: BgpHeader_m.h:149