Commits

Anonymous committed e9617d1

various patches implemented

Comments (0)

Files changed (12)

 
 You can reach us at ris@ripe.net.
 
-2006-06-21 Erik Romijn <eromijn@ripe.net>
+2008-02-01 Erik Romijn <eromijn@ripe.net>
+	* Fixed a few memleaks based on a patch from
+	  Antony Antony <antony@phenome.org>
+	  (Ticket NCC#2007064868)
+	* Fixed compiling with --disable-ipv6 based on a patch
+	  from Haniff Rahbari <hnrahbari@yahoo.com>
+	  (Ticket NCC#2007111325)
+	* Fixed a few warnings, mostly based on a patch from
+	  Bruno Quoitin <bruno.quoitin@uclouvain.be>
+	  (Ticket NCC#2007123069)
+	* Made bgpdump's usage message nicer
+
+2007-06-21 Erik Romijn <eromijn@ripe.net>
     * Fixed incorrect dump time display for some cases
 
-2006-06-06 Erik Romijn <eromijn@ripe.net>
+2007-06-06 Erik Romijn <eromijn@ripe.net>
     * Set proper compile options to work on Mac OS X 10.4
 
-2006-06-21 Erik Romijn <eromijn@ripe.net>
-    * Fixed incorrect dump time display for some cases
-
 2007-06-01 Erik Romijn <eromijn@ripe.net>
     * Fixed several bugs in 64-bit PC support and added
 	  bzip2 support, credit goes to
-libbgpdump-1.4.99.7
+libbgpdump-1.4.99.8
     extern char *optarg;
     char c;
     extern int optind;
-    char *usage = "Usage: bgpdump [-m] [-M] [-i] [-t dump|change ] input_binary_file(s) \n";
+    char *usage = "Usage: bgpdump [-m] [-M] [-t dump|change ] input_binary_file(s)\n\
+	-m and -M produce two different kinds of binary formats,\n\
+	-t defines whether timestamps in machine-readable format should be the timestamp of\n\
+		when the dump was made, or when the dumped route was last change (only effective for RIB dumps)\n";
 
     while ((c=getopt(argc,argv,"if:o:t:mM"))!=-1)
 	switch(c)
 #ifdef BGPDUMP_HAVE_IPV6
 		} else if(e->entries[i].peer->afi == AFI_IP6){
 		    inet_ntop(AF_INET6, &e->entries[i].peer->peer_ip, peer, BGPDUMP_ADDRSTRLEN);
+#endif
 		}
-#endif
 			
 		if(e->afi == AFI_IP) {
 			inet_ntop(AF_INET, &e->prefix.v4_addr, prefix, BGPDUMP_ADDRSTRLEN);
 #ifndef _BGPDUMP_H
 #define _BGPDUMP_H
 
-#include <bgpdump-config.h>
+#include "bgpdump-config.h"
 
 #include <sys/types.h>
 #include <netinet/in.h>
 }
 
 void bgpdump_close_dump(BGPDUMP *dump) {
-    if(dump!=NULL) 
+    if(dump!=NULL) {
+	
+    	if(table_dump_v2_peer_index_table){
+		if(table_dump_v2_peer_index_table->entries) 
+			free(table_dump_v2_peer_index_table->entries);
+		free(table_dump_v2_peer_index_table);
+	}
 	cfr_close(dump->f);
+        free(dump);
+    }
 }
 
 BGPDUMP_ENTRY*	bgpdump_read_next(BGPDUMP *dump) {
     u_int16_t afi;
     u_int8_t safi;
 
-    for(afi = 1; afi < BGPDUMP_MAX_AFI; afi++) {
+    for(afi = 1; afi <= BGPDUMP_MAX_AFI; afi++) {
 	for(safi = 1; safi < BGPDUMP_MAX_SAFI; safi++) {
 	    if(info->announce[afi][safi])
+		if(info->announce[afi][safi]->nlri)
+			free(info->announce[afi][safi]->nlri);
 		free(info->announce[afi][safi]);
 	    if(info->withdraw[afi][safi])
 		free(info->withdraw[afi][safi]);
 
 	for(i=0; i < t->peer_count; i++) {
     	mstream_getc(s,&peertype);
+#ifdef BGPDUMP_HAVE_IPV6
 		if(peertype & BGPDUMP_PEERTYPE_TABLE_DUMP_V2_AFI_IP6)
 			t->entries[i].afi = AFI_IP6;
 		else
+#endif
 			t->entries[i].afi = AFI_IP;
 
     	mstream_get_ipv4(s,(uint32_t *)&t->entries[i].peer_bgp_id);
 
 		if(t->entries[i].afi == AFI_IP)
 			mstream_get_ipv4(s,&t->entries[i].peer_ip.v4_addr.s_addr);
+#ifdef BGPDUMP_HAVE_IPV6
 		else
 			mstream_get(s, &t->entries[i].peer_ip.v6_addr.s6_addr, 16);
+#endif
 
 
 		if(peertype & BGPDUMP_PEERTYPE_TABLE_DUMP_V2_AS4)
 
 
 int process_mrtd_table_dump_v2_ipv6_unicast(struct mstream *s, BGPDUMP_ENTRY *entry){
+#ifdef BGPDUMP_HAVE_IPV6
 	BGPDUMP_TABLE_DUMP_V2_PREFIX *prefixdata;
 	prefixdata = &entry->body.mrtd_table_dump_v2_prefix;
 	uint16_t i;
 		entry->attr = NULL;
 	}
 
+#endif
 	return 1;
 }
 /*
 	u_int8_t safi;
 	struct mp_nlri *mp_nlri;
 
-	afi = AFI_IP6;
+	afi = AFI_IP;
 	safi = SAFI_UNICAST;
 
 	/* If there are 2 NLRI's for the same protocol, fail but don't burn and die */

bview.20061101.0000.gz

Binary file added.

bview.20070330.2359.gz

Binary file added.

bview.20070401.0759.bz2

Binary file added.

bview.20070430.2359.gz

Binary file added.
   case 1:  // uncompressed
     { 
       retval = fclose((FILE *)(stream->data1));
+      free(stream);
       stream->error1 = retval;
       return(retval);
     }
       if (bzerror != BZ_OK) {
         stream->error2 = bzerror;
         stream->error1 = fclose((FILE *)(stream->data1));
+        free(stream);
         return(-1);
       }
       retval = fclose((FILE *)(stream->data1));
+      free(stream);
       stream->error1 = retval;
       return(retval);
     }
     { 
 	if(stream->data2!=NULL) {
 		retval=gzclose(stream->data2);
+		free(stream);
 	}
       stream->error2 = retval;
       return(retval);
   // so I dropped it.
   // Returns -1 in case of an error.
   
-  ssize_t retval;
-
   if (stream == NULL) return(-1);  
 
   switch (stream->format) {
   case 1:  // uncompressed
     { 
-      retval = fgets(lineptr, n, (FILE *)(stream->data1));
-      if (retval == -1) {
+      if (fgets(*lineptr, *n, (FILE *)(stream->data1)) == NULL) {
         stream->error1 = errno;
+	return -1;
       }
-      return(retval);
+      return 0;
     }
     break;
 
 
 # Check for inet_ntoa in -lnsl if not found (Solaris)
 AC_CHECK_FUNCS(inet_ntoa, [], AC_CHECK_LIB(nsl, inet_ntoa, [], AC_MSG_ERROR([inet_ntoa not found],1)))
+AC_CHECK_FUNCS(inet_ntop, [], AC_CHECK_LIB(nsl, inet_ntop, [], AC_MSG_ERROR([inet_ntop not found],1)))
 
 AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [disable support for IPv6]))
 

updates.20071015.1505.gz

Binary file added.