fprintf(stderr, "Resolution of following IPs failed. Exiting.\n");
for (const COneIPInfo *ip=pretest_result.get_next(); ip != NULL;
ip = pretest_result.get_next()) {
- ip->dump(stderr);
+ if (ip->resolve_needed()) {
+ ip->dump(stderr, " ");
+ }
}
- exit(-1);
+ exit(1);
}
m_fl.set_client_config_resolved_macs(pretest_result);
if ( CGlobalInfo::m_options.preview.getVMode() > 1) {
m_fl.dump_client_config(stdout);
}
+ bool port_found[TREX_MAX_PORTS];
+ for (int port_id = 0; port_id < m_max_ports; port_id++) {
+ port_found[port_id] = false;
+ }
+ // If client config enabled, we don't resolve MACs from trex_cfg.yaml. For latency (-l)
+ // We need to able to send packets from RX core, so need to configure MAC/vlan for each port.
+ for (const COneIPInfo *ip=pretest_result.get_next(); ip != NULL; ip = pretest_result.get_next()) {
+ // Use first MAC/vlan we see on each port
+ uint8_t port_id = ip->get_port();
+ uint16_t vlan = ip->get_vlan();
+ if ( ! port_found[port_id]) {
+ port_found[port_id] = true;
+ ip->get_mac(CGlobalInfo::m_options.m_mac_addr[port_id].u.m_mac.dest);
+ CGlobalInfo::m_options.m_ip_cfg[port_id].set_vlan(vlan);
+ }
+ }
} else {
uint8_t mac[ETHER_ADDR_LEN];
for (int port_id = 0; port_id < m_max_ports; port_id++) {
for (std::vector<COneIPInfo *>::iterator it = m_port_info[port].m_dst_info.begin()
; it != m_port_info[port].m_dst_info.end(); ++it) {
uint8_t ip_type = (*it)->ip_ver();
+ (*it)->set_port(port);
switch(ip_type) {
case COneIPInfo::IP4_VER:
resolved_ips.insert(*(COneIPv4Info *)(*it));
get_ip_str(ip_str);
std::string mac_str;
utl_macaddr_to_str(mac, mac_str);
- const char *mac_char = resolve_needed() ? "Not resolved" : mac_str.c_str();
- fprintf(fd, "%sip: %s vlan: %d port: %d mac: %s\n", offset, ip_str, m_vlan, m_port, mac_char);
+ const char *mac_char = resolve_needed() ? "Unknown" : mac_str.c_str();
+ fprintf(fd, "%sip: %s ", offset, ip_str);
+ if (m_vlan != 0)
+ fprintf(fd, "vlan: %d ", m_vlan);
+ if (m_port != UINT8_MAX)
+ fprintf(fd, "port: %d ", m_port);
+ fprintf(fd, "mac: %s", mac_char);
+ fprintf(fd, "\n");
}
bool COneIPInfo::resolve_needed() const {
}
uint16_t get_vlan() const {return m_vlan;}
uint16_t get_port() const {return m_port;}
+ void set_port(uint8_t port) {m_port = port;}
virtual void dump(FILE *fd) const {
dump(fd, "");
}