diff options
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/ChangeLog | 4 | ||||
-rw-r--r-- | bgpd/bgp_attr.c | 19 | ||||
-rw-r--r-- | bgpd/bgp_attr.h | 13 | ||||
-rw-r--r-- | bgpd/bgp_community.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_community.h | 2 | ||||
-rw-r--r-- | bgpd/bgp_ecommunity.c | 10 | ||||
-rw-r--r-- | bgpd/bgp_ecommunity.h | 4 | ||||
-rw-r--r-- | bgpd/bgp_mplsvpn.c | 10 | ||||
-rw-r--r-- | bgpd/bgp_mplsvpn.h | 4 | ||||
-rw-r--r-- | bgpd/bgp_open.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_packet.c | 41 | ||||
-rw-r--r-- | bgpd/bgp_packet.h | 5 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 29 | ||||
-rw-r--r-- | bgpd/bgp_routemap.c | 2 |
14 files changed, 84 insertions, 67 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index 9ed186bd..7603dc5d 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -1,3 +1,7 @@ +2004-06-04 Paul Jakma <paul@dishone.st> + + * type mismatch fixes + 2004-05-21 Akihiro Mizutani <mizutani@net-chef.net> * bgpd.h, bgp_open.[ch], bgp_debug.c, bgp_vty.[ch], bgp_fsm.c: diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 7d48374d..d745d871 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -84,13 +84,13 @@ cluster_hash_alloc (struct cluster_list *val) /* Cluster list related functions. */ struct cluster_list * -cluster_parse (caddr_t pnt, int length) +cluster_parse (struct in_addr * pnt, int length) { struct cluster_list tmp; struct cluster_list *cluster; tmp.length = length; - tmp.list = (struct in_addr *) pnt; + tmp.list = pnt; cluster = hash_get (cluster_hash, &tmp, cluster_hash_alloc); cluster->refcnt++; @@ -857,7 +857,8 @@ bgp_attr_community (struct peer *peer, bgp_size_t length, attr->community = NULL; else { - attr->community = community_parse (stream_pnt (peer->ibuf), length); + attr->community = + community_parse ((u_int32_t *)stream_pnt (peer->ibuf), length); stream_forward (peer->ibuf, length); } @@ -904,7 +905,8 @@ bgp_attr_cluster_list (struct peer *peer, bgp_size_t length, return -1; } - attr->cluster = cluster_parse (stream_pnt (peer->ibuf), length); + attr->cluster = cluster_parse ((struct in_addr *)stream_pnt (peer->ibuf), + length); stream_forward (peer->ibuf, length);; @@ -1065,7 +1067,8 @@ bgp_attr_ext_communities (struct peer *peer, bgp_size_t length, attr->ecommunity = NULL; else { - attr->ecommunity = ecommunity_parse (stream_pnt (peer->ibuf), length); + attr->ecommunity = + ecommunity_parse ((u_int8_t *)stream_pnt (peer->ibuf), length); stream_forward (peer->ibuf, length); } attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES); @@ -1339,7 +1342,7 @@ bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *peer, struct stream *s, struct attr *attr, struct prefix *p, afi_t afi, safi_t safi, struct peer *from, - struct prefix_rd *prd, u_char *tag) + struct prefix_rd *prd, char *tag) { unsigned long cp; struct aspath *aspath; @@ -1671,7 +1674,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer, } else { - u_char *pnt; + u_int8_t *pnt; int tbit; int ecom_tr_size = 0; int i; @@ -1727,7 +1730,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer, bgp_size_t bgp_packet_withdraw (struct peer *peer, struct stream *s, struct prefix *p, afi_t afi, safi_t safi, struct prefix_rd *prd, - u_char *tag) + char *tag) { unsigned long cp; unsigned long attrlen_pnt; diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index 2bcbbf37..c9acc710 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -111,9 +111,16 @@ void bgp_attr_unintern (struct attr *); void bgp_attr_flush (struct attr *); struct attr *bgp_attr_default_set (struct attr *attr, u_char); struct attr *bgp_attr_default_intern (u_char); -struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char, struct aspath *, struct community *, int as_set); -bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *, struct stream *, struct attr *, struct prefix *, afi_t, safi_t, struct peer *, struct prefix_rd *, u_char *); -bgp_size_t bgp_packet_withdraw (struct peer *peer, struct stream *s, struct prefix *p, afi_t, safi_t, struct prefix_rd *, u_char *); +struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char, + struct aspath *, + struct community *, int as_set); +bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *, + struct stream *, struct attr *, + struct prefix *, afi_t, safi_t, + struct peer *, struct prefix_rd *, char *); +bgp_size_t bgp_packet_withdraw (struct peer *peer, struct stream *s, + struct prefix *p, afi_t, safi_t, + struct prefix_rd *, char *); void bgp_dump_routes_attr (struct stream *, struct attr *, struct prefix *); unsigned int attrhash_key_make (struct attr *); int attrhash_cmp (struct attr *, struct attr *); diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index 83b1cc5e..54679710 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -338,7 +338,7 @@ community_unintern (struct community *com) /* Create new community attribute. */ struct community * -community_parse (char *pnt, u_short length) +community_parse (u_int32_t *pnt, u_short length) { struct community tmp; struct community *new; @@ -349,7 +349,7 @@ community_parse (char *pnt, u_short length) /* Make temporary community for hash look up. */ tmp.size = length / 4; - tmp.val = (u_int32_t *) pnt; + tmp.val = pnt; new = community_uniq_sort (&tmp); diff --git a/bgpd/bgp_community.h b/bgpd/bgp_community.h index 58b3f9e6..898ca9e8 100644 --- a/bgpd/bgp_community.h +++ b/bgpd/bgp_community.h @@ -51,7 +51,7 @@ struct community void community_init (); void community_free (struct community *); struct community *community_uniq_sort (struct community *); -struct community *community_parse (char *, u_short); +struct community *community_parse (u_int32_t *, u_short); struct community *community_intern (struct community *); void community_unintern (struct community *); char *community_str (struct community *); diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 4adbcf52..b3fc1c3a 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -58,7 +58,7 @@ ecommunity_free (struct ecommunity *ecom) static int ecommunity_add_val (struct ecommunity *ecom, struct ecommunity_val *eval) { - u_char *p; + u_int8_t *p; int ret; int c; @@ -119,7 +119,7 @@ ecommunity_uniq_sort (struct ecommunity *ecom) /* Parse Extended Communites Attribute in BGP packet. */ struct ecommunity * -ecommunity_parse (char *pnt, u_short length) +ecommunity_parse (u_int8_t *pnt, u_short length) { struct ecommunity tmp; struct ecommunity *new; @@ -232,7 +232,7 @@ ecommunity_hash_make (struct ecommunity *ecom) { int c; unsigned int key; - unsigned char *pnt; + u_int8_t *pnt; key = 0; pnt = ecom->val; @@ -530,13 +530,13 @@ char * ecommunity_ecom2str (struct ecommunity *ecom, int format) { int i; - u_char *pnt; + u_int8_t *pnt; int encode = 0; int type = 0; #define ECOMMUNITY_STR_DEFAULT_LEN 26 int str_size; int str_pnt; - u_char *str_buf; + char *str_buf; char *prefix; int len = 0; int first = 1; diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h index e266471f..e7be7865 100644 --- a/bgpd/bgp_ecommunity.h +++ b/bgpd/bgp_ecommunity.h @@ -47,7 +47,7 @@ struct ecommunity int size; /* Extended Communities value. */ - u_char *val; + u_int8_t *val; /* Human readable format string. */ char *str; @@ -64,7 +64,7 @@ struct ecommunity_val void ecommunity_init (void); void ecommunity_free (struct ecommunity *); struct ecommunity *ecommunity_new (void); -struct ecommunity *ecommunity_parse (char *, u_short); +struct ecommunity *ecommunity_parse (u_int8_t *, u_short); struct ecommunity *ecommunity_dup (struct ecommunity *); struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *); struct ecommunity *ecommunity_intern (struct ecommunity *); diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index e820cabf..90219cfe 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -180,13 +180,13 @@ bgp_nlri_parse_vpnv4 (struct peer *peer, struct attr *attr, } int -str2prefix_rd (u_char *str, struct prefix_rd *prd) +str2prefix_rd (char *str, struct prefix_rd *prd) { int ret; - u_char *p; - u_char *p2; + char *p; + char *p2; struct stream *s; - u_char *half; + char *half; struct in_addr addr; s = stream_new (8); @@ -236,7 +236,7 @@ str2prefix_rd (u_char *str, struct prefix_rd *prd) } int -str2tag (u_char *str, u_char *tag) +str2tag (char *str, u_char *tag) { u_int32_t l; diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index cd861a87..a5f3eb37 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -40,6 +40,6 @@ struct rd_ip void bgp_mplsvpn_init (); int bgp_nlri_parse_vpnv4 (struct peer *, struct attr *, struct bgp_nlri *); u_int32_t decode_label (u_char *); -int str2prefix_rd (u_char *, struct prefix_rd *); -int str2tag (u_char *, u_char *); +int str2prefix_rd (char *, struct prefix_rd *); +int str2tag (char *, u_char *); char *prefix_rd2str (struct prefix_rd *, char *, size_t); diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index ae4a7d40..eecea608 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -48,8 +48,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA void bgp_capability_vty_out (struct vty *vty, struct peer *peer) { - u_char *pnt; - u_char *end; + char *pnt; + char *end; struct capability cap; pnt = peer->notify.data; diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 341a192c..316c44e2 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -124,7 +124,7 @@ static void bgp_connect_check (struct peer *peer) { int status; - int slen; + socklen_t slen; int ret; /* Anyway I have to reset read and write thread. */ @@ -203,10 +203,10 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) stream_putw (s, 0); pos = stream_get_putp (s); stream_putw (s, 0); - total_attr_len = bgp_packet_attribute (NULL, peer, s, - adv->baa->attr, - &rn->p, afi, safi, - binfo->peer, prd, tag); + total_attr_len = bgp_packet_attribute (NULL, peer, s, + adv->baa->attr, + &rn->p, afi, safi, + binfo->peer, prd, tag); stream_putw_at (s, pos, total_attr_len); } @@ -1137,8 +1137,8 @@ bgp_open_receive (struct peer *peer, bgp_size_t size) struct peer *realpeer; struct in_addr remote_id; int capability; - char notify_data_remote_as[2]; - char notify_data_remote_id[4]; + u_int8_t notify_data_remote_as[2]; + u_int8_t notify_data_remote_id[4]; realpeer = NULL; @@ -1171,22 +1171,22 @@ bgp_open_receive (struct peer *peer, bgp_size_t size) if (as) { if (BGP_DEBUG (normal, NORMAL)) - zlog_info ("%s bad OPEN, wrong router identifier %s", - peer->host, inet_ntoa (remote_id)); - bgp_notify_send_with_data (peer, - BGP_NOTIFY_OPEN_ERR, - BGP_NOTIFY_OPEN_BAD_BGP_IDENT, - notify_data_remote_id, 4); + zlog_info ("%s bad OPEN, wrong router identifier %s", + peer->host, inet_ntoa (remote_id)); + bgp_notify_send_with_data (peer, + BGP_NOTIFY_OPEN_ERR, + BGP_NOTIFY_OPEN_BAD_BGP_IDENT, + notify_data_remote_id, 4); } else { if (BGP_DEBUG (normal, NORMAL)) - zlog_info ("%s bad OPEN, remote AS is %d, expected %d", - peer->host, remote_as, peer->as); - bgp_notify_send_with_data (peer, - BGP_NOTIFY_OPEN_ERR, - BGP_NOTIFY_OPEN_BAD_PEER_AS, - notify_data_remote_as, 2); + zlog_info ("%s bad OPEN, remote AS is %d, expected %d", + peer->host, remote_as, peer->as); + bgp_notify_send_with_data (peer, + BGP_NOTIFY_OPEN_ERR, + BGP_NOTIFY_OPEN_BAD_PEER_AS, + notify_data_remote_as, 2); } return -1; } @@ -1264,13 +1264,14 @@ bgp_open_receive (struct peer *peer, bgp_size_t size) /* Peer BGP version check. */ if (version != BGP_VERSION_4) { + u_int8_t maxver = BGP_VERSION_4; if (BGP_DEBUG (normal, NORMAL)) zlog_info ("%s bad protocol version, remote requested %d, local request %d", peer->host, version, BGP_VERSION_4); bgp_notify_send_with_data (peer, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_UNSUP_VERSION, - "\x04", 1); + &maxver, 1); return -1; } diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h index c1efc8bd..7bbcdb23 100644 --- a/bgpd/bgp_packet.h +++ b/bgpd/bgp_packet.h @@ -40,8 +40,9 @@ int bgp_write (struct thread *); void bgp_keepalive_send (struct peer *); void bgp_open_send (struct peer *); -void bgp_notify_send (struct peer *, u_char, u_char); -void bgp_notify_send_with_data (struct peer *, u_char, u_char, u_char *, size_t); +void bgp_notify_send (struct peer *, u_int8_t, u_int8_t); +void bgp_notify_send_with_data (struct peer *, u_int8_t, u_int8_t, + u_int8_t *, size_t); void bgp_route_refresh_send (struct peer *, afi_t, safi_t, u_char, u_char, int); void bgp_capability_send (struct peer *, afi_t, safi_t, int, int); void bgp_default_update_send (struct peer *, struct attr *, diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index b8af869b..1dd8b571 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -875,7 +875,8 @@ bgp_process (struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi) } int -bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi, safi_t safi, int always) +bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi, + safi_t safi, int always) { if (!CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) return 0; @@ -895,18 +896,18 @@ bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi, safi_t safi, int alwa return 0; { - char ndata[7]; - - ndata[0] = (u_char)(afi >> 8); - ndata[1] = (u_char) afi; - ndata[3] = (u_char)(peer->pmax[afi][safi] >> 24); - ndata[4] = (u_char)(peer->pmax[afi][safi] >> 16); - ndata[5] = (u_char)(peer->pmax[afi][safi] >> 8); - ndata[6] = (u_char)(peer->pmax[afi][safi]); + u_int8_t ndata[7]; if (safi == SAFI_MPLS_VPN) safi = BGP_SAFI_VPNV4; - ndata[2] = (u_char) safi; + + ndata[0] = (afi >> 8); + ndata[1] = afi; + ndata[2] = safi; + ndata[3] = (peer->pmax[afi][safi] >> 24); + ndata[4] = (peer->pmax[afi][safi] >> 16); + ndata[5] = (peer->pmax[afi][safi] >> 8); + ndata[6] = (peer->pmax[afi][safi]); SET_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW); bgp_notify_send_with_data (peer, BGP_NOTIFY_CEASE, @@ -4371,7 +4372,7 @@ bgp_show_callback (struct vty *vty, int unlock) int limit; int display; - rn = vty->output_rn; + rn = (struct bgp_node *) vty->output_rn; count = 0; limit = ((vty->lines == 0) ? 10 : (vty->lines > 0 @@ -4566,7 +4567,7 @@ bgp_show_callback (struct vty *vty, int unlock) if (count >= limit) { vty->status = VTY_CONTINUE; - vty->output_rn = bgp_route_next (rn);; + vty->output_rn = (struct route_node *) bgp_route_next (rn);; vty->output_func = bgp_show_callback; return 0; } @@ -4824,7 +4825,7 @@ bgp_show (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, if (count >= limit && vty->type != VTY_SHELL_SERV) { vty->status = VTY_START; - vty->output_rn = bgp_route_next (rn); + vty->output_rn = (struct route_node *) bgp_route_next (rn); vty->output_func = bgp_show_callback; vty->output_type = type; @@ -7395,7 +7396,7 @@ peer_lookup_in_view (struct vty *vty, char *view_name, char *ip_str) return NULL; } } - else // view_name==NULL + else { bgp = bgp_get_default (); if (! bgp) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index ce9ceb5d..261f6b87 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1950,7 +1950,7 @@ bgp_route_set_delete (struct vty *vty, struct route_map_index *index, /* Hook function for updating route_map assignment. */ void -bgp_route_map_update () +bgp_route_map_update (char *unused) { int i; afi_t afi; |