On Wed, Apr 05, 2006 at 08:45:22AM +0100, tony sarendal wrote:
> I installed a route-collector in my test network to get a better view on
> things.
> Originator is backwards.
> 
> /Tony
> 
> quagga-bgpd# sh ip bgp 192.168.10.0
> BGP routing table entry for 192.168.10.0/24
> Paths: (11 available, best #2, table Default-IP-Routing-Table)
>   Not advertised to any peer
>   Local
>     172.16.1.5 from 10.0.0.2 (1.0.16.172)
>       Origin IGP, metric 100, localpref 100, valid, internal
>       Originator: 1.0.16.172, Cluster list: 10.0.0.2
>       Last update: Wed Apr  5 02:50:50 2006
> 

Oups, yes that looks like a missing htonl()
Could you give the following diff a whirl?

-- 
:wq Claudio

Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.202
diff -u -p -r1.202 rde.c
--- rde.c       22 Mar 2006 10:18:49 -0000      1.202
+++ rde.c       5 Apr 2006 11:33:05 -0000
@@ -1432,17 +1432,22 @@ rde_reflector(struct rde_peer *peer, str
 {
        struct attr     *a;
        u_int16_t        len;
+       u_int32_t        id;
 
        /* check for originator id if eq router_id drop */
        if ((a = attr_optget(asp, ATTR_ORIGINATOR_ID)) != NULL) {
                if (memcmp(&conf->bgpid, a->data, sizeof(conf->bgpid)) == 0)
                        /* this is coming from myself */
                        return (0);
-       } else if ((conf->flags & BGPD_FLAG_REFLECTOR) &&
-           attr_optadd(asp, ATTR_OPTIONAL, ATTR_ORIGINATOR_ID,
-           peer->conf.ebgp == 0 ? &peer->remote_bgpid : &conf->bgpid,
-           sizeof(u_int32_t)) == -1)
-               fatalx("attr_optadd failed but impossible");
+       } else if (conf->flags & BGPD_FLAG_REFLECTOR) {
+               if (peer->conf.ebgp == 0)
+                       id = htonl(peer->remote_bgpid);
+               else
+                       id = conf->bgpid;
+               if (attr_optadd(asp, ATTR_OPTIONAL, ATTR_ORIGINATOR_ID,
+                   &id, sizeof(u_int32_t)) == -1)
+                       fatalx("attr_optadd failed but impossible");
+       }
 
        /* check for own id in the cluster list */
        if (conf->flags & BGPD_FLAG_REFLECTOR) {
@@ -2281,14 +2286,14 @@ network_init(struct network_head *net_l)
        reloadtime = time(NULL);
        bzero(&peerself, sizeof(peerself));
        peerself.state = PEER_UP;
-       peerself.remote_bgpid = conf->bgpid;
+       peerself.remote_bgpid = ntohl(conf->bgpid);
        id.s_addr = conf->bgpid;
        peerself.conf.remote_as = conf->as;
        snprintf(peerself.conf.descr, sizeof(peerself.conf.descr),
            "LOCAL: ID %s", inet_ntoa(id));
        bzero(&peerdynamic, sizeof(peerdynamic));
        peerdynamic.state = PEER_UP;
-       peerdynamic.remote_bgpid = conf->bgpid;
+       peerdynamic.remote_bgpid = ntohl(conf->bgpid);
        peerdynamic.conf.remote_as = conf->as;
        snprintf(peerdynamic.conf.descr, sizeof(peerdynamic.conf.descr),
            "LOCAL: ID %s", inet_ntoa(id));
Index: rde.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v
retrieving revision 1.91
diff -u -p -r1.91 rde.h
--- rde.h       4 Apr 2006 12:03:26 -0000       1.91
+++ rde.h       5 Apr 2006 11:32:08 -0000
@@ -63,7 +63,7 @@ struct rde_peer {
        struct capabilities              capa_received;
        u_int32_t                        prefix_cnt; /* # of prefixes */
        u_int32_t                        adjrib_cnt; /* # of p. in Adj-RIB-In */
-       u_int32_t                        remote_bgpid;
+       u_int32_t                        remote_bgpid; /* host byte order! */
        u_int32_t                        up_pcnt;
        u_int32_t                        up_acnt;
        u_int32_t                        up_nlricnt;

Reply via email to