RTS_STATIC_DEVICE oddity

Nigel Kukard nkukard at LBSD.net
Fri Aug 21 08:23:57 CEST 2020


Hi guys,

I may be going blind or just dumb, but I could of sworn this worked like
a year ago in v2.

I have a t_static4 table, with a static device route, I pipe this to my
master4 table, then pipe my master4 table to RIP and only pick out the
RTS_STATIC_DEVICE routes.

However the source is set to RTS_STATIC not RTS_STATIC_DEVICE?  enum(30)1

Full config file attached. I tried to summarize it a bit below. I also
attached a diagram.svg of the r1 setup below.

-N



ipv4 table t_static4;

protocol static static4 {
        ipv4 {
                table t_static4;
                export none;
                import all;
        };
*        route 192.168.20.0/24 via "eth1";*
};

protocol pipe p_static4_to_master4 {
        table t_static4;
        peer table master4;

        export all;
        import none;
};

ipv4 table t_rip4;

filter f_rip_export4 {
        # Redistribute static device routes
        if (source = RTS_STATIC_DEVICE) then {
                accept;
        }
        # Redistribute RIP routes
        if (source = RTS_RIP) then {
                accept;
        }
        reject;
};

filter f_rip_import4 {
        # Import all RIP routes by default
        accept;
};

filter f_rip_master4_export {
        # Do not export default route to master
        if (net = 0.0.0.0/0) then {
                reject;
        }
        # Only export RIP routes o the master table
        if (source = RTS_RIP) then {
                accept;
        }
        # Reject everything else;
        reject;
};

filter f_rip_master4_import {
        print "rip to master";
        print source;
*        # Import static device routes into RIP (redistribute static_device)
        if (source = RTS_STATIC_DEVICE) then {
                accept;
        }*
        reject;
};

protocol rip rip4 {
        description "RIP protocol for IPv4";

        ipv4 {
                table t_rip4;

                export filter f_rip_export4;
                import filter f_rip_import4;

        };

        interface "eth0" {
                update time 5;
                metric 2;
        };
};


Here is the result....  (sorry its in JSON)...


-------------------------------------------------------------------------------------
RIP4(r1)
--------------------------------------------------------------------------------------
{}
------------------------------------------------------------------------------------
STATIC4(r1)
------------------------------------------------------------------------------------
{'192.168.20.0/24': [{'nexthops': [{'interface': 'eth1'}],
                      'pref': '200',
                      'prefix_type': 'unicast',
                      'protocol': 'static4',
                      'since': '2020-08-21 05:57:43',
                      'type': ['static', 'univ']}]}
------------------------------------------------------------------------------------
MASTER4(r1)
------------------------------------------------------------------------------------
{'192.168.20.0/24': [{'nexthops': [{'interface': 'eth1'}],
                      'pref': '200',
                      'prefix_type': 'unicast',
                      'protocol': 'static4',
                      'since': '2020-08-21 05:57:43',
                      'type': ['static', 'univ']}]}
------------------------------------------------------------------------------------
KERNEL4(r1)
------------------------------------------------------------------------------------
{'192.168.20.0/24': [{'nexthops': [{'interface': 'eth1'}],
                      'pref': '200',
                      'prefix_type': 'unicast',
                      'protocol': 'static4',
                      'since': '2020-08-21 05:57:43',
                      'type': ['static', 'univ']}]}

And the full log...

------------------------------------------------------------------------------------
LOGFILE(r1)
------------------------------------------------------------------------------------
2020-08-21 05:57:43 <TRACE> device1: Initializing
2020-08-21 05:57:43 <TRACE> kernel4: Channel ipv4 connected to table
t_kernel4
2020-08-21 05:57:43 <TRACE> kernel4: Initializing
2020-08-21 05:57:43 <TRACE> kernel6: Channel ipv6 connected to table
t_kernel6
2020-08-21 05:57:43 <TRACE> kernel6: Initializing
2020-08-21 05:57:43 <TRACE> p_master4_to_kernel4: Channel pri connected
to table master4
2020-08-21 05:57:43 <TRACE> p_master4_to_kernel4: Channel sec connected
to table t_kernel4
2020-08-21 05:57:43 <TRACE> p_master4_to_kernel4: Initializing
2020-08-21 05:57:43 <TRACE> p_master6_to_kernel6: Channel pri connected
to table master6
2020-08-21 05:57:43 <TRACE> p_master6_to_kernel6: Channel sec connected
to table t_kernel6
2020-08-21 05:57:43 <TRACE> p_master6_to_kernel6: Initializing
2020-08-21 05:57:43 <TRACE> static4: Channel ipv4 connected to table
t_static4
2020-08-21 05:57:43 <TRACE> static4: Initializing
2020-08-21 05:57:43 <TRACE> static6: Channel ipv6 connected to table
t_static6
2020-08-21 05:57:43 <TRACE> static6: Initializing
2020-08-21 05:57:43 <TRACE> p_static4_to_master4: Channel pri connected
to table t_static4
2020-08-21 05:57:43 <TRACE> p_static4_to_master4: Channel sec connected
to table master4
2020-08-21 05:57:43 <TRACE> p_static4_to_master4: Initializing
2020-08-21 05:57:43 <TRACE> p_static6_to_master6: Channel pri connected
to table t_static6
2020-08-21 05:57:43 <TRACE> p_static6_to_master6: Channel sec connected
to table master6
2020-08-21 05:57:43 <TRACE> p_static6_to_master6: Initializing
2020-08-21 05:57:43 <TRACE> rip4: Channel ipv4 connected to table t_rip4
2020-08-21 05:57:43 <TRACE> rip4: Initializing
2020-08-21 05:57:43 <TRACE> rip6: Channel ipv6 connected to table t_rip6
2020-08-21 05:57:43 <TRACE> rip6: Initializing
2020-08-21 05:57:43 <TRACE> p_rip4_to_master4: Channel pri connected to
table t_rip4
2020-08-21 05:57:43 <TRACE> p_rip4_to_master4: Channel sec connected to
table master4
2020-08-21 05:57:43 <TRACE> p_rip4_to_master4: Initializing
2020-08-21 05:57:43 <TRACE> p_rip6_to_master6: Channel pri connected to
table t_rip6
2020-08-21 05:57:43 <TRACE> p_rip6_to_master6: Channel sec connected to
table master6
2020-08-21 05:57:43 <TRACE> p_rip6_to_master6: Initializing
2020-08-21 05:57:43 <TRACE> device1: Starting
2020-08-21 05:57:43 <TRACE> device1: Scanning interfaces
2020-08-21 05:57:43 <TRACE> device1: State changed to up
2020-08-21 05:57:43 <TRACE> kernel4: Starting
2020-08-21 05:57:43 <TRACE> kernel4: State changed to up
2020-08-21 05:57:43 <TRACE> kernel6: Starting
2020-08-21 05:57:43 <TRACE> kernel6: State changed to up
2020-08-21 05:57:43 <TRACE> p_master4_to_kernel4: Starting
2020-08-21 05:57:43 <TRACE> p_master4_to_kernel4: State changed to up
2020-08-21 05:57:43 <TRACE> p_master6_to_kernel6: Starting
2020-08-21 05:57:43 <TRACE> p_master6_to_kernel6: State changed to up
2020-08-21 05:57:43 <TRACE> static4: Starting
2020-08-21 05:57:43 <TRACE> static4: State changed to up
2020-08-21 05:57:43 <TRACE> static4 > added [best] 192.168.20.0/24 unicast
2020-08-21 05:57:43 <TRACE> static6: Starting
2020-08-21 05:57:43 <TRACE> static6: State changed to up
2020-08-21 05:57:43 <TRACE> static6 > added [best] fc20::/64 unicast
2020-08-21 05:57:43 <TRACE> p_static4_to_master4: Starting
2020-08-21 05:57:43 <TRACE> p_static4_to_master4: State changed to up
2020-08-21 05:57:43 <TRACE> p_static6_to_master6: Starting
2020-08-21 05:57:43 <TRACE> p_static6_to_master6: State changed to up
2020-08-21 05:57:43 <TRACE> rip4: Starting
2020-08-21 05:57:43 <TRACE> rip4: State changed to up
2020-08-21 05:57:43 <TRACE> rip6: Starting
2020-08-21 05:57:43 <TRACE> rip6: State changed to up
2020-08-21 05:57:43 <TRACE> p_rip4_to_master4: Starting
2020-08-21 05:57:43 <TRACE> p_rip4_to_master4: State changed to up
2020-08-21 05:57:43 <TRACE> p_rip6_to_master6: Starting
2020-08-21 05:57:43 <TRACE> p_rip6_to_master6: State changed to up
2020-08-21 05:57:43 <INFO> Started
2020-08-21 05:57:43 <TRACE> kernel4 < interface lo goes up
2020-08-21 05:57:43 <TRACE> kernel4 < interface eth0 goes up
2020-08-21 05:57:43 <TRACE> kernel4 < interface eth1 goes up
2020-08-21 05:57:43 <TRACE> kernel6 < interface lo goes up
2020-08-21 05:57:43 <TRACE> kernel6 < interface eth0 goes up
2020-08-21 05:57:43 <TRACE> kernel6 < interface eth1 goes up
2020-08-21 05:57:43 <TRACE> p_static4_to_master4 < added 192.168.20.0/24
unicast
2020-08-21 05:57:43 <TRACE> p_static4_to_master4 > added [best]
192.168.20.0/24 unicast
2020-08-21 05:57:43 <TRACE> p_master4_to_kernel4 < added 192.168.20.0/24
unicast
2020-08-21 05:57:43 <TRACE> p_master4_to_kernel4 > added [best]
192.168.20.0/24 unicast
2020-08-21 05:57:43 <TRACE> p_master4_to_kernel4 < rejected by protocol
192.168.20.0/24 unicast
2020-08-21 05:57:43 <TRACE> kernel4 < added 192.168.20.0/24 unicast
2020-08-21 05:57:43 <TRACE> p_static4_to_master4 < rejected by protocol
192.168.20.0/24 unicast
2020-08-21 05:57:43 <INFO> rip to master
2020-08-21 05:57:43 <INFO> (enum 30)1
2020-08-21 05:57:43 <TRACE> p_rip4_to_master4 < filtered out
192.168.20.0/24 unicast
2020-08-21 05:57:43 <TRACE> p_static4_to_master4 < rejected by protocol
192.168.20.0/24 unicast
2020-08-21 05:57:43 <TRACE> p_static6_to_master6 < added fc20::/64 unicast
2020-08-21 05:57:43 <TRACE> p_static6_to_master6 > added [best]
fc20::/64 unicast
2020-08-21 05:57:43 <TRACE> p_master6_to_kernel6 < added fc20::/64 unicast
2020-08-21 05:57:43 <TRACE> p_master6_to_kernel6 > added [best]
fc20::/64 unicast
2020-08-21 05:57:43 <TRACE> p_master6_to_kernel6 < rejected by protocol
fc20::/64 unicast
2020-08-21 05:57:43 <TRACE> kernel6 < added fc20::/64 unicast
2020-08-21 05:57:43 <TRACE> p_static6_to_master6 < rejected by protocol
fc20::/64 unicast
2020-08-21 05:57:43 <INFO> rip to master
2020-08-21 05:57:43 <INFO> (enum 30)1
2020-08-21 05:57:43 <TRACE> p_rip6_to_master6 < filtered out fc20::/64
unicast
2020-08-21 05:57:43 <TRACE> p_static6_to_master6 < rejected by protocol
fc20::/64 unicast
2020-08-21 05:57:43 <TRACE> rip4 < interface lo goes up
2020-08-21 05:57:43 <TRACE> rip4 < interface eth0 goes up
2020-08-21 05:57:43 <TRACE> rip4: Adding interface eth0
2020-08-21 05:57:43 <TRACE> rip4 < interface eth1 goes up
2020-08-21 05:57:43 <TRACE> rip6 < interface lo goes up
2020-08-21 05:57:43 <TRACE> rip6 < interface eth0 goes up
2020-08-21 05:57:43 <TRACE> rip6: Adding interface eth0
2020-08-21 05:57:43 <TRACE> rip6 < interface eth1 goes up
2020-08-21 05:57:43 <INFO> rip to master
2020-08-21 05:57:43 <INFO> (enum 30)1
2020-08-21 05:57:43 <TRACE> p_rip4_to_master4 < filtered out
192.168.20.0/24 unicast
2020-08-21 05:57:43 <INFO> rip to master
2020-08-21 05:57:43 <INFO> (enum 30)1
2020-08-21 05:57:43 <TRACE> p_rip6_to_master6 < filtered out fc20::/64
unicast
2020-08-21 05:57:43 <TRACE> kernel4: Scanning routing table
2020-08-21 05:57:43 <TRACE> kernel4: Pruning table t_kernel4
2020-08-21 05:57:43 <TRACE> kernel4: Pruning inherited routes
2020-08-21 05:57:43 <TRACE> kernel6: Pruning table t_kernel6
2020-08-21 05:57:43 <TRACE> kernel6: Pruning inherited routes
2020-08-21 05:57:43 <TRACE> rip6: Starting interface eth0
2020-08-21 05:57:43 <TRACE> rip4: Starting interface eth0
2020-08-21 05:57:43 <TRACE> rip4: Interface timer fired for eth0
2020-08-21 05:57:43 <TRACE> rip4: Sending triggered updates for eth0
2020-08-21 05:57:43 <TRACE> rip6: Interface timer fired for eth0
2020-08-21 05:57:43 <TRACE> rip6: Sending triggered updates for eth0
2020-08-21 05:57:45 <TRACE> rip4: Interface timer fired for eth0
2020-08-21 05:57:45 <TRACE> rip4: Sending regular updates for eth0
2020-08-21 05:57:46 <TRACE> rip6: Interface timer fired for eth0
2020-08-21 05:57:46 <TRACE> rip6: Sending regular updates for eth0
2020-08-21 05:57:50 <TRACE> rip4: Interface timer fired for eth0
2020-08-21 05:57:50 <TRACE> rip4: Sending regular updates for eth0


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20200821/12fd1ee6/attachment.htm>
-------------- next part --------------
#
# Main
#

# Set time format for compatibility with 3rd-party programs
timeformat base iso long;
timeformat log iso long;
timeformat protocol iso long;
timeformat route iso long;

#
# Logging
#

log "/tmp/pytest-of-root/pytest-104/config0/bird.log.r1" all;
debug protocols { states, routes, filters, interfaces, events };

#
# Router ID
#

router id 0.0.0.1;

#
# Global Constants
#

# Default routes
define DEFAULT_ROUTE_V4 = 0.0.0.0/0; # IPv4 default route
define DEFAULT_ROUTE_V6 = ::/0; # IPv6 default route


#
# Device Protocol
#

protocol device {
        description "Device protocol";

        scan time 10;
};

#
# Kernel Protocol
#

ipv4 table t_kernel4;
ipv6 table t_kernel6;

protocol kernel kernel4 {
        description "Kernel protocol for IPv4";

        metric 600; # Set the BIRD metric to be used when creating kernel routes to fall in line with our OS
        learn; # Learn routes from the kernel
        persist; # Dont remove routes on BIRD shutdown
        merge paths on; # Merge similar BGP paths into a multi-hop

        ipv4 {
                table t_kernel4;

                export all;
                import all;
        };
};

protocol kernel kernel6 {
        description "Kernel protocol for IPv6";

        metric 600; # Set the BIRD metric to be used when creating kernel routes to fall in line with our OS
        learn; # Learn routes from the kernel
        persist; # Dont remove routes on BIRD shutdown
        merge paths on; # Merge similar BGP paths into a multi-hop

        ipv6 {
                table t_kernel6;

                export all;
                import all;
        };
};

#
# Master Tables
#

filter f_master_kernel4_export {
        # Export static routes to kernel
        if (source = RTS_STATIC) then {
                accept;
        }
        # Export static device routes to kernel
        if (source = RTS_STATIC_DEVICE) then {
                accept;
        }
        # Export RIP routes to kernel
        if (source = RTS_RIP) then {
                accept;
        }
        # Export OSPF routes to kernel
        if (source ~ [RTS_OSPF, RTS_OSPF_IA, RTS_OSPF_EXT1, RTS_OSPF_EXT2]) then {
                accept;
        }
        # Export BGP routes to kernel
        if (source = RTS_BGP) then {
                accept;
        }
        reject;
};

filter f_master_kernel6_export {
        # Export static routes to kernel
        if (source = RTS_STATIC) then {
                accept;
        }
        # Export static device routes to kernel
        if (source = RTS_STATIC_DEVICE) then {
                accept;
        }
        # Export RIP routes to kernel
        if (source = RTS_RIP) then {
                accept;
        }
        # Export OSPF routes to kernel
        if (source ~ [RTS_OSPF, RTS_OSPF_IA, RTS_OSPF_EXT1, RTS_OSPF_EXT2]) then {
                accept;
        }
        # Export BGP routes to kernel
        if (source = RTS_BGP) then {
                accept;
        }
        reject;
};

filter f_master_kernel4_import {
        # Accept all routes from the kernel, always
        if (source = RTS_INHERIT) then {
                accept;
        }
        reject;
};

filter f_master_kernel6_import {
        # Accept all routes from the kernel, always
        if (source = RTS_INHERIT) then {
                accept;
        }
        reject;
};

protocol pipe p_master4_to_kernel4 {
        description "Pipe from master4 to t_kernel4";

        table master4;
        peer table t_kernel4;

        export filter f_master_kernel4_export;
        import filter f_master_kernel4_import;
};

protocol pipe p_master6_to_kernel6 {
        description "Pipe from master6 to t_kernel6";

        table master6;
        peer table t_kernel6;

        export filter f_master_kernel6_export;
        import filter f_master_kernel6_import;
};


#
# Static Protocol
#

ipv4 table t_static4;
ipv6 table t_static6;

protocol static static4 {
        description "Static protocol for IPv4";

debug all;

        ipv4 {
                table t_static4;
                export none;
                import all;
        };

        route 192.168.20.0/24 via "eth1";
};

protocol static static6 {
        description "Static protocol for IPv6";

        ipv6 {
                table t_static6;
                export none;
                import all;
        };

        route fc20::/64 via "eth1";
};

protocol pipe p_static4_to_master4 {
        description "Pipe from t_static4 to master4";

        table t_static4;
        peer table master4;

        export all;
        import none;
};

protocol pipe p_static6_to_master6 {
        description "Pipe from t_static6 to master6";

        table t_static6;
        peer table master6;

        export all;
        import none;
};

#
# RIP Protocol
#

# RIP Tables
ipv4 table t_rip4;
ipv6 table t_rip6;

filter f_rip_export4 {
        # Redistribute static device routes
        if (source = RTS_STATIC_DEVICE) then {
                accept;
        }
        # Redistribute RIP routes
        if (source = RTS_RIP) then {
                accept;
        }
        reject;
};

filter f_rip_export6 {
        # Redistribute static device routes
        if (source = RTS_STATIC_DEVICE) then {
                accept;
        }
        # Redistribute RIP routes
        if (source = RTS_RIP) then {
                accept;
        }
        reject;
};

filter f_rip_import4 {
        # Import all RIP routes by default
        accept;
};

filter f_rip_import6 {
        # Import all RIP routes by default
        accept;
};

filter f_rip_master4_export {
        # Do not export default route to master
        if (net = 0.0.0.0/0) then {
                reject;
        }
        # Only export RIP routes o the master table
        if (source = RTS_RIP) then {
                accept;
        }
        # Reject everything else;
        reject;
};

filter f_rip_master6_export {
        # Do not export default route to master
        if (net = ::/0) then {
                reject;
        }
        # Only export RIP routes o the master table
        if (source = RTS_RIP) then {
                accept;
        }
        # Reject everything else;
        reject;
};

filter f_rip_master4_import {
        print "rip to master";
        print source;
        # Import static device routes into RIP (redistribute static_device)
        if (source = RTS_STATIC_DEVICE) then {
                accept;
        }
        reject;
};

filter f_rip_master6_import {
        print "rip to master";
        print source;
        # Import static device routes into RIP (redistribute static_device)
        if (source = RTS_STATIC_DEVICE) then {
                accept;
        }
        reject;
};

protocol rip rip4 {
        description "RIP protocol for IPv4";

        ipv4 {
                table t_rip4;

                export filter f_rip_export4;
                import filter f_rip_import4;

        };

        interface "eth0" {
                update time 5;
                metric 2;
        };
};
protocol rip ng rip6 {
        description "RIP protocol for IPv6";

        ipv6 {
                table t_rip6;

                export filter f_rip_export6;
                import filter f_rip_import6;

        };

        interface "eth0" {
                update time 5;
                metric 2;
        };
};
protocol pipe p_rip4_to_master4 {
        description "Pipe from t_rip4 to master4";

        table t_rip4;
        peer table master4;

        export filter f_rip_master4_export;
        import filter f_rip_master4_import;
};

protocol pipe p_rip6_to_master6 {
        description "Pipe from t_rip6 to master6";

        table t_rip6;
        peer table master6;

        export filter f_rip_master6_export;
        import filter f_rip_master6_import;
}; 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diagram.svg
Type: image/svg+xml
Size: 34776 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20200821/12fd1ee6/attachment.svg>


More information about the Bird-users mailing list