1 diff -Nur quagga-0.98.6/bgpd/bgp_aspath.c quagga-0.98.6-patched/bgpd/bgp_aspath.c
2 --- quagga-0.98.6/bgpd/bgp_aspath.c 2005-06-15 14:53:50.000000000 +0300
3 +++ quagga-0.98.6-patched/bgpd/bgp_aspath.c 2007-11-24 03:20:02.000000000 +0200
8 +/* AS path confed check. If aspath contains confed set or sequence then return 1. */
10 +aspath_confed_check (struct aspath *aspath)
14 + struct assegment *assegment;
20 + end = aspath->data + aspath->length;
24 + assegment = (struct assegment *) pnt;
25 + if (assegment->type == AS_CONFED_SET || assegment->type == AS_CONFED_SEQUENCE)
27 + pnt += (assegment->length * AS_VALUE_SIZE) + AS_HEADER_SIZE;
32 +/* Leftmost AS path segment confed check. If leftmost AS segment is of type
33 + AS_CONFED_SEQUENCE or AS_CONFED_SET then return 1. */
35 +aspath_left_confed_check (struct aspath *aspath)
37 + struct assegment *assegment;
42 + assegment = (struct assegment *) aspath->data;
43 + if (assegment->type == AS_CONFED_SEQUENCE || assegment->type == AS_CONFED_SET)
49 /* Merge as1 to as2. as2 should be uninterned aspath. */
51 aspath_merge (struct aspath *as1, struct aspath *as2)
56 + /* Delete any AS_CONFED_SEQUENCE segment from as2. */
57 + if (seg1->type == AS_SEQUENCE && seg2->type == AS_CONFED_SEQUENCE)
58 + as2 = aspath_delete_confed_seq (as2);
60 /* Compare last segment type of as1 and first segment type of as2. */
61 if (seg1->type != seg2->type)
62 return aspath_merge (as1, as2);
63 diff -Nur quagga-0.98.6/bgpd/bgp_aspath.h quagga-0.98.6-patched/bgpd/bgp_aspath.h
64 --- quagga-0.98.6/bgpd/bgp_aspath.h 2005-06-15 14:53:50.000000000 +0300
65 +++ quagga-0.98.6-patched/bgpd/bgp_aspath.h 2007-11-24 03:21:24.000000000 +0200
67 int aspath_loop_check (struct aspath *, as_t);
68 int aspath_private_as_check (struct aspath *);
69 int aspath_firstas_check (struct aspath *, as_t);
70 +int aspath_confed_check (struct aspath *);
71 +int aspath_left_confed_check (struct aspath *);
72 unsigned long aspath_count ();
73 diff -Nur quagga-0.98.6/bgpd/bgp_attr.c quagga-0.98.6-patched/bgpd/bgp_attr.c
74 --- quagga-0.98.6/bgpd/bgp_attr.c 2006-05-03 01:37:47.000000000 +0300
75 +++ quagga-0.98.6-patched/bgpd/bgp_attr.c 2007-11-24 03:09:56.000000000 +0200
80 + /* Confederation sanity check. */
81 + if ((peer_sort (peer) == BGP_PEER_CONFED && ! aspath_left_confed_check (attr->aspath)) ||
82 + (peer_sort (peer) == BGP_PEER_EBGP && aspath_confed_check (attr->aspath)))
84 + zlog (peer->log, LOG_ERR, "Malformed AS path from %s", peer->host);
85 + bgp_notify_send (peer,
86 + BGP_NOTIFY_UPDATE_ERR,
87 + BGP_NOTIFY_UPDATE_MAL_AS_PATH);
93 /* First AS check for EBGP. */