Browse Source

Refresh patch queue

Christoph Biedl 7 years ago
parent
commit
af7d841612

+ 0 - 31
debian/patches/add-assertions.patch

@@ -1,31 +0,0 @@
-Description: Add assertion checks where appropriate
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/37/
-Last-Update: 2016-07-23
-
---- a/bgpdump_lib.c
-+++ b/bgpdump_lib.c
-@@ -184,6 +184,7 @@
-     dump->parsed++;
-     this_entry->attr=NULL;
- 
-+    assert(this_entry->length);
-     buffer = malloc_check(this_entry->length);
-     bytes_read = cfr_read_n(dump->f, buffer, this_entry->length);
-     if(bytes_read != this_entry->length) {
-@@ -536,6 +537,7 @@
- 		e = &prefixdata->entries[i];
- 
- 		mstream_getw(s, &e->peer_index);
-+		assert (table_dump_v2_peer_index_table);
- 		e->peer = &table_dump_v2_peer_index_table->entries[e->peer_index];
- 		mstream_getl(s, &e->originated_time);
-             
-@@ -574,6 +576,7 @@
- 		e = &prefixdata->entries[i];
- 
- 		mstream_getw(s, &e->peer_index);
-+		assert (table_dump_v2_peer_index_table);
- 		e->peer = &table_dump_v2_peer_index_table->entries[e->peer_index];
- 		mstream_getl(s, &e->originated_time);
- 

+ 0 - 15
debian/patches/add-prototype.patch

@@ -1,15 +0,0 @@
-Description: Add prototype to avoid a compiler warning
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/27/
-Last-Update: 2016-07-18
-
---- a/bgpdump_lib.c
-+++ b/bgpdump_lib.c
-@@ -42,6 +42,7 @@
- #include <assert.h>
- 
- void	  bgpdump_free_attr(attributes_t *attr);
-+int       process_mrtd_bgp(struct mstream *s, BGPDUMP_ENTRY *entry);
- static    int process_mrtd_table_dump(struct mstream *s,BGPDUMP_ENTRY *entry);
- static    int process_mrtd_table_dump_v2(struct mstream *s,BGPDUMP_ENTRY *entry);
- static    int process_mrtd_table_dump_v2_peer_index_table(struct mstream *s,BGPDUMP_ENTRY *entry);

+ 0 - 276
debian/patches/catch-alloc-failures.patch

@@ -1,276 +0,0 @@
-Description: Catch *alloc failures
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/28/
-Last-Update: 2016-07-13
-
-    Better exit(1) than doing null pointer accesses
-
---- a/bgpdump_lib.c
-+++ b/bgpdump_lib.c
-@@ -94,7 +94,7 @@
-         return NULL;
-     }
-     
--    BGPDUMP *this_dump = malloc(sizeof(BGPDUMP));
-+    BGPDUMP *this_dump = malloc_check(sizeof(BGPDUMP));
-     strcpy(this_dump->filename, "[STDIN]");
-     if(filename && strcmp(filename, "-")) {
-         if (strlen(filename) >= BGPDUMP_MAX_FILE_LEN - 1) {
-@@ -137,7 +137,7 @@
-     int ok=0;
-     u_int32_t bytes_read;
- 
--    this_entry = malloc(sizeof(BGPDUMP_ENTRY));
-+    this_entry = malloc_check(sizeof(BGPDUMP_ENTRY));
- 
-     bytes_read = cfr_read_n(dump->f, &(this_entry->time), 4);
-     bytes_read += cfr_read_n(dump->f, &(this_entry->type), 2);
-@@ -182,7 +182,7 @@
-     dump->parsed++;
-     this_entry->attr=NULL;
- 
--    buffer = malloc(this_entry->length);
-+    buffer = malloc_check(this_entry->length);
-     bytes_read = cfr_read_n(dump->f, buffer, this_entry->length);
-     if(bytes_read != this_entry->length) {
- 	err("bgpdump_read_next: incomplete dump record (%d bytes read, expecting %d)",
-@@ -456,7 +456,7 @@
- 		free(table_dump_v2_peer_index_table);
- 	}
- 
--	table_dump_v2_peer_index_table = malloc(sizeof(BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE));
-+	table_dump_v2_peer_index_table = malloc_check(sizeof(BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE));
- 	t = table_dump_v2_peer_index_table;
- 	t->entries = NULL;
- 
-@@ -793,7 +793,7 @@
-     entry->body.zebra_message.notify_len = entry->body.zebra_message.size - 21;
- 
-     if(entry->body.zebra_message.notify_len > 0) {
--	entry->body.zebra_message.notify_data = malloc(entry->body.zebra_message.notify_len);
-+	entry->body.zebra_message.notify_data = malloc_check(entry->body.zebra_message.notify_len);
- 	mstream_get(s, entry->body.zebra_message.notify_data, entry->body.zebra_message.notify_len);
-     }
- 
-@@ -808,7 +808,7 @@
-     mstream_getc(s, &entry->body.zebra_message.opt_len);
- 
-     if(entry->body.zebra_message.opt_len) {
--	entry->body.zebra_message.opt_data = malloc(entry->body.zebra_message.opt_len);
-+	entry->body.zebra_message.opt_data = malloc_check(entry->body.zebra_message.opt_len);
- 	mstream_get(s, entry->body.zebra_message.opt_data, entry->body.zebra_message.opt_len);
-     }
- 
-@@ -844,9 +844,9 @@
- 
- static attributes_t *attr_init(struct mstream *s, int len) {
- 
--    attributes_t *attr = malloc(sizeof(struct attr));
-+    attributes_t *attr = malloc_check(sizeof(struct attr));
-     
--    attr->data=malloc(len);
-+    attr->data=malloc_check(len);
-     memcpy(attr->data, &s->start[s->position], len);
-     
-     attr->len = len;
-@@ -865,7 +865,7 @@
-     attr->aspath			= NULL;
-     attr->community		= NULL;
-     attr->transit		= NULL;
--    attr->mp_info		= calloc(1, sizeof(struct mp_info));;
-+    attr->mp_info		= calloc_check(1, sizeof(struct mp_info));;
- 
-     attr->unknown_num = 0;
-     attr->unknown = NULL;
-@@ -881,14 +881,14 @@
- static void process_unknown_attr(struct mstream *s, attributes_t *attr, int flag, int type, int len) {
-     /* Unknown attribute. Save as is */
-     attr->unknown_num++;
--    attr->unknown = realloc(attr->unknown, attr->unknown_num * sizeof(struct unknown_attr));
-+    attr->unknown = realloc_check(attr->unknown, attr->unknown_num * sizeof(struct unknown_attr));
-     
-     /* Pointer to the unknown attribute we want to fill in */
-     struct unknown_attr unknown = {
-         .flag = flag,
-         .type = type,
-         .len = len,
--        .raw = malloc(len)
-+        .raw = malloc_check(len)
-     };
-     
-     attr->unknown[attr->unknown_num - 1] = unknown;
-@@ -956,9 +956,9 @@
-             break;
-         case BGP_ATTR_COMMUNITIES:
-             assert(! attr->community);
--            attr->community		= malloc(sizeof(struct community));
-+            attr->community		= malloc_check(sizeof(struct community));
-             attr->community->size	= len / 4;
--            attr->community->val	= malloc(len);
-+            attr->community->val	= malloc_check(len);
-             mstream_get(s,attr->community->val,len);
-             attr->community->str	= NULL;
-             process_attr_community_string(attr->community);
-@@ -982,9 +982,9 @@
-             break;
-         case BGP_ATTR_CLUSTER_LIST:
-             assert(! attr->cluster);
--            attr->cluster		= malloc(sizeof(struct cluster_list));
-+            attr->cluster		= malloc_check(sizeof(struct cluster_list));
-             attr->cluster->length	= len/4;
--            attr->cluster->list = malloc((attr->cluster->length) * sizeof(struct in_addr));
-+            attr->cluster->list = malloc_check((attr->cluster->length) * sizeof(struct in_addr));
-             
-             int i; // cluster index
-             for (i = 0; i < attr->cluster->length; i++)
-@@ -1014,14 +1014,14 @@
- }
- 
- struct aspath *create_aspath(u_int16_t len, u_int8_t asn_len) {
--  struct aspath *aspath = malloc(sizeof(struct aspath));
-+  struct aspath *aspath = malloc_check(sizeof(struct aspath));
-   if(aspath) {
-     aspath->asn_len	= asn_len;
-     aspath->length	= len;
-     aspath->count	= 0;
-     aspath->str		= NULL;
-     if(len > 0)
--       aspath->data	= malloc(len);
-+       aspath->data	= malloc_check(len);
-     else
-        aspath->data	= NULL;
-   }
-@@ -1036,13 +1036,13 @@
-     as->str = NULL;
-   }
- 
--  as->str = malloc(strlen(ASPATH_STR_ERROR) + 1);
-+  as->str = malloc_check(strlen(ASPATH_STR_ERROR) + 1);
-   strcpy(as->str, ASPATH_STR_ERROR);
- }
- 
- void process_attr_aspath_string(struct aspath *as) {
-     const int MAX_ASPATH_LEN = 8000;  
--    as->str = malloc(MAX_ASPATH_LEN);
-+    as->str = malloc_check(MAX_ASPATH_LEN);
-     
-     /* Set default values */
-     int space = 0;
-@@ -1210,12 +1210,12 @@
- 	}
-     }
- 
--    com->str = malloc(strlen(buf)+1);
-+    com->str = malloc_check(strlen(buf)+1);
-     strcpy(com->str, buf);
- }
- 
- static struct mp_nlri *get_nexthop(struct mstream *s, u_int16_t afi) {
--    struct mp_nlri *nlri = calloc(1, sizeof(struct mp_nlri));
-+    struct mp_nlri *nlri = calloc_check(1, sizeof(struct mp_nlri));
-     
-     nlri->nexthop_len = mstream_getc(s, NULL);
-     
-@@ -1300,7 +1300,7 @@
- 	}
- 
- 	/* Allocate structure */
--	mp_nlri = malloc(sizeof(struct mp_nlri));
-+	mp_nlri = malloc_check(sizeof(struct mp_nlri));
- 	memset(mp_nlri, 0, sizeof(struct mp_nlri));
- 	info->withdraw[afi][safi] = mp_nlri;
- 
-@@ -1439,7 +1439,7 @@
-   while(mergedpath->count < path->count - newpath->count) {
-     /* Make room */
-     newlen = mergedpath->length + sizeof(struct assegment) + segment->length * ASN32_LEN;
--    mergedpath->data = realloc(mergedpath->data, newlen);
-+    mergedpath->data = realloc_check(mergedpath->data, newlen);
- 
-     /* Create a new AS-path segment */
-     mergedsegment = (struct assegment *) (mergedpath->data + mergedpath->length);
-@@ -1464,7 +1464,7 @@
-   }
- 
-   /* Append NEW_AS_PATH to merged path */
--  mergedpath->data = realloc(mergedpath->data, mergedpath->length + newpath->length);
-+  mergedpath->data = realloc_check(mergedpath->data, mergedpath->length + newpath->length);
-   memcpy(mergedpath->data + mergedpath->length, newpath->data, newpath->length);
-   mergedpath->length += newpath->length;
- 
---- a/cfile_tools.c
-+++ b/cfile_tools.c
-@@ -73,7 +73,7 @@
-   format = 2;  // skip specials 0, 1 
- 
-   // Do action dependent on file format
--  retval = (CFRFILE *) calloc(1,sizeof(CFRFILE));
-+  retval = (CFRFILE *) calloc_check(1,sizeof(CFRFILE));
-   retval->eof = 0;
-   retval->error1 = 0;
-   retval->error2 = 0;
-@@ -357,12 +357,12 @@
- 
-       // allocate initial buffer if none was passed or size was zero
-       if (*lineptr == NULL) {
--        *lineptr = (char *) calloc(120, 1);
-+        *lineptr = (char *) calloc_check(120, 1);
-         *n = 120;
-       }
-       if (*n == 0) {
-         *n = 120;
--        *lineptr = (char *) realloc(*lineptr, *n); // to avoid memory-leaks
-+        *lineptr = (char *) realloc_check(*lineptr, *n); // to avoid memory-leaks
-       }
- 
-       count = 0;
-@@ -375,7 +375,7 @@
-         count ++;
-         if (count >= *n) {
-           *n = 2 * *n;
--          *lineptr = (char *) realloc(*lineptr, *n);
-+          *lineptr = (char *) realloc_check(*lineptr, *n);
-           if (*lineptr == NULL) {
-             stream->error1 = errno;
-             return(-1);
-@@ -551,3 +551,29 @@
- }
- #endif
-     
-+void *malloc_check(size_t __size) {
-+    void *ptr = malloc(__size);
-+    if(ptr==NULL) {
-+	fputs ("Out of memory!", stderr);
-+	exit(1);
-+    }
-+    return ptr;
-+}
-+
-+void *calloc_check(size_t __nmemb, size_t __size) {
-+    void *ptr = calloc(__nmemb, __size);
-+    if(ptr==NULL) {
-+	fputs ("Out of memory!", stderr);
-+	exit(1);
-+    }
-+    return ptr;
-+}
-+
-+void *realloc_check(void *__ptr, size_t __size) {
-+    void *ptr = realloc(__ptr, __size);
-+    if(ptr==NULL) {
-+	fputs ("Out of memory!", stderr);
-+	exit(1);
-+    }
-+    return ptr;
-+}
---- a/cfile_tools.h
-+++ b/cfile_tools.h
-@@ -89,5 +89,8 @@
- const char * _bz2_strerror(int err);
- #endif
- 
-+void *malloc_check(size_t size);
-+void *calloc_check(size_t __nmemb, size_t __size);
-+void *realloc_check(void *__ptr, size_t __size);
- 
- #endif

+ 0 - 18
debian/patches/catch-overlong-filename.patch

@@ -1,18 +0,0 @@
-Description: Catch file names that exceed the buffer limit
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/29/
-Last-Update: 2014-05-28
-
---- a/bgpdump_lib.c
-+++ b/bgpdump_lib.c
-@@ -97,6 +97,10 @@
-     BGPDUMP *this_dump = malloc(sizeof(BGPDUMP));
-     strcpy(this_dump->filename, "[STDIN]");
-     if(filename && strcmp(filename, "-")) {
-+        if (strlen(filename) >= BGPDUMP_MAX_FILE_LEN - 1) {
-+            fprintf (stderr, "File name %s is too long.\n", filename);
-+            exit(1);
-+        }
- 	strcpy(this_dump->filename, filename);
-     }
- 

+ 0 - 35
debian/patches/clarify-pointer-cast.patch

@@ -1,35 +0,0 @@
-Description: Clarify pointer usage
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/30/
-Last-Update: 2016-07-19
-
-    The read_asn function handles pointer to as_t and u_int16_t as well,
-    behaviour is controlled by the third parameter.
-
-    Type-cast parameter 2 to avoid incompatible-pointer-types warnings
-    from gcc.
-
---- a/bgpdump_lib.c
-+++ b/bgpdump_lib.c
-@@ -337,10 +337,10 @@
-     switch(entry->subtype) {
-     case BGPDUMP_SUBTYPE_MRTD_BGP_UPDATE:
-     case BGPDUMP_SUBTYPE_MRTD_BGP_KEEPALIVE:
--	read_asn(s, &entry->body.mrtd_message.source_as, ASN16_LEN);
-+	read_asn(s, (as_t*) &entry->body.mrtd_message.source_as, ASN16_LEN);
- 	entry->body.mrtd_message.source_ip = mstream_get_ipv4(s);
- 
--	read_asn(s, &entry->body.mrtd_message.destination_as, ASN16_LEN);
-+	read_asn(s, (as_t*) &entry->body.mrtd_message.destination_as, ASN16_LEN);
- 	entry->body.mrtd_message.destination_ip = mstream_get_ipv4(s);
- 
- 	mstream_t withdraw_stream = mstream_copy(s, mstream_getw(s, NULL));
-@@ -355,7 +355,7 @@
- 								   &entry->body.mrtd_message.incomplete);
- 	break;
-     case BGPDUMP_SUBTYPE_MRTD_BGP_STATE_CHANGE:
--	read_asn(s, &entry->body.mrtd_state_change.destination_as, ASN16_LEN);
-+	read_asn(s, (as_t*) &entry->body.mrtd_state_change.destination_as, ASN16_LEN);
- 	entry->body.mrtd_state_change.destination_ip = mstream_get_ipv4(s);
- 	entry->body.mrtd_state_change.old_state = mstream_getw(s, NULL);
- 	entry->body.mrtd_state_change.new_state = mstream_getw(s, NULL);

+ 5 - 5
debian/patches/disable-cfr_strerror.patch

@@ -8,7 +8,7 @@ Last-Update: 2016-07-19
 
 
 --- a/cfile_tools.c
 --- a/cfile_tools.c
 +++ b/cfile_tools.c
 +++ b/cfile_tools.c
-@@ -443,6 +443,7 @@
+@@ -430,6 +430,7 @@
  }
  }
  
  
  
  
@@ -16,8 +16,8 @@ Last-Update: 2016-07-19
  char * cfr_strerror(CFRFILE *stream) {
  char * cfr_strerror(CFRFILE *stream) {
    // Result is "stream-i/o: <stream-error> <compressor>[: <compressor error>]"
    // Result is "stream-i/o: <stream-error> <compressor>[: <compressor error>]"
    // Do not modify result. 
    // Do not modify result. 
-@@ -482,6 +483,7 @@
-   free(msg); 
+@@ -478,6 +479,7 @@
+   snprintf(res, sizeof(res), "%s", "Error: asprintf: out of memory");
    return(res);
    return(res);
  }
  }
 +#endif
 +#endif
@@ -26,7 +26,7 @@ Last-Update: 2016-07-19
    // Returns the name of the compressor used
    // Returns the name of the compressor used
 --- a/cfile_tools.h
 --- a/cfile_tools.h
 +++ b/cfile_tools.h
 +++ b/cfile_tools.h
-@@ -80,7 +80,9 @@
+@@ -68,7 +68,9 @@
  ssize_t      cfr_getline(char **lineptr, size_t *n, CFRFILE *stream);
  ssize_t      cfr_getline(char **lineptr, size_t *n, CFRFILE *stream);
  int          cfr_eof(CFRFILE *stream);
  int          cfr_eof(CFRFILE *stream);
  int          cfr_error(CFRFILE *stream);
  int          cfr_error(CFRFILE *stream);
@@ -35,4 +35,4 @@ Last-Update: 2016-07-19
 +#endif
 +#endif
  const char * cfr_compressor_str(CFRFILE *stream);
  const char * cfr_compressor_str(CFRFILE *stream);
  
  
- #ifndef DONT_HAVE_BZ2
+ const char * _bz2_strerror(int err);

+ 5 - 4
debian/patches/enhance-test-script.patch

@@ -33,11 +33,12 @@ Last-Update: 2014-07-22
  
  
  echo "Running Regression Tests..."
  echo "Running Regression Tests..."
 -for mrt in `ls test_data`; do
 -for mrt in `ls test_data`; do
-+for mrt in $(find "$DIR/test_data/" -maxdepth 1 -type f -printf '%f\n' | grep -E '\.(gz|bz2|xz)' | sort) ; do
-     echo -n "      testing $mrt..."
+-    /bin/echo -n "      testing $mrt..."
 -    OUT=$mrt.bgp.gz
 -    OUT=$mrt.bgp.gz
 -    ./bgpdump -vm test_data/$mrt > test_out/$OUT
 -    ./bgpdump -vm test_data/$mrt > test_out/$OUT
--    gzcat test_expect/$OUT | diff -q test_out/$OUT -
+-    gzip -cd test_expect/$OUT | diff -q test_out/$OUT -
++for mrt in $(find "$DIR/test_data/" -maxdepth 1 -type f -printf '%f\n' | grep -E '\.(gz|bz2|xz)' | sort) ; do
++    echo -n "      testing $mrt..."
 +    OUT=$mrt.bgp
 +    OUT=$mrt.bgp
 +    ./bgpdump -vm "$DIR/test_data/$mrt" > "$DIR/test_out/$OUT"
 +    ./bgpdump -vm "$DIR/test_data/$mrt" > "$DIR/test_out/$OUT"
 +    if [ -f "$DIR/test_expect/$OUT.gz" ] ; then
 +    if [ -f "$DIR/test_expect/$OUT.gz" ] ; then
@@ -55,7 +56,7 @@ Last-Update: 2014-07-22
 +    fi
 +    fi
 +
 +
 +    "$CAT" "$DIR/test_expect/$OUT.$EXT" | diff -q "$DIR/test_out/$OUT" -
 +    "$CAT" "$DIR/test_expect/$OUT.$EXT" | diff -q "$DIR/test_out/$OUT" -
-     if [ $? == 0 ]; then
+     if [ $? = 0 ]; then
          echo "success"
          echo "success"
      else
      else
 --- a/Makefile.am
 --- a/Makefile.am

+ 0 - 36
debian/patches/fix-bgp-state-out-of-bonds.patch

@@ -1,36 +0,0 @@
-Description: Fix array out of bond access in process()
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issue/19/
-Last-Update: 2016-07-13
-
-    The current code happily assumes the state value is within the range
-    of hard-coded values. Handle unknown values gracefully.
-
---- a/bgpdump.c
-+++ b/bgpdump.c
-@@ -244,6 +244,15 @@
- 	NULL
- };
- 
-+static const char *bgp_state_name_lookup(unsigned state, char *buffer) {
-+    if (state >= sizeof(bgp_state_name)/sizeof(bgp_state_name[0])-1) {
-+        sprintf(buffer, "Unknown-%u", state);
-+        return buffer;
-+    }
-+    return bgp_state_name[state];
-+}
-+
-+
- void process(BGPDUMP_ENTRY *entry) {
- 
- 	struct tm *date;
-@@ -926,7 +935,8 @@
- 			//	printf(" N/A ");
- 		    	printf("AS%u\n",entry->body.zebra_state_change.source_as);
- 
--		    	printf("STATE: %s/%s\n",bgp_state_name[entry->body.zebra_state_change.old_state],bgp_state_name[entry->body.zebra_state_change.new_state]);
-+			char temp1[16], temp2[16];
-+		    	printf("STATE: %s/%s\n",bgp_state_name_lookup(entry->body.zebra_state_change.old_state,temp1),bgp_state_name_lookup(entry->body.zebra_state_change.new_state,temp2));
- 		    }
- 		    else if (mode==1 || mode==2 ) //-m -M
- 		    {

+ 2 - 2
debian/patches/fix-crash-on-huge-prefix-lists.patch

@@ -9,7 +9,7 @@ Last-Update: 2016-07-13
 
 
 --- a/bgpdump_lib.c
 --- a/bgpdump_lib.c
 +++ b/bgpdump_lib.c
 +++ b/bgpdump_lib.c
-@@ -1325,11 +1325,16 @@
+@@ -1525,11 +1525,16 @@
              break;
              break;
          }
          }
          
          
@@ -27,6 +27,6 @@ Last-Update: 2016-07-13
 +            prefix = &void_prefix;
 +            prefix = &void_prefix;
 +        }
 +        }
 +        count++;
 +        count++;
-         *prefix = (struct prefix) { .len = p_len };
+         *prefix = (struct prefix) { .len = p_len, .path_id = path_id };
          mstream_get(s, &prefix->address, p_bytes);
          mstream_get(s, &prefix->address, p_bytes);
      }
      }

+ 0 - 19
debian/patches/fix-getopt-usage.patch

@@ -1,19 +0,0 @@
-Description: Fix command line parser for archs where char is unsigned
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/36/
-Last-Update: 2016-07-22
-
-     Else the getopt return code check will always fail on archs where
-     the char type is unsigned (e.g. armhf, powerpc).
-
---- a/bgpdump.c
-+++ b/bgpdump.c
-@@ -137,7 +137,7 @@
- 
- int main(int argc, char *argv[]) {
-     
--    char c;
-+    int c;
-     int fd;
-     bool usage_error = false;
-     bool use_syslog = true;

+ 0 - 56
debian/patches/fix-gzfile-type-usage.patch

@@ -1,56 +0,0 @@
-Description: Fix gzFile type usage
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/32/
-Last-Update: 2016-07-20
-
-    The gzFile type is already a pointer. Don't pointer it.
-
---- a/cfile_tools.c
-+++ b/cfile_tools.c
-@@ -82,7 +82,7 @@
- #ifndef DONT_HAVE_GZ
-   if((path == NULL) || (strcmp(path, "-") == 0)) {
- 	/* dump from stdin */
--	gzFile *f;
-+	gzFile f;
- 	while (format < CFR_NUM_FORMATS) {
- 		if (strcmp(cfr_extensions[format], ".gz") == 0)
-         		break;
-@@ -157,7 +157,7 @@
- #ifndef DONT_HAVE_GZ
-   case 3:  // gzip
-     { 
--	gzFile *f;
-+	gzFile f;
-       	// get file 
- 	f = gzopen(path, "r");
- 	if(f == NULL) {
-@@ -302,8 +302,8 @@
- #ifndef DONT_HAVE_GZ
-   case 3:  // gzip
-     { 
--      gzFile * in;
--      in = (gzFile *)(stream->data2);
-+      gzFile in;
-+      in = (gzFile)(stream->data2);
-       retval = gzread(in, ptr, size*nmemb);
-       if (retval != nmemb*size) {
-         // fprintf(stderr,"short read!!!\n");
-@@ -391,7 +391,7 @@
- #ifndef DONT_HAVE_GZ
-   case 3:  // gzip
-     { 
--      char * return_ptr = gzgets((gzFile *)(stream->data2), *lineptr, *n );
-+      char * return_ptr = gzgets((gzFile)(stream->data2), *lineptr, *n );
-       if (return_ptr == Z_NULL) {
-         stream->error2 = errno;
-         return(-1);
-@@ -474,7 +474,7 @@
-     asprintf(&msg2, 
-              "%s: %s",
-              msg, 
--             gzerror((gzFile*)(stream->data2), &(stream->error2)));
-+             gzerror((gzFile)(stream->data2), &(stream->error2)));
-     free(msg);
-     msg = msg2;
-   }

+ 0 - 60
debian/patches/fix-sprintf-append.patch

@@ -1,60 +0,0 @@
-Description: Fix undefined sprintf usage
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/33/
-Last-Update: 2016-07-18
-
-    Documentation states appending to a buffer using
-        sprintf (buf, "%s.foo", buf);
-    results in undefined behaviour. Work around it.
-
---- a/bgpdump.c
-+++ b/bgpdump.c
-@@ -261,19 +261,20 @@
- 	char time_str_fixed[128];
-     char prefix[BGPDUMP_ADDRSTRLEN];
-     char *bgp4mp_format;
-+    int len;
- 	
- 	date=gmtime(&entry->time);
- 	time2str(date,time_str_fixed);
-     
-     if (mode == 1) {
-         // Timestamp mode
--        sprintf(time_str, "%ld", entry->time);
-+        len = sprintf(time_str, "%ld", entry->time);
-     } else {
--        time2str(date,time_str);
-+        len = time2str(date,time_str);
-     }
-     // Appending microseconds to time_str if needed
-     if (entry->type == BGPDUMP_TYPE_ZEBRA_BGP_ET) {
--        sprintf(time_str, "%s.%06ld", time_str, entry->ms);
-+        sprintf(time_str + len, ".%06ld", entry->ms);
-     }
-     
- 	if (mode==0)
---- a/util.c
-+++ b/util.c
-@@ -66,9 +66,9 @@
- void warn(const char *fmt, ...) { log(WARNING, warn); }
- void debug(const char *fmt, ...) { log(INFO, info); }
- 
--void time2str(struct tm* date,char *time_str)
-+int time2str(struct tm* date,char *time_str)
- {
--    sprintf(time_str, "%02d/%02d/%02d %02d:%02d:%02d", date->tm_mon+1, date->tm_mday, date->tm_year%100,
-+    return sprintf(time_str, "%02d/%02d/%02d %02d:%02d:%02d", date->tm_mon+1, date->tm_mday, date->tm_year%100,
-             date->tm_hour, date->tm_min, date->tm_sec);
- }
- 
---- a/util.h
-+++ b/util.h
-@@ -38,7 +38,7 @@
- char *fmt_ipv6(BGPDUMP_IP_ADDRESS addr, char *buffer);
- void test_fmt_ip(void);
- 
--void time2str(struct tm* date,char *time_str);
-+int time2str(struct tm* date,char *time_str);
- int int2str(uint32_t value, char* str);
- void test_utils(void);
- 

+ 0 - 36
debian/patches/fix-time-t-expansion.patch

@@ -1,36 +0,0 @@
-Description: Fix time_t expansion on big-endian archs where sizeof(time_t) > 4
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/38/
-Bug-Debian: https://bugs.debian.org/832468
-Last-Update: 2016-08-04
-
-    On these archs the present code places the time_t data in the wrong
-    32 bits of time_t. Additionally, broken libc implementations do not
-    mask the result of ntohl to the size of 32 bit, resulting in a huge
-    time_t value that gmtime cannot handle, which eventually leads to a
-    segfault.
-
---- a/bgpdump_lib.c
-+++ b/bgpdump_lib.c
-@@ -138,10 +138,11 @@
-     u_char *buffer;
-     int ok=0;
-     u_int32_t bytes_read;
-+    u_int32_t t;
- 
-     this_entry = malloc_check(sizeof(BGPDUMP_ENTRY));
- 
--    bytes_read = cfr_read_n(dump->f, &(this_entry->time), 4);
-+    bytes_read = cfr_read_n(dump->f, &t, 4);
-     bytes_read += cfr_read_n(dump->f, &(this_entry->type), 2);
-     bytes_read += cfr_read_n(dump->f, &(this_entry->subtype), 2);
-     bytes_read += cfr_read_n(dump->f, &(this_entry->length), 4);
-@@ -150,7 +151,7 @@
-         /* Intel byte ordering stuff ... */
-         this_entry->type = ntohs(this_entry->type);
-         this_entry->subtype = ntohs(this_entry->subtype);
--        this_entry->time = ntohl(this_entry->time);
-+        this_entry->time = (time_t) ntohl (t);
-         this_entry->length = ntohl(this_entry->length);
-         
-         /* If Extended Header format, then reading the miscroseconds attribute */

+ 2 - 2
debian/patches/increase-max-prefixes.patch

@@ -8,8 +8,8 @@ Last-Update: 2016-07-13
 
 
 --- a/bgpdump_attr.h
 --- a/bgpdump_attr.h
 +++ b/bgpdump_attr.h
 +++ b/bgpdump_attr.h
-@@ -212,7 +212,7 @@
-     u_char		len;
+@@ -214,7 +214,7 @@
+     pathid_t    path_id;
  };
  };
  
  
 -#define MAX_PREFIXES 2050
 -#define MAX_PREFIXES 2050

+ 0 - 16
debian/patches/more-bgp-states.patch

@@ -1,16 +0,0 @@
-Description: Add two more BGP states as described in the quagga sources
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-Bug: https://bitbucket.org/ripencc/bgpdump/issues/35/
-Last-Update: 2016-07-13
-
---- a/bgpdump.c
-+++ b/bgpdump.c
-@@ -241,6 +241,8 @@
- 	"Opensent",
- 	"Openconfirm",
- 	"Established",
-+	"Clearing",
-+	"Deleted",
- 	NULL
- };
- 

+ 0 - 11
debian/patches/series

@@ -3,23 +3,12 @@ re-autoconfig.patch
 
 
 # upstream code cleanup
 # upstream code cleanup
 disable-cfr_strerror.patch
 disable-cfr_strerror.patch
-fix-bgp-state-out-of-bonds.patch
 fix-crash-on-huge-prefix-lists.patch
 fix-crash-on-huge-prefix-lists.patch
-catch-overlong-filename.patch
 fix-buffer-weirdness.patch
 fix-buffer-weirdness.patch
-catch-alloc-failures.patch
-add-prototype.patch
-clarify-pointer-cast.patch
-fix-gzfile-type-usage.patch
-fix-sprintf-append.patch
 use-strlcat.patch
 use-strlcat.patch
-fix-getopt-usage.patch
-add-assertions.patch
-fix-time-t-expansion.patch
 
 
 # features
 # features
 increase-max-prefixes.patch
 increase-max-prefixes.patch
-more-bgp-states.patch
 
 
 # big test (see README.Debian)
 # big test (see README.Debian)
 enhance-test-script.patch
 enhance-test-script.patch

+ 4 - 4
debian/patches/use-strlcat.patch

@@ -13,16 +13,16 @@ Last-Update: 2016-07-21
  
  
  #include <zlib.h>
  #include <zlib.h>
  #include <assert.h>
  #include <assert.h>
-@@ -78,7 +79,7 @@
- 
- BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE *table_dump_v2_peer_index_table = NULL;
+@@ -77,7 +78,7 @@
+ static    struct aspath *asn32_merge_paths(struct aspath *path, struct aspath *newpath);
+ static    void asn32_expand_16_to_32(char *dst, char *src, int len);
  
  
 -#if defined(linux)
 -#if defined(linux)
 +#if 0
 +#if 0
  static    size_t strlcat(char *dst, const char *src, size_t size);
  static    size_t strlcat(char *dst, const char *src, size_t size);
  #endif
  #endif
  
  
-@@ -1482,7 +1483,7 @@
+@@ -1689,7 +1690,7 @@
    }
    }
  }
  }