if ((asp1->flags.lpref - asp2->flags.lpref) != 0) return (asp1->flags.lpref - asp2->flags.lpref);
if ((asp1->lpref - asp2->lpref) != 0) return (asp1->lpref - asp2->lpref);
prefix_cmp(struct prefix *p1, struct prefix *p2){	struct rde_aspath	*asp1, *asp2;	if (p1 == NULL)		return (-1);	/* p2 is allowed to be NULL */	if (p2 == NULL)		return (1);	asp1 = p1->aspath;	asp2 = p2->aspath;	/* 1. check if prefix is eligible a.k.a reachable */	if (asp2->nexthop->state != NEXTHOP_REACH)		return (1);	if (asp1->nexthop->state != NEXTHOP_REACH)		return (-1);	/* 2. preference of prefix, bigger is better */	if ((asp1->flags.lpref - asp2->flags.lpref) != 0)		return (asp1->flags.lpref - asp2->flags.lpref);	/* 3. aspath count, the shorter the better */	if ((asp2->flags.aspath->ascnt -	    asp1->flags.aspath->ascnt) != 0)		return (asp2->flags.aspath->ascnt -		    asp1->flags.aspath->ascnt);	/* 4. origin, the lower the better */	if ((asp2->flags.origin - asp1->flags.origin) != 0)		return (asp2->flags.origin - asp1->flags.origin);	/* 5. MED decision, only comparable between the same neighboring AS */	if (aspath_neighbor(asp1->flags.aspath) ==	    aspath_neighbor(asp2->flags.aspath))		/* lowest value wins */		if ((asp2->flags.med - asp1->flags.med) != 0)			return (asp2->flags.med - asp1->flags.med);	/*	 * 6. EBGP is cooler than IBGP	 * It is absolutely important that the ebgp value in peer_config.ebgp	 * is bigger than all other ones (IBGP, confederations)	 */	if ((asp1->peer->conf.ebgp - asp2->peer->conf.ebgp) != 0) {		if (asp1->peer->conf.ebgp == 1) /* p1 is EBGP other is lower */			return 1;		else if (asp2->peer->conf.ebgp == 1) /* p2 is EBGP */			return -1;	}	/* 7. nexthop costs. NOT YET -> IGNORE */	/* 8. older route (more stable) wins */	if ((p2->lastchange - p1->lastchange) != 0)		return (p2->lastchange - p1->lastchange);	/* 9. lowest BGP Id wins */	if ((p2->peer->remote_bgpid - p1->peer->remote_bgpid) != 0)		return (p2->peer->remote_bgpid - p1->peer->remote_bgpid);	/* 10. lowest peer address wins (IPv4 is better than IPv6) */	if (memcmp(&p1->peer->remote_addr, &p2->peer->remote_addr,	    sizeof(p1->peer->remote_addr)) != 0)		return (-memcmp(&p1->peer->remote_addr, &p2->peer->remote_addr,		    sizeof(p1->peer->remote_addr)));	fatalx("Uh, oh a politician in the decision process");	/* NOTREACHED */	return 0;}