Skip to content

Commit 7863012

Browse files
committed
add BGP ECMP support (IPv4)
1 parent e03da44 commit 7863012

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

code/bngblaster/src/bbl_tcp.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,9 @@ bbl_tcp_ipv6_connect_session(bbl_session_s *session, ipv6addr_t *src, ipv6addr_t
822822
void
823823
bbl_tcp_ipv4_rx(bbl_network_interface_s *interface, bbl_ethernet_header_s *eth, bbl_ipv4_s *ipv4) {
824824
struct pbuf *pbuf;
825+
bbl_tcp_s *tcp;
826+
bgp_session_s *session;
827+
825828
UNUSED(eth);
826829

827830
if(!g_ctx->tcp) {
@@ -830,14 +833,26 @@ bbl_tcp_ipv4_rx(bbl_network_interface_s *interface, bbl_ethernet_header_s *eth,
830833
}
831834
interface->stats.tcp_rx++;
832835

836+
tcp = (bbl_tcp_s*)ipv4->next;
837+
833838
#if BNGBLASTER_TCP_DEBUG
834-
bbl_tcp_s *tcp = (bbl_tcp_s*)ipv4->next;
835839
LOG(DEBUG, "TCP (%s %s:%u - %s:%u) packet received\n",
836840
interface->name,
837841
format_ipv4_address(&ipv4->dst), tcp->dst,
838842
format_ipv4_address(&ipv4->src), tcp->src);
839843
#endif
840844

845+
if(tcp->dst == BGP_PORT || tcp->src == BGP_PORT) {
846+
session = g_ctx->bgp_sessions;
847+
while(session) {
848+
if(session->ipv4_local_address == ipv4->dst &&
849+
session->ipv4_peer_address == ipv4->src) {
850+
interface = session->interface;
851+
}
852+
session = session->next;
853+
}
854+
}
855+
841856
ip_data.current_netif = &interface->netif;
842857
ip_data.current_input_netif = &interface->netif;
843858
ip_data.current_iphdr_dest.type = IPADDR_TYPE_V4;

0 commit comments

Comments
 (0)