summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.h
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-11-15 16:27:08 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-11-21 12:56:28 +0200
commitbf83f301e4fdbf333240af7f316735e35634c5fd (patch)
tree667c001d36a1b1a95b0f6da82d9919977543746c /src/bp_sim.h
parentc39cdf89bee7999ba714eb31e8ec4bc8b5d52a60 (diff)
client config ARP resolve working. Still missing IPv6 support.
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src/bp_sim.h')
-rwxr-xr-xsrc/bp_sim.h46
1 files changed, 5 insertions, 41 deletions
diff --git a/src/bp_sim.h b/src/bp_sim.h
index 0cf77437..77d2aa81 100755
--- a/src/bp_sim.h
+++ b/src/bp_sim.h
@@ -44,6 +44,7 @@ limitations under the License.
#include <common/bitMan.h>
#include <yaml-cpp/yaml.h>
#include "trex_defs.h"
+#include "utl_ip.h"
#include "os_time.h"
#include "pal_utl.h"
#include "rx_check_header.h"
@@ -72,12 +73,6 @@ class CGenNodePCAP;
#define FORCE_NO_INLINE __attribute__ ((noinline))
#define FORCE_INLINE __attribute__((always_inline))
-/* IP address, last 32-bits of IPv6 remaps IPv4 */
-typedef struct {
- uint16_t v6[6]; /* First 96-bits of IPv6 */
- uint32_t v4; /* Last 32-bits IPv6 overloads v4 */
-} ipaddr_t;
-
/* reserve both 0xFF and 0xFE , router will -1 FF */
#define TTL_RESERVE_DUPLICATE 0xff
#define TOS_TTL_RESERVE_DUPLICATE 0x1
@@ -175,38 +170,6 @@ typedef enum { VM_REPLACE_IP_OFFSET =0x12, /* fix ip at offset */
/* work only on x86 littel */
#define MY_B(b) (((int)b)&0xff)
-// Routine to create IPv4 address string
-inline int ip_to_str(uint32_t ip,char * str){
- uint32_t ipv4 = PKT_HTONL(ip);
- inet_ntop(AF_INET, (const char *)&ipv4, str, INET_ADDRSTRLEN);
- return(strlen(str));
-}
-
-inline std::string ip_to_str(uint32_t ip) {
- char tmp[INET_ADDRSTRLEN];
- ip_to_str(ip, tmp);
- return tmp;
-}
-
-// Routine to create IPv6 address string
-inline int ipv6_to_str(ipaddr_t *ip,char * str){
- int idx=0;
- uint16_t ipv6[8];
- for (uint8_t i=0; i<6; i++) {
- ipv6[i] = PKT_HTONS(ip->v6[i]);
- }
- uint32_t ipv4 = PKT_HTONL(ip->v4);
- ipv6[6] = ipv4 & 0xffff;
- ipv6[7] = ipv4 >> 16;
-
- str[idx++] = '[';
- inet_ntop(AF_INET6, (const char *)&ipv6, &str[1], INET6_ADDRSTRLEN);
- idx = strlen(str);
- str[idx++] = ']';
- str[idx] = 0;
- return(idx);
-}
-
class CFlowPktInfo ;
class CMiniVM {
@@ -694,19 +657,16 @@ class CPerPortIPCfg {
uint32_t get_mask() {return m_mask;}
uint32_t get_def_gw() {return m_def_gw;}
uint32_t get_vlan() {return m_vlan;}
- bool grat_arp_needed() {return m_grat_arp_needed;}
void set_ip(uint32_t val) {m_ip = val;}
void set_mask(uint32_t val) {m_mask = val;}
void set_def_gw(uint32_t val) {m_def_gw = val;}
void set_vlan(uint16_t val) {m_vlan = val;}
- void set_grat_arp_needed(bool val) {m_grat_arp_needed = val;}
private:
uint32_t m_def_gw;
uint32_t m_ip;
uint32_t m_mask;
uint16_t m_vlan;
- bool m_grat_arp_needed;
};
class CParserOption {
@@ -4031,6 +3991,10 @@ public:
int load_from_yaml(std::string csv_file,uint32_t num_threads);
int load_client_config_file(std::string file_name);
+ void set_client_config_tuple_gen_info(CTupleGenYamlInfo * tg);
+ std::vector<ClientCfgCompactEntry *> get_client_cfg_ip_list();
+ void set_client_config_resolved_macs(CManyIPInfo &pretest_result);
+ void dump_client_config(FILE *fd);
public:
void Dump(FILE *fd);