diff options
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/ChangeLog | 8 | ||||
-rw-r--r-- | bgpd/bgp_network.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_packet.c | 30 | ||||
-rw-r--r-- | bgpd/bgpd.c | 6 |
4 files changed, 18 insertions, 28 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index 02ca213c..25c4e37e 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -2,9 +2,15 @@ * bgp_fsm.c: (bgp_stop) use sockunion_free, not XFREE.. * bgp_network.c: (bgp_getsockname) ditto + (bgp_accept) use XSTRDUP * bgp_routemap.c: (route_match_peer) ditto, als use a ret value and remove one sockunion_free. - * bgpd.c: (peer_delete) ditto + * bgpd.c: (peer_delete) ditto. + XFREE the correct memtype, not free. + (peer_create) use XSTRDUP + * bgp_packet.c: (bgp_stream_dup) deleted, stream_dup should be used + (various) update -> s/bgp_stream_dup/stream_dup + 2005-04-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu> diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index b2708e7b..fb6b64df 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -112,7 +112,7 @@ bgp_accept (struct thread *thread) /* Make peer's address string. */ sockunion2str (&su, buf, SU_ADDRSTRLEN); - peer->host = strdup (buf); + peer->host = XSTRDUP (MTYPE_BGP_PEER_HOST, buf); } BGP_EVENT_ADD (peer, TCP_connection_open); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 9fa23e52..a5fc7499 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -99,22 +99,6 @@ bgp_packet_delete (struct peer *peer) stream_free (stream_fifo_pop (peer->obuf)); } -/* Duplicate packet. */ -struct stream * -bgp_packet_dup (struct stream *s) -{ - struct stream *new; - - new = stream_new (stream_get_endp (s)); - - new->endp = s->endp; - new->getp = s->getp; - - memcpy (new->data, s->data, stream_get_endp (s)); - - return new; -} - /* Check file descriptor whether connect is established. */ static void bgp_connect_check (struct peer *peer) @@ -232,7 +216,7 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) if (! stream_empty (s)) { bgp_packet_set_size (s); - packet = bgp_packet_dup (s); + packet = stream_dup (s); bgp_packet_add (peer, packet); BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd); stream_reset (s); @@ -279,7 +263,7 @@ bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi) } bgp_packet_set_size (s); - packet = bgp_packet_dup (s); + packet = stream_dup (s); bgp_packet_add (peer, packet); stream_free (s); return packet; @@ -359,7 +343,7 @@ bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi) stream_putw (s, 0); } bgp_packet_set_size (s); - packet = bgp_packet_dup (s); + packet = stream_dup (s); bgp_packet_add (peer, packet); stream_reset (s); return packet; @@ -423,7 +407,7 @@ bgp_default_update_send (struct peer *peer, struct attr *attr, /* Set size. */ bgp_packet_set_size (s); - packet = bgp_packet_dup (s); + packet = stream_dup (s); stream_free (s); /* Dump packet if debug option is set. */ @@ -502,7 +486,7 @@ bgp_default_withdraw_send (struct peer *peer, afi_t afi, safi_t safi) bgp_packet_set_size (s); - packet = bgp_packet_dup (s); + packet = stream_dup (s); stream_free (s); /* Add packet to the peer. */ @@ -1056,7 +1040,7 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, } /* Make real packet. */ - packet = bgp_packet_dup (s); + packet = stream_dup (s); stream_free (s); /* Add packet to the peer. */ @@ -1103,7 +1087,7 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi, length = bgp_packet_set_size (s); /* Make real packet. */ - packet = bgp_packet_dup (s); + packet = stream_dup (s); stream_free (s); /* Add packet to the peer. */ diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 87e6b444..881a3c7b 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -773,7 +773,7 @@ peer_create (union sockunion *su, struct bgp *bgp, as_t local_as, /* Make peer's address string. */ sockunion2str (su, buf, SU_ADDRSTRLEN); - peer->host = strdup (buf); + peer->host = XSTRDUP (MTYPE_BGP_PEER_HOST, buf); /* Set up peer's events and timers. */ if (! active && peer_active (peer)) @@ -1136,7 +1136,7 @@ peer_delete (struct peer *peer) /* Free allocated host character. */ if (peer->host) - free (peer->host); + XFREE (MTYPE_BGP_PEER_HOST, peer->host); /* Local and remote addresses. */ if (peer->su_local) @@ -1146,7 +1146,7 @@ peer_delete (struct peer *peer) /* Peer description string. */ if (peer->desc) - XFREE (MTYPE_TMP, peer->desc); + XFREE (MTYPE_PEER_DESC, peer->desc); bgp_sync_delete (peer); |