1234567891011121314151617181920212223242526272829303132333435 |
- 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);
|