diff options
author | Xavier Simonart <xavier.simonart@intel.com> | 2020-05-02 21:51:24 +0200 |
---|---|---|
committer | Xavier Simonart <xavier.simonart@intel.com> | 2020-05-29 23:31:54 +0200 |
commit | 08fee9c5d2e1d1f3fe14d00683c2a4b7a17e7876 (patch) | |
tree | 5b1f2a9aaab23b654c9504f83eaa1cb8ac2a0b01 /VNFs/DPPD-PROX/rx_pkt.c | |
parent | 354bfce1e946ec796516b3ae7f3fc677960867ef (diff) |
Added initial support for BGP
Through this commit BGP messages are forwarded to tap device
Netlink messages are enabled to receive route Updates.
In addition, generating tasks can also specify a routing table
which will be used when sending packets
The routes initialized by the routing table can be changed through
the reception of BGP messages
Change-Id: I187ba9a921885cbc9b209aae5fb654309e3388b8
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/rx_pkt.c')
-rw-r--r-- | VNFs/DPPD-PROX/rx_pkt.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/rx_pkt.c b/VNFs/DPPD-PROX/rx_pkt.c index 4832066a..6a6112b5 100644 --- a/VNFs/DPPD-PROX/rx_pkt.c +++ b/VNFs/DPPD-PROX/rx_pkt.c @@ -30,6 +30,8 @@ #include "handle_master.h" #include "input.h" /* Needed for callback on dump */ +#define TCP_PORT_BGP rte_cpu_to_be_16(179) + /* _param version of the rx_pkt_hw functions are used to create two instances of very similar variations of these functions. The variations are specified by the "multi" parameter which significies @@ -138,10 +140,15 @@ static uint16_t rx_pkt_hw_param(struct task_base *tbase, struct rte_mbuf ***mbuf if (likely(hdr_arp[i]->ether_hdr.ether_type == ETYPE_IPv4)) { hdr = (prox_rte_ether_hdr *)hdr_arp[i]; prox_rte_ipv4_hdr *pip = (prox_rte_ipv4_hdr *)(hdr + 1); + prox_rte_tcp_hdr *tcp = (prox_rte_tcp_hdr *)(pip + 1); if (pip->next_proto_id == IPPROTO_ICMP) { dump_l3(tbase, mbufs[i]); tx_ring(tbase, tbase->l3.ctrl_plane_ring, ICMP_TO_CTRL, mbufs[i]); skip++; + } else if ((tcp->src_port == TCP_PORT_BGP) || (tcp->dst_port == TCP_PORT_BGP)) { + dump_l3(tbase, mbufs[i]); + tx_ring(tbase, tbase->l3.ctrl_plane_ring, BGP_TO_CTRL, mbufs[i]); + skip++; } else if (unlikely(skip)) { mbufs[i - skip] = mbufs[i]; } @@ -202,13 +209,19 @@ static inline uint16_t rx_pkt_hw1_param(struct task_base *tbase, struct rte_mbuf PREFETCH0(hdr_arp[i]); } for (i = 0; i < nb_rx; i++) { + // plog_info("ether_type = %x\n", hdr_arp[i]->ether_hdr.ether_type); if (likely(hdr_arp[i]->ether_hdr.ether_type == ETYPE_IPv4)) { hdr = (prox_rte_ether_hdr *)hdr_arp[i]; prox_rte_ipv4_hdr *pip = (prox_rte_ipv4_hdr *)(hdr + 1); + prox_rte_tcp_hdr *tcp = (prox_rte_tcp_hdr *)(pip + 1); if (pip->next_proto_id == IPPROTO_ICMP) { dump_l3(tbase, mbufs[i]); tx_ring(tbase, tbase->l3.ctrl_plane_ring, ICMP_TO_CTRL, mbufs[i]); skip++; + } else if ((tcp->src_port == TCP_PORT_BGP) || (tcp->dst_port == TCP_PORT_BGP)) { + dump_l3(tbase, mbufs[i]); + tx_ring(tbase, tbase->l3.ctrl_plane_ring, BGP_TO_CTRL, mbufs[i]); + skip++; } else if (unlikely(skip)) { mbufs[i - skip] = mbufs[i]; } |