clarify-pointer-cast.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. Description: Clarify pointer usage
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Bug: https://bitbucket.org/ripencc/bgpdump/issues/30/
  4. Last-Update: 2016-07-19
  5. The read_asn function handles pointer to as_t and u_int16_t as well,
  6. behaviour is controlled by the third parameter.
  7. Type-cast parameter 2 to avoid incompatible-pointer-types warnings
  8. from gcc.
  9. --- a/bgpdump_lib.c
  10. +++ b/bgpdump_lib.c
  11. @@ -337,10 +337,10 @@
  12. switch(entry->subtype) {
  13. case BGPDUMP_SUBTYPE_MRTD_BGP_UPDATE:
  14. case BGPDUMP_SUBTYPE_MRTD_BGP_KEEPALIVE:
  15. - read_asn(s, &entry->body.mrtd_message.source_as, ASN16_LEN);
  16. + read_asn(s, (as_t*) &entry->body.mrtd_message.source_as, ASN16_LEN);
  17. entry->body.mrtd_message.source_ip = mstream_get_ipv4(s);
  18. - read_asn(s, &entry->body.mrtd_message.destination_as, ASN16_LEN);
  19. + read_asn(s, (as_t*) &entry->body.mrtd_message.destination_as, ASN16_LEN);
  20. entry->body.mrtd_message.destination_ip = mstream_get_ipv4(s);
  21. mstream_t withdraw_stream = mstream_copy(s, mstream_getw(s, NULL));
  22. @@ -355,7 +355,7 @@
  23. &entry->body.mrtd_message.incomplete);
  24. break;
  25. case BGPDUMP_SUBTYPE_MRTD_BGP_STATE_CHANGE:
  26. - read_asn(s, &entry->body.mrtd_state_change.destination_as, ASN16_LEN);
  27. + read_asn(s, (as_t*) &entry->body.mrtd_state_change.destination_as, ASN16_LEN);
  28. entry->body.mrtd_state_change.destination_ip = mstream_get_ipv4(s);
  29. entry->body.mrtd_state_change.old_state = mstream_getw(s, NULL);
  30. entry->body.mrtd_state_change.new_state = mstream_getw(s, NULL);