IP src configuriation invalidates ARP resolution 87/4287/1
authorimarom <[email protected]>
Sun, 11 Dec 2016 10:03:07 +0000 (12:03 +0200)
committerimarom <[email protected]>
Sun, 11 Dec 2016 10:03:07 +0000 (12:03 +0200)
Signed-off-by: imarom <[email protected]>
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
src/trex_port_attr.cpp
src/trex_port_attr.h

index ebb716d..9309ad0 100644 (file)
@@ -959,7 +959,7 @@ class Port(object):
                 "src MAC":          info['src_mac'],
                 "src IPv4":         info['src_ipv4'],
                 "Destination":      info['dest'],
-                "ARP Resolution":   info['arp'],
+                "ARP Resolution":   format_text("{0}".format(info['arp']), 'bold', 'red') if info['arp'] == 'unresolved' else info['arp'],
                 "PCI Address":      info['pci_addr'],
                 "NUMA Node":        info['numa'],
                 "--": "",
index 61e8858..0ecbc2c 100644 (file)
@@ -138,8 +138,8 @@ TRexPortAttr::to_json(Json::Value &output) {
 }
 
 void
-TRexPortAttr::update_src_dst_mac(uint8_t *raw_pkt) {
-    memcpy(raw_pkt, get_dest().get_dest_mac(), 6);
+TRexPortAttr::update_src_dst_mac(uint8_t *raw_pkt) const {
+    memcpy(raw_pkt, m_dest.get_dest_mac(), 6);
     memcpy(raw_pkt + 6, get_src_mac(), 6);
 }
 
index ae39743..c69314f 100755 (executable)
@@ -73,7 +73,7 @@ public:
      * if the dest is not resolved 
      * it will return the default MAC 
      */
-    const uint8_t *get_dest_mac() {
+    const uint8_t *get_dest_mac() const {
         return m_mac;
     }
     
@@ -141,7 +141,7 @@ public:
     std::string get_rx_filter_mode() const;
 
     /* for a raw packet, write the src/dst MACs */
-    void update_src_dst_mac(uint8_t *raw_pkt);
+    void update_src_dst_mac(uint8_t *raw_pkt) const;
     
 /*    SETTERS    */
     virtual int set_promiscuous(bool enabled) = 0;
@@ -153,6 +153,8 @@ public:
     
     void set_src_ipv4(uint32_t addr) {
         m_src_ipv4 = addr;
+        /* when IP source changes - consider this as link down */
+        m_dest.on_link_down();
     }
     
     /* DUMPS */