FRRouting / frr

The FRRouting Protocol Suite
https://frrouting.org/
Other
3.34k stars 1.25k forks source link

The interface information is difference between static and zebra #6198

Open kwind opened 4 years ago

kwind commented 4 years ago

Describe the bug The interface information is difference between static and zebra, call "if_lookup_by_name" and "if_lookup_by_index" with the same interface name or index, got the difference interface information, such as, the interface flags value .

Screenshots zebra:

(gdb) p *(struct interface *) 0x7fad36a39700
$3 = {
  name_entry = {
    rbt_parent = 0x7fad36a39200, 
    rbt_left = 0x0, 
    rbt_right = 0x0, 
    rbt_color = 1
  }, 
  index_entry = {
    rbt_parent = 0x7fad36a39220, 
    rbt_left = 0x0, 
    rbt_right = 0x0, 
    rbt_color = 1
  }, 
  name = "ge1", '\000' <repeats 12 times>, 
  ifindex = 205, 
  link_ifindex = 0, 
  status = 5 '\005', 
    **flags = 69699,** 
  metric = 0, 
  speed = 0, 
  mtu = 1500, 
  mtu6 = 1500, 
  ll_type = ZEBRA_LLT_UNKNOWN, 
  hw_addr = "\"\035\032I\374\234", '\000' <repeats 13 times>, 
  hw_addr_len = 6, 
  bandwidth = 0, 
  link_params = 0x0, 
  desc = 0x0, 
  distribute_in = 0x0, 
  distribute_out = 0x0, 
  connected = 0x7fad32e182f0, 
  nbr_connected = 0x7fad32e182c0, 
  info = 0x7fad36bbbd80, 
  ptm_enable = 0 '\000', 
  ptm_status = 2 '\002', 
  node = 0x7fad357fc600, 
  vrf_id = 0, 
  qobj_node = {
    nid = 4329644906466933462, 
    nodehash = {
      hi = {
        next = 0x0, 
        hashval = 1569356502
      }
    }, 
    type = 0x6a5140 <qobj_t_interface>
  }
}

static:

(gdb) p *(struct interface *) 0x7fd0af8390c0
$4 = {
  name_entry = {
    rbt_parent = 0x7fd0af838f80, 
    rbt_left = 0x0, 
    rbt_right = 0x0, 
    rbt_color = 1
  }, 
  index_entry = {
    rbt_parent = 0x7fd0af838fa0, 
    rbt_left = 0x0, 
    rbt_right = 0x0, 
    rbt_color = 1
  }, 
  name = "ge1", '\000' <repeats 12 times>, 
  ifindex = 205, 
  link_ifindex = 0, 
  status = 4 '\004', 
  **flags = 4098,** 
  metric = 0, 
  speed = 0, 
  mtu = 1500, 
  mtu6 = 1500, 
  ll_type = ZEBRA_LLT_UNKNOWN, 
  hw_addr = "\"\035\032I\374\234", '\000' <repeats 13 times>, 
  hw_addr_len = 6, 
  bandwidth = 0, 
  link_params = 0x0, 
  desc = 0x0, 
  distribute_in = 0x0, 
  distribute_out = 0x0, 
  connected = 0x7fd0af852180, 
  nbr_connected = 0x7fd0af835fd0, 
  info = 0x0, 
  ptm_enable = 0 '\000', 
  ptm_status = 2 '\002', 
  node = 0x0, 
  vrf_id = 0, 
  qobj_node = {
    nid = 4329644906466933462, 
    nodehash = {
      hi = {
        next = 0x0, 
        hashval = 1569356502
      }
    }, 
    type = 0x7fd0b6b11900 <qobj_t_interface>
  }
}

Versions OS Kernel: [e.g. Linux, OpenBSD, etc] [version]: centos 7 FRR Version [version]:7.2 Additional context libyang: libyang-devel-0.16.111-0.x86_64 and libyang-0.16.111-0.x86_64

mjstapp commented 4 years ago

Is there some functional or operational problem that you observe? it's normal for there to be internal data-structure differences between zebra and the routing daemons - they need and use different information in many cases.

kwind commented 4 years ago

yeah, I encountered a problem. When the interface is "IFF_UP" status, but not "IFF_RUNNING", a static route with gateway and the interface, may not be sent to zebra, that's just my opinion。

mjstapp commented 4 years ago

hmm, can you be more specific? I don't see use of "IFF_UP", or "if_is_up", or "if_is_running" in staticd at all, for example.

kwind commented 4 years ago

For example, when the Network cable is unplugged, the NIC status are "IFF_UP"、“BROADCAST”、“MULTICAST”, etc., but without "IFF_RUNNING", so, I think, a static route with gateway and the interface may not be sent to zebra, judging by NIC’ status.