I seem to have BGP working now, at least to some degree.

I fixed one exception that was thrown when route destination
is 0.0.0.0 (pushed the fix to xorp.ct), and it's included
below.

The rest of my problems were self-inflicted mis-configuration of
the peers and export policies.

I'm attaching two working configurations in hopes they prove
useful to someone.  There may still be issues with these,
but it works enough for BGP to exchange routes and let clients
attached to the two routers send traffic through them.

Here's the fix for 0.0.0.0 destination.  It should also
just catch the exception and ignore the route instead
of crash..but that's a fix for another day.

[gree...@ben-dt2 libxorp]$ git diff
diff --git a/bgp/path_attribute.cc b/bgp/path_attribute.cc
index f1326b2..b82475c 100644
--- a/bgp/path_attribute.cc
+++ b/bgp/path_attribute.cc
@@ -318,7 +318,7 @@ NextHopAttribute<A>::NextHopAttribute(const uint8_t* d)

     _next_hop = A(payload(d));

-    if (!_next_hop.is_unicast())
+    if (!(_next_hop.is_unicast() || _next_hop.is_zero()))
        xorp_throw(CorruptMessage,
                   c_format("NextHop %s is not a unicast address",
                            _next_hop.str().c_str()),


Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com

/* Autogenerated by LANforge, do not edit by hand! */
/* For Virtual-Router: Router-0 */

interfaces {
    interface my_discard {
        unreachable: true
        vif my_discard {
        }
    }

    interface "rddVR6" {
        vif "rddVR6" {
            address 2.2.2.1 {
                prefix-length: 24
            }
        }
    }

    interface "rddVR8" {
        vif "rddVR8" {
            address 5.1.1.1 {
                prefix-length: 24
            }
        }
    }

    interface "rddVR3" {
        vif "rddVR3" {
            address 8.1.2.1 {
                prefix-length: 24
            }
        }
    }

}

fea {
    unicast-forwarding4 {
        disable: false
        table-id: 10001
    }
}


policy {
    policy-statement connected-to-m0 {
        term export {
            from {
                protocol: "connected"
            }
            then {
                metric: 0
            }
        }
    }

    policy-statement connected-to-m1 {
        term export {
            from {
                protocol: "connected"
            }
            then {
                metric: 1
            }
        }
    }

    policy-statement static-to-m1 {
        term export {
            from {
                protocol: "static"
            }
            then {
                metric: 1
            }
        }
    }

    policy-statement accept-static {
        term export {
            from {
                protocol: "static"
            }
            then {
                accept {}
            }
        }
    }

    policy-statement accept-connected {
        term export {
            from {
                protocol: "connected"
            }
            then {
                accept {}
            }
        }
    }

    policy-statement accept-ospf4 {
        term export {
            from {
                protocol: "ospf4"
            }
            then {
                accept {}
            }
        }
    }
}  /* end of policies */

protocols {
    static {
        interface-route 0.0.0.0/0 {
            next-hop-interface: "my_discard"
            next-hop-vif: "my_discard"
        }
    }

    ospf4 {
        router-id: 127.1.0.1
        area 0.0.0.0 {
            interface "rddVR6" {
                vif "rddVR6" {
                    address 2.2.2.1 {
                       interface-cost: 1
                    }
                }
            }

            interface "rddVR3" {
                vif "rddVR3" {
                    address 8.1.2.1 {
                       interface-cost: 1
                    }
                }
            }

        } /* area */

        /* traceoptions {
            flag all {
                disable: false
            }
        } */ 
    }
    bgp {
        /* Redistribute connected, static and perhaps other routes */
        export: "accept-connected,accept-static,accept-ospf4"
        bgp-id: 0.0.0.1
        local-as: 1
        peer 5.1.1.2 {
            local-ip: 5.1.1.1
            /* local-dev: "rddVR8" */
            as: 2
            next-hop: 5.1.1.1
            holdtime: 5
            delay-open-time: 5
            client: false
            confederation-member: false
            ipv4-unicast: true
            ipv6-unicast: false
            ipv6-multicast: false
            ipv6-multicast: false
            disable: false
        }
    } /* end of bgp4 proto */

}

 /* End of Config File */
/* Autogenerated by LANforge, do not edit by hand! */
/* For Virtual-Router: Router-1 */

interfaces {
    interface my_discard {
        unreachable: true
        vif my_discard {
        }
    }

    interface "rddVR0" {
        vif "rddVR0" {
            address 1.1.1.2 {
                prefix-length: 24
            }
        }
    }

    interface "rddVR13" {
        vif "rddVR13" {
            address 4.1.1.2 {
                prefix-length: 24
            }
        }
    }

    interface "rddVR9" {
        vif "rddVR9" {
            address 5.1.1.2 {
                prefix-length: 24
            }
        }
    }

}

fea {
    unicast-forwarding4 {
        disable: false
        table-id: 10002
    }
}


policy {
    policy-statement connected-to-m0 {
        term export {
            from {
                protocol: "connected"
            }
            then {
                metric: 0
            }
        }
    }

    policy-statement connected-to-m1 {
        term export {
            from {
                protocol: "connected"
            }
            then {
                metric: 1
            }
        }
    }

    policy-statement static-to-m1 {
        term export {
            from {
                protocol: "static"
            }
            then {
                metric: 1
            }
        }
    }

    policy-statement accept-static {
        term export {
            from {
                protocol: "static"
            }
            then {
                accept {}
            }
        }
    }

    policy-statement accept-connected {
        term export {
            from {
                protocol: "connected"
            }
            then {
                accept {}
            }
        }
    }

    policy-statement accept-ospf4 {
        term export {
            from {
                protocol: "ospf4"
            }
            then {
                accept {}
            }
        }
    }
}  /* end of policies */

protocols {
    static {
        interface-route 0.0.0.0/0 {
            next-hop-interface: "my_discard"
            next-hop-vif: "my_discard"
        }
    }

    ospf4 {
        router-id: 127.1.0.2
        area 0.0.0.0 {
            interface "rddVR0" {
                vif "rddVR0" {
                    address 1.1.1.2 {
                       interface-cost: 1
                    }
                }
            }

            interface "rddVR13" {
                vif "rddVR13" {
                    address 4.1.1.2 {
                       interface-cost: 1
                    }
                }
            }

        } /* area */

        /* traceoptions {
            flag all {
                disable: false
            }
        } */ 
    }
    bgp {
        /* Redistribute connected, static and perhaps other routes */
        export: "accept-connected,accept-static,accept-ospf4"
        bgp-id: 0.0.0.2
        local-as: 2
        peer 5.1.1.1 {
            local-ip: 5.1.1.2
            /* local-dev: "rddVR9" */
            as: 1
            next-hop: 5.1.1.2
            holdtime: 5
            delay-open-time: 5
            client: false
            confederation-member: false
            ipv4-unicast: true
            ipv6-unicast: false
            ipv6-multicast: false
            ipv6-multicast: false
            disable: false
        }
    } /* end of bgp4 proto */

}

 /* End of Config File */
_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers

Reply via email to