BIRD 2.0.{7,10} MED not actually send for learned routes if export table on is set

Inrin inrin at caesia.net
Sun Oct 16 11:17:23 CEST 2022


Greetings,

I noticed during setting up a peering that the MED is not actually send
to my peer, although bird shows it in the export.
We confirmed this via tcpdump on both ends.

After debugging a bit, I noticed that this only affects “learned” routes
but routes from the static protocol worked just fine.

After disabling the “export table” feature, the MED was send out just
fine.

Is this behaviour expected?

This behaviour is reproducible in BIRD 2.0.7 and 2.0.10 with the
following scenario (Configs to test are attached):

	R0 is connected to R1 and R2
	R0, R1 and R2 send each one route
	R0 sets the MED to 300
	R1 sets the MED to 100
	R2 sets the MED to 200

Setting “export table on;” yields the following results:

# Bird shows the MED in the export
R0 $ ./birdc s r all export R1
BIRD 2.0.10 ready.
Table master4:
198.18.0.0/24       unicast [static1 02:05:56.604] * (200)
         Type: static univ
         BGP.med: 300
198.18.2.0/24       unicast [R2 02:11:51.132 from 198.19.0.2] * (100) [AS4242420002i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420002
         BGP.next_hop: 198.19.0.2
         BGP.med: 300
         BGP.local_pref: 100
R0 $ ./birdc s r all export R2
BIRD 2.0.10 ready.
Table master4:
198.18.0.0/24       unicast [static1 02:05:56.604] * (200)
         Type: static univ
         BGP.med: 300
198.18.1.0/24       unicast [R1 02:11:51.133 from 198.19.0.1] * (100) [AS4242420001i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420001
         BGP.next_hop: 198.19.0.1
         BGP.med: 300
         BGP.local_pref: 100
R0 #

But on R1, R2 it does not appear for learned routes:
R1 $ ./birdc s r all protocol R0
BIRD 2.0.10 ready.
Table master4:
198.18.0.0/24       unicast [R0 02:11:51.133 from 198.19.0.0] * (100) [AS4242420000i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420000
         BGP.next_hop: 198.19.0.0
         BGP.med: 300
         BGP.local_pref: 100
198.18.2.0/24       unicast [R0 02:11:51.133 from 198.19.0.0] * (100) [AS4242420002i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420000 4242420002
         BGP.next_hop: 198.19.0.0
         BGP.local_pref: 100
R1 $

R2 $ ./birdc s r all protocol R0
BIRD 2.0.10 ready.
Table master4:
198.18.0.0/24       unicast [R0 02:11:51.132 from 198.19.0.0] * (100) [AS4242420000i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420000
         BGP.next_hop: 198.19.0.0
         BGP.med: 300
         BGP.local_pref: 100
198.18.1.0/24       unicast [R0 02:11:51.133 from 198.19.0.0] * (100) [AS4242420001i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420000 4242420001
         BGP.next_hop: 198.19.0.0
         BGP.local_pref: 100
R2 $


Setting “export table off;” yield the expected result:
R1 $ ./birdc s r all protocol R0
BIRD 2.0.10 ready.
Table master4:
198.18.0.0/24       unicast [R0 03:15:47.147 from 198.19.0.0] * (100) [AS4242420000i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420000
         BGP.next_hop: 198.19.0.0
         BGP.med: 300
         BGP.local_pref: 100
198.18.2.0/24       unicast [R0 03:15:50.635 from 198.19.0.0] * (100) [AS4242420002i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420000 4242420002
         BGP.next_hop: 198.19.0.0
         BGP.med: 300
         BGP.local_pref: 100
R1 $

R2 $ ./birdc s r all protocol R0
BIRD 2.0.10 ready.
Table master4:
198.18.0.0/24       unicast [R0 03:15:50.635 from 198.19.0.0] * (100) [AS4242420000i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420000
         BGP.next_hop: 198.19.0.0
         BGP.med: 300
         BGP.local_pref: 100
198.18.1.0/24       unicast [R0 03:15:50.635 from 198.19.0.0] * (100) [AS4242420001i]
         Type: BGP univ
         BGP.origin: IGP
         BGP.as_path: 4242420000 4242420001
         BGP.next_hop: 198.19.0.0
         BGP.med: 300
         BGP.local_pref: 100
R2 $
-------------- next part --------------
protocol static { route 198.18.0.0/24 reject; ipv4 {}; }
template bgp rs_peers {
  local 198.19.0.0 port 1179 as 4242420000;
  ipv4 {
    import table off;
    export table on;
    import all;
    export filter {
      if source ~ [RTS_STATIC, RTS_BGP] then {
	bgp_med = 300;
        accept;
      }
      reject;
    };
  };
};

protocol bgp R1 from rs_peers {
  neighbor 198.19.0.1 port 1179 as 4242420001;
};
protocol bgp R2 from rs_peers {
  neighbor 198.19.0.2 port 1179 as 4242420002;
};
-------------- next part --------------
protocol static { route 198.18.1.0/24 reject; ipv4 { }; }
protocol bgp R0 {
  ipv4 {
    import all;
    export filter {
      if source ~ [RTS_STATIC, RTS_BGP] then {
	bgp_med = 100;
        accept;
      }
      reject;
    };
  };
  local 198.19.0.1 port 1179 as 4242420001;
  neighbor 198.19.0.0 port 1179 as 4242420000;
};
-------------- next part --------------
protocol static { route 198.18.2.0/24 reject; ipv4 { }; }
protocol bgp R0 {
  ipv4 {
    import all;
    export filter {
      # here we export the whole net
      if source ~ [RTS_STATIC, RTS_BGP] then {
	bgp_med = 200;
        accept;
      }
      reject;
    };
  };
  local 198.19.0.2 port 1179 as 4242420002;
  neighbor 198.19.0.0 port 1179 as 4242420000;
};


More information about the Bird-users mailing list