mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-27 03:53:53 +08:00
NDOize ForCES, MPLS LSP ping and OLSR decoders
This commit is contained in:
parent
77493011a7
commit
62a5184ed4
@ -182,10 +182,8 @@ extern void nfsreply_print_noaddr(const u_char *, u_int, const u_char *);
|
||||
extern void nfsreq_print(const u_char *, u_int, const u_char *);
|
||||
extern void nfsreq_print_noaddr(const u_char *, u_int, const u_char *);
|
||||
extern void ospf_print(const u_char *, u_int, const u_char *);
|
||||
extern void olsr_print (const u_char *, u_int, int);
|
||||
extern void rsvp_print(const u_char *, u_int);
|
||||
extern void lldp_print(const u_char *, u_int);
|
||||
extern void lspping_print(const u_char *, u_int);
|
||||
extern u_int ppp_print(register const u_char *, u_int);
|
||||
extern u_int ppp_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ppp_hdlc_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
@ -222,7 +220,6 @@ extern void print_data(const unsigned char *, int);
|
||||
extern void cfm_print(const u_char *, u_int);
|
||||
extern void cdp_print(const u_char *, u_int, u_int);
|
||||
extern void lwres_print(const u_char *, u_int);
|
||||
extern void forces_print(const u_char *, u_int);
|
||||
extern void mpls_lsp_ping_print(const u_char *, u_int);
|
||||
extern void sip_print(const u_char *, u_int);
|
||||
extern void syslog_print(const u_char *, u_int);
|
||||
|
@ -471,6 +471,9 @@ extern void aodv_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void sctp_print(netdissect_options *, const u_char *, const u_char *, u_int);
|
||||
extern char *bgp_vpn_rd_print (netdissect_options *, const u_char *);
|
||||
extern void bgp_print(netdissect_options *, const u_char *, int);
|
||||
extern void olsr_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void forces_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lspping_print(netdissect_options *, const u_char *, u_int);
|
||||
|
||||
/* stuff that has not yet been rototiled */
|
||||
|
||||
|
614
print-forces.c
614
print-forces.c
File diff suppressed because it is too large
Load Diff
148
print-lspping.c
148
print-lspping.c
@ -13,16 +13,13 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
@ -460,7 +457,8 @@ static const struct tok lspping_tlv_downstream_addr_values[] = {
|
||||
};
|
||||
|
||||
void
|
||||
lspping_print(register const u_char *pptr, register u_int len) {
|
||||
lspping_print(netdissect_options *ndo,
|
||||
register const u_char *pptr, register u_int len) {
|
||||
|
||||
const struct lspping_common_header *lspping_com_header;
|
||||
const struct lspping_tlv_header *lspping_tlv_header;
|
||||
@ -493,24 +491,24 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
tptr=pptr;
|
||||
lspping_com_header = (const struct lspping_common_header *)pptr;
|
||||
TCHECK(*lspping_com_header);
|
||||
ND_TCHECK(*lspping_com_header);
|
||||
|
||||
/*
|
||||
* Sanity checking of the header.
|
||||
*/
|
||||
if (EXTRACT_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) {
|
||||
printf("LSP-PING version %u packet not supported",
|
||||
EXTRACT_16BITS(&lspping_com_header->version[0]));
|
||||
ND_PRINT((ndo, "LSP-PING version %u packet not supported",
|
||||
EXTRACT_16BITS(&lspping_com_header->version[0])));
|
||||
return;
|
||||
}
|
||||
|
||||
/* in non-verbose mode just lets print the basic Message Type*/
|
||||
if (vflag < 1) {
|
||||
printf("LSP-PINGv%u, %s, seq %u, length: %u",
|
||||
if (ndo->ndo_vflag < 1) {
|
||||
ND_PRINT((ndo, "LSP-PINGv%u, %s, seq %u, length: %u",
|
||||
EXTRACT_16BITS(&lspping_com_header->version[0]),
|
||||
tok2str(lspping_msg_type_values, "unknown (%u)",lspping_com_header->msg_type),
|
||||
EXTRACT_32BITS(lspping_com_header->seq_number),
|
||||
len);
|
||||
len));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -518,13 +516,13 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
tlen=len;
|
||||
|
||||
printf("\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)",
|
||||
ND_PRINT((ndo, "\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)",
|
||||
EXTRACT_16BITS(&lspping_com_header->version[0]),
|
||||
tok2str(lspping_msg_type_values, "unknown",lspping_com_header->msg_type),
|
||||
lspping_com_header->msg_type,
|
||||
len,
|
||||
tok2str(lspping_reply_mode_values, "unknown",lspping_com_header->reply_mode),
|
||||
lspping_com_header->reply_mode);
|
||||
lspping_com_header->reply_mode));
|
||||
|
||||
/*
|
||||
* the following return codes require that the subcode is attached
|
||||
@ -536,33 +534,33 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
lspping_com_header->return_code == 10 ||
|
||||
lspping_com_header->return_code == 11 ||
|
||||
lspping_com_header->return_code == 12 )
|
||||
printf("\n\t Return Code: %s %u (%u)\n\t Return Subcode: (%u)",
|
||||
ND_PRINT((ndo, "\n\t Return Code: %s %u (%u)\n\t Return Subcode: (%u)",
|
||||
tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
|
||||
lspping_com_header->return_subcode,
|
||||
lspping_com_header->return_code,
|
||||
lspping_com_header->return_subcode);
|
||||
lspping_com_header->return_subcode));
|
||||
else
|
||||
printf("\n\t Return Code: %s (%u)\n\t Return Subcode: (%u)",
|
||||
ND_PRINT((ndo, "\n\t Return Code: %s (%u)\n\t Return Subcode: (%u)",
|
||||
tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
|
||||
lspping_com_header->return_code,
|
||||
lspping_com_header->return_subcode);
|
||||
lspping_com_header->return_subcode));
|
||||
|
||||
printf("\n\t Sender Handle: 0x%08x, Sequence: %u",
|
||||
ND_PRINT((ndo, "\n\t Sender Handle: 0x%08x, Sequence: %u",
|
||||
EXTRACT_32BITS(lspping_com_header->sender_handle),
|
||||
EXTRACT_32BITS(lspping_com_header->seq_number));
|
||||
EXTRACT_32BITS(lspping_com_header->seq_number)));
|
||||
|
||||
timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_sent_sec);
|
||||
timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_sent_usec);
|
||||
printf("\n\t Sender Timestamp: ");
|
||||
ND_PRINT((ndo, "\n\t Sender Timestamp: "));
|
||||
ts_print(×tamp);
|
||||
|
||||
timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_sec);
|
||||
timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_usec);
|
||||
printf("Receiver Timestamp: ");
|
||||
ND_PRINT((ndo, "Receiver Timestamp: "));
|
||||
if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0))
|
||||
ts_print(×tamp);
|
||||
else
|
||||
printf("no timestamp");
|
||||
ND_PRINT((ndo, "no timestamp"));
|
||||
|
||||
tptr+=sizeof(const struct lspping_common_header);
|
||||
tlen-=sizeof(const struct lspping_common_header);
|
||||
@ -570,7 +568,7 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
while(tlen>(int)sizeof(struct lspping_tlv_header)) {
|
||||
|
||||
/* did we capture enough for fully decoding the tlv header ? */
|
||||
if (!TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
|
||||
if (!ND_TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
|
||||
goto trunc;
|
||||
|
||||
lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
|
||||
@ -582,22 +580,22 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
return;
|
||||
|
||||
if(lspping_tlv_len < 4) {
|
||||
printf("\n\t ERROR: TLV %u bogus size %u",lspping_tlv_type,lspping_tlv_len);
|
||||
ND_PRINT((ndo, "\n\t ERROR: TLV %u bogus size %u",lspping_tlv_type,lspping_tlv_len));
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n\t %s TLV (%u), length: %u",
|
||||
ND_PRINT((ndo, "\n\t %s TLV (%u), length: %u",
|
||||
tok2str(lspping_tlv_values,
|
||||
"Unknown",
|
||||
lspping_tlv_type),
|
||||
lspping_tlv_type,
|
||||
lspping_tlv_len);
|
||||
lspping_tlv_len));
|
||||
|
||||
tlv_tptr=tptr+sizeof(struct lspping_tlv_header);
|
||||
tlv_tlen=lspping_tlv_len; /* header not included -> no adjustment */
|
||||
|
||||
/* did we capture enough for fully decoding the tlv ? */
|
||||
if (!TTEST2(*tptr, lspping_tlv_len))
|
||||
if (!ND_TTEST2(*tptr, lspping_tlv_len))
|
||||
goto trunc;
|
||||
tlv_hexdump=FALSE;
|
||||
|
||||
@ -606,7 +604,7 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
while(tlv_tlen>(int)sizeof(struct lspping_tlv_header)) {
|
||||
|
||||
/* did we capture enough for fully decoding the subtlv header ? */
|
||||
if (!TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
|
||||
if (!ND_TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
|
||||
goto trunc;
|
||||
subtlv_hexdump=FALSE;
|
||||
|
||||
@ -618,111 +616,111 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
if (lspping_subtlv_len == 0)
|
||||
break;
|
||||
|
||||
printf("\n\t %s subTLV (%u), length: %u",
|
||||
ND_PRINT((ndo, "\n\t %s subTLV (%u), length: %u",
|
||||
tok2str(lspping_tlvtargetfec_subtlv_values,
|
||||
"Unknown",
|
||||
lspping_subtlv_type),
|
||||
lspping_subtlv_type,
|
||||
lspping_subtlv_len);
|
||||
lspping_subtlv_len));
|
||||
|
||||
switch(lspping_subtlv_type) {
|
||||
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4 = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *)subtlv_tptr;
|
||||
printf("\n\t %s/%u",
|
||||
ND_PRINT((ndo, "\n\t %s/%u",
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix),
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len);
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len));
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6 = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *)subtlv_tptr;
|
||||
printf("\n\t %s/%u",
|
||||
ND_PRINT((ndo, "\n\t %s/%u",
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix),
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len);
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len));
|
||||
break;
|
||||
#endif
|
||||
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4 = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *)subtlv_tptr;
|
||||
printf("\n\t %s/%u, sender-id %s",
|
||||
ND_PRINT((ndo, "\n\t %s/%u, sender-id %s",
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix),
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix_len,
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->sender_id));
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->sender_id)));
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6 = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *)subtlv_tptr;
|
||||
printf("\n\t %s/%u, sender-id %s",
|
||||
ND_PRINT((ndo, "\n\t %s/%u, sender-id %s",
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix),
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix_len,
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->sender_id));
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->sender_id)));
|
||||
break;
|
||||
#endif
|
||||
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4 = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *)subtlv_tptr;
|
||||
printf("\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
|
||||
ND_PRINT((ndo, "\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
|
||||
"\n\t tunnel-id 0x%04x, extended tunnel-id %s",
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint),
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id));
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id)));
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6 = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *)subtlv_tptr;
|
||||
printf("\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
|
||||
ND_PRINT((ndo, "\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
|
||||
"\n\t tunnel-id 0x%04x, extended tunnel-id %s",
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint),
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id));
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id)));
|
||||
break;
|
||||
#endif
|
||||
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4 = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *)subtlv_tptr;
|
||||
printf("\n\t RD: %s, %s/%u",
|
||||
bgp_vpn_rd_print(gndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->rd),
|
||||
ND_PRINT((ndo, "\n\t RD: %s, %s/%u",
|
||||
bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->rd),
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix),
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len);
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len));
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6 = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *)subtlv_tptr;
|
||||
printf("\n\t RD: %s, %s/%u",
|
||||
bgp_vpn_rd_print(gndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->rd),
|
||||
ND_PRINT((ndo, "\n\t RD: %s, %s/%u",
|
||||
bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->rd),
|
||||
ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix),
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len);
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len));
|
||||
break;
|
||||
#endif
|
||||
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *)subtlv_tptr;
|
||||
printf("\n\t RD: %s, Sender CE-ID: %u, Receiver CE-ID: %u" \
|
||||
ND_PRINT((ndo, "\n\t RD: %s, Sender CE-ID: %u, Receiver CE-ID: %u" \
|
||||
"\n\t Encapsulation Type: %s (%u)",
|
||||
bgp_vpn_rd_print(gndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
|
||||
bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ce_id),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ce_id),
|
||||
tok2str(l2vpn_encaps_values,
|
||||
"unknown",
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation));
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)));
|
||||
|
||||
break;
|
||||
|
||||
@ -730,21 +728,21 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t *)subtlv_tptr;
|
||||
printf("\n\t Remote PE: %s" \
|
||||
ND_PRINT((ndo, "\n\t Remote PE: %s" \
|
||||
"\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address),
|
||||
EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->vc_id),
|
||||
tok2str(l2vpn_encaps_values,
|
||||
"unknown",
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation)),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation));
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation)));
|
||||
|
||||
break;
|
||||
|
||||
case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID:
|
||||
subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid = \
|
||||
(const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t *)subtlv_tptr;
|
||||
printf("\n\t Sender PE: %s, Remote PE: %s" \
|
||||
ND_PRINT((ndo, "\n\t Sender PE: %s, Remote PE: %s" \
|
||||
"\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address),
|
||||
ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address),
|
||||
@ -752,7 +750,7 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
tok2str(l2vpn_encaps_values,
|
||||
"unknown",
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation)),
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation));
|
||||
EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation)));
|
||||
|
||||
break;
|
||||
|
||||
@ -761,8 +759,8 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
break;
|
||||
}
|
||||
/* do we want to see an additionally subtlv hexdump ? */
|
||||
if (vflag > 1 || subtlv_hexdump==TRUE)
|
||||
print_unknown_data(gndo,tlv_tptr+sizeof(struct lspping_tlv_header), \
|
||||
if (ndo->ndo_vflag > 1 || subtlv_hexdump==TRUE)
|
||||
print_unknown_data(ndo, tlv_tptr+sizeof(struct lspping_tlv_header), \
|
||||
"\n\t ",
|
||||
lspping_subtlv_len);
|
||||
|
||||
@ -780,38 +778,38 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
(const struct lspping_tlv_downstream_map_ipv4_t *)tlv_tptr;
|
||||
tlv_ptr.lspping_tlv_downstream_map_ipv6= \
|
||||
(const struct lspping_tlv_downstream_map_ipv6_t *)tlv_tptr;
|
||||
printf("\n\t MTU: %u, Address-Type: %s (%u)",
|
||||
ND_PRINT((ndo, "\n\t MTU: %u, Address-Type: %s (%u)",
|
||||
EXTRACT_16BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->mtu),
|
||||
tok2str(lspping_tlv_downstream_addr_values,
|
||||
"unknown",
|
||||
tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type),
|
||||
tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type);
|
||||
tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type));
|
||||
|
||||
switch(tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type) {
|
||||
|
||||
case LSPPING_AFI_IPV4:
|
||||
printf("\n\t Downstream IP: %s" \
|
||||
ND_PRINT((ndo, "\n\t Downstream IP: %s" \
|
||||
"\n\t Downstream Interface IP: %s",
|
||||
ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
|
||||
ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface));
|
||||
ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface)));
|
||||
tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
|
||||
tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
|
||||
break;
|
||||
#ifdef INET6
|
||||
case LSPPING_AFI_IPV6:
|
||||
printf("\n\t Downstream IP: %s" \
|
||||
ND_PRINT((ndo, "\n\t Downstream IP: %s" \
|
||||
"\n\t Downstream Interface IP: %s",
|
||||
ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_ip),
|
||||
ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_interface));
|
||||
ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_interface)));
|
||||
tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
|
||||
tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
|
||||
break;
|
||||
#endif
|
||||
case LSPPING_AFI_UNMB:
|
||||
printf("\n\t Downstream IP: %s" \
|
||||
ND_PRINT((ndo, "\n\t Downstream IP: %s" \
|
||||
"\n\t Downstream Interface Index: 0x%08x",
|
||||
ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
|
||||
EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface));
|
||||
EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface)));
|
||||
tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
|
||||
tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
|
||||
break;
|
||||
@ -839,21 +837,21 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
case LSPPING_TLV_BFD_DISCRIMINATOR:
|
||||
tptr += sizeof(struct lspping_tlv_header);
|
||||
if (!TTEST2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN))
|
||||
if (!ND_TTEST2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN))
|
||||
goto trunc;
|
||||
printf("\n\t BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr));
|
||||
ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr)));
|
||||
break;
|
||||
|
||||
case LSPPING_TLV_VENDOR_ENTERPRISE:
|
||||
{
|
||||
u_int32_t vendor_id;
|
||||
|
||||
if (!TTEST2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN))
|
||||
if (!ND_TTEST2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN))
|
||||
goto trunc;
|
||||
vendor_id = EXTRACT_32BITS(tlv_tptr);
|
||||
printf("\n\t Vendor: %s (0x%04x)",
|
||||
ND_PRINT((ndo, "\n\t Vendor: %s (0x%04x)",
|
||||
tok2str(smi_values, "Unknown", vendor_id),
|
||||
vendor_id);
|
||||
vendor_id));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -866,13 +864,13 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
case LSPPING_TLV_VENDOR_PRIVATE:
|
||||
|
||||
default:
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(gndo,tlv_tptr,"\n\t ",tlv_tlen);
|
||||
if (ndo->ndo_vflag <= 1)
|
||||
print_unknown_data(ndo, tlv_tptr, "\n\t ", tlv_tlen);
|
||||
break;
|
||||
}
|
||||
/* do we want to see an additionally tlv hexdump ? */
|
||||
if (vflag > 1 || tlv_hexdump==TRUE)
|
||||
print_unknown_data(gndo,tptr+sizeof(struct lspping_tlv_header),"\n\t ",
|
||||
if (ndo->ndo_vflag > 1 || tlv_hexdump==TRUE)
|
||||
print_unknown_data(ndo, tptr+sizeof(struct lspping_tlv_header), "\n\t ",
|
||||
lspping_tlv_len);
|
||||
|
||||
|
||||
@ -886,7 +884,7 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
printf("\n\t\t packet exceeded snapshot");
|
||||
ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
|
||||
}
|
||||
/*
|
||||
* Local Variables:
|
||||
|
129
print-olsr.c
129
print-olsr.c
@ -19,19 +19,16 @@
|
||||
* IPv6 additions by Florian Forster <octo at verplant.org>
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
#include "ip.h"
|
||||
|
||||
/*
|
||||
* RFC 3626 common header
|
||||
@ -182,7 +179,8 @@ struct olsr_lq_neighbor6 {
|
||||
* print a neighbor list with LQ extensions.
|
||||
*/
|
||||
static void
|
||||
olsr_print_lq_neighbor4 (const u_char *msg_data, u_int hello_len)
|
||||
olsr_print_lq_neighbor4(netdissect_options *ndo,
|
||||
const u_char *msg_data, u_int hello_len)
|
||||
{
|
||||
struct olsr_lq_neighbor4 *lq_neighbor;
|
||||
|
||||
@ -190,11 +188,11 @@ olsr_print_lq_neighbor4 (const u_char *msg_data, u_int hello_len)
|
||||
|
||||
lq_neighbor = (struct olsr_lq_neighbor4 *)msg_data;
|
||||
|
||||
printf("\n\t neighbor %s, link-quality %.2lf%%"
|
||||
ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2lf%%"
|
||||
", neighbor-link-quality %.2lf%%",
|
||||
ipaddr_string(lq_neighbor->neighbor),
|
||||
((double)lq_neighbor->link_quality/2.55),
|
||||
((double)lq_neighbor->neighbor_link_quality/2.55));
|
||||
((double)lq_neighbor->neighbor_link_quality/2.55)));
|
||||
|
||||
msg_data += sizeof(struct olsr_lq_neighbor4);
|
||||
hello_len -= sizeof(struct olsr_lq_neighbor4);
|
||||
@ -203,7 +201,8 @@ olsr_print_lq_neighbor4 (const u_char *msg_data, u_int hello_len)
|
||||
|
||||
#if INET6
|
||||
static void
|
||||
olsr_print_lq_neighbor6 (const u_char *msg_data, u_int hello_len)
|
||||
olsr_print_lq_neighbor6(netdissect_options *ndo,
|
||||
const u_char *msg_data, u_int hello_len)
|
||||
{
|
||||
struct olsr_lq_neighbor6 *lq_neighbor;
|
||||
|
||||
@ -211,11 +210,11 @@ olsr_print_lq_neighbor6 (const u_char *msg_data, u_int hello_len)
|
||||
|
||||
lq_neighbor = (struct olsr_lq_neighbor6 *)msg_data;
|
||||
|
||||
printf("\n\t neighbor %s, link-quality %.2lf%%"
|
||||
ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2lf%%"
|
||||
", neighbor-link-quality %.2lf%%",
|
||||
ip6addr_string(lq_neighbor->neighbor),
|
||||
((double)lq_neighbor->link_quality/2.55),
|
||||
((double)lq_neighbor->neighbor_link_quality/2.55));
|
||||
((double)lq_neighbor->neighbor_link_quality/2.55)));
|
||||
|
||||
msg_data += sizeof(struct olsr_lq_neighbor6);
|
||||
hello_len -= sizeof(struct olsr_lq_neighbor6);
|
||||
@ -227,19 +226,20 @@ olsr_print_lq_neighbor6 (const u_char *msg_data, u_int hello_len)
|
||||
* print a neighbor list.
|
||||
*/
|
||||
static void
|
||||
olsr_print_neighbor (const u_char *msg_data, u_int hello_len)
|
||||
olsr_print_neighbor(netdissect_options *ndo,
|
||||
const u_char *msg_data, u_int hello_len)
|
||||
{
|
||||
int neighbor;
|
||||
|
||||
printf("\n\t neighbor\n\t\t");
|
||||
ND_PRINT((ndo, "\n\t neighbor\n\t\t"));
|
||||
neighbor = 1;
|
||||
|
||||
while (hello_len >= sizeof(struct in_addr)) {
|
||||
|
||||
/* print 4 neighbors per line */
|
||||
|
||||
printf("%s%s", ipaddr_string(msg_data),
|
||||
neighbor % 4 == 0 ? "\n\t\t" : " ");
|
||||
ND_PRINT((ndo, "%s%s", ipaddr_string(msg_data),
|
||||
neighbor % 4 == 0 ? "\n\t\t" : " "));
|
||||
|
||||
msg_data += sizeof(struct in_addr);
|
||||
hello_len -= sizeof(struct in_addr);
|
||||
@ -248,7 +248,8 @@ olsr_print_neighbor (const u_char *msg_data, u_int hello_len)
|
||||
|
||||
|
||||
void
|
||||
olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
olsr_print(netdissect_options *ndo,
|
||||
const u_char *pptr, u_int length, int is_ipv6)
|
||||
{
|
||||
union {
|
||||
const struct olsr_common *common;
|
||||
@ -272,24 +273,24 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
if (!TTEST2(*tptr, sizeof(struct olsr_common))) {
|
||||
if (!ND_TTEST2(*tptr, sizeof(struct olsr_common))) {
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
ptr.common = (struct olsr_common *)tptr;
|
||||
length = min(length, EXTRACT_16BITS(ptr.common->packet_len));
|
||||
|
||||
printf("OLSRv%i, seq 0x%04x, length %u",
|
||||
ND_PRINT((ndo, "OLSRv%i, seq 0x%04x, length %u",
|
||||
(is_ipv6 == 0) ? 4 : 6,
|
||||
EXTRACT_16BITS(ptr.common->packet_seq),
|
||||
length);
|
||||
length));
|
||||
|
||||
tptr += sizeof(struct olsr_common);
|
||||
|
||||
/*
|
||||
* In non-verbose mode, just print version.
|
||||
*/
|
||||
if (vflag < 1) {
|
||||
if (ndo->ndo_vflag < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -301,7 +302,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
} msgptr;
|
||||
int msg_len_valid = 0;
|
||||
|
||||
if (!TTEST2(*tptr, sizeof(struct olsr_msg4)))
|
||||
if (!ND_TTEST2(*tptr, sizeof(struct olsr_msg4)))
|
||||
goto trunc;
|
||||
|
||||
#if INET6
|
||||
@ -319,7 +320,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n\t%s Message (%#04x), originator %s, ttl %u, hop %u"
|
||||
ND_PRINT((ndo, "\n\t%s Message (%#04x), originator %s, ttl %u, hop %u"
|
||||
"\n\t vtime %.3lfs, msg-seq 0x%04x, length %u%s",
|
||||
tok2str(olsr_msg_values, "Unknown", msg_type),
|
||||
msg_type, ip6addr_string(msgptr.v6->originator),
|
||||
@ -327,7 +328,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
msgptr.v6->hopcount,
|
||||
ME_TO_DOUBLE(msgptr.v6->vtime),
|
||||
EXTRACT_16BITS(msgptr.v6->msg_seq),
|
||||
msg_len, (msg_len_valid == 0) ? " (invalid)" : "");
|
||||
msg_len, (msg_len_valid == 0) ? " (invalid)" : ""));
|
||||
|
||||
msg_tlen = msg_len - sizeof(struct olsr_msg6);
|
||||
msg_data = tptr + sizeof(struct olsr_msg6);
|
||||
@ -347,7 +348,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n\t%s Message (%#04x), originator %s, ttl %u, hop %u"
|
||||
ND_PRINT((ndo, "\n\t%s Message (%#04x), originator %s, ttl %u, hop %u"
|
||||
"\n\t vtime %.3lfs, msg-seq 0x%04x, length %u%s",
|
||||
tok2str(olsr_msg_values, "Unknown", msg_type),
|
||||
msg_type, ipaddr_string(msgptr.v4->originator),
|
||||
@ -355,7 +356,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
msgptr.v4->hopcount,
|
||||
ME_TO_DOUBLE(msgptr.v4->vtime),
|
||||
EXTRACT_16BITS(msgptr.v4->msg_seq),
|
||||
msg_len, (msg_len_valid == 0) ? " (invalid)" : "");
|
||||
msg_len, (msg_len_valid == 0) ? " (invalid)" : ""));
|
||||
|
||||
msg_tlen = msg_len - sizeof(struct olsr_msg4);
|
||||
msg_data = tptr + sizeof(struct olsr_msg4);
|
||||
@ -364,12 +365,12 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
switch (msg_type) {
|
||||
case OLSR_HELLO_MSG:
|
||||
case OLSR_HELLO_LQ_MSG:
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hello)))
|
||||
if (!ND_TTEST2(*msg_data, sizeof(struct olsr_hello)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hello = (struct olsr_hello *)msg_data;
|
||||
printf("\n\t hello-time %.3lfs, MPR willingness %u",
|
||||
ME_TO_DOUBLE(ptr.hello->htime), ptr.hello->will);
|
||||
ND_PRINT((ndo, "\n\t hello-time %.3lfs, MPR willingness %u",
|
||||
ME_TO_DOUBLE(ptr.hello->htime), ptr.hello->will));
|
||||
msg_data += sizeof(struct olsr_hello);
|
||||
msg_tlen -= sizeof(struct olsr_hello);
|
||||
|
||||
@ -379,7 +380,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
/*
|
||||
* link-type.
|
||||
*/
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hello_link)))
|
||||
if (!ND_TTEST2(*msg_data, sizeof(struct olsr_hello_link)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hello_link = (struct olsr_hello_link *)msg_data;
|
||||
@ -392,11 +393,11 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
&& (hello_len >= sizeof(struct olsr_hello_link)))
|
||||
hello_len_valid = 1;
|
||||
|
||||
printf("\n\t link-type %s, neighbor-type %s, len %u%s",
|
||||
ND_PRINT((ndo, "\n\t link-type %s, neighbor-type %s, len %u%s",
|
||||
tok2str(olsr_link_type_values, "Unknown", link_type),
|
||||
tok2str(olsr_neighbor_type_values, "Unknown", neighbor_type),
|
||||
hello_len,
|
||||
(hello_len_valid == 0) ? " (invalid)" : "");
|
||||
(hello_len_valid == 0) ? " (invalid)" : ""));
|
||||
|
||||
if (hello_len_valid == 0)
|
||||
break;
|
||||
@ -406,14 +407,14 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
hello_len -= sizeof(struct olsr_hello_link);
|
||||
|
||||
if (msg_type == OLSR_HELLO_MSG) {
|
||||
olsr_print_neighbor(msg_data, hello_len);
|
||||
olsr_print_neighbor(ndo, msg_data, hello_len);
|
||||
} else {
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
olsr_print_lq_neighbor6(msg_data, hello_len);
|
||||
olsr_print_lq_neighbor6(ndo, msg_data, hello_len);
|
||||
else
|
||||
#endif
|
||||
olsr_print_lq_neighbor4(msg_data, hello_len);
|
||||
olsr_print_lq_neighbor4(ndo, msg_data, hello_len);
|
||||
}
|
||||
|
||||
msg_data += hello_len;
|
||||
@ -423,24 +424,24 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
|
||||
case OLSR_TC_MSG:
|
||||
case OLSR_TC_LQ_MSG:
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_tc)))
|
||||
if (!ND_TTEST2(*msg_data, sizeof(struct olsr_tc)))
|
||||
goto trunc;
|
||||
|
||||
ptr.tc = (struct olsr_tc *)msg_data;
|
||||
printf("\n\t advertised neighbor seq 0x%04x",
|
||||
EXTRACT_16BITS(ptr.tc->ans_seq));
|
||||
ND_PRINT((ndo, "\n\t advertised neighbor seq 0x%04x",
|
||||
EXTRACT_16BITS(ptr.tc->ans_seq)));
|
||||
msg_data += sizeof(struct olsr_tc);
|
||||
msg_tlen -= sizeof(struct olsr_tc);
|
||||
|
||||
if (msg_type == OLSR_TC_MSG) {
|
||||
olsr_print_neighbor(msg_data, msg_tlen);
|
||||
olsr_print_neighbor(ndo, msg_data, msg_tlen);
|
||||
} else {
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
olsr_print_lq_neighbor6(msg_data, msg_tlen);
|
||||
olsr_print_lq_neighbor6(ndo, msg_data, msg_tlen);
|
||||
else
|
||||
#endif
|
||||
olsr_print_lq_neighbor4(msg_data, msg_tlen);
|
||||
olsr_print_lq_neighbor4(ndo, msg_data, msg_tlen);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -454,14 +455,14 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
#endif
|
||||
|
||||
while (msg_tlen >= addr_size) {
|
||||
if (!TTEST2(*msg_data, addr_size))
|
||||
if (!ND_TTEST2(*msg_data, addr_size))
|
||||
goto trunc;
|
||||
|
||||
printf("\n\t interface address %s",
|
||||
ND_PRINT((ndo, "\n\t interface address %s",
|
||||
#if INET6
|
||||
is_ipv6 ? ip6addr_string(msg_data) :
|
||||
#endif
|
||||
ipaddr_string(msg_data));
|
||||
ipaddr_string(msg_data)));
|
||||
msg_data += addr_size;
|
||||
msg_tlen -= addr_size;
|
||||
}
|
||||
@ -469,8 +470,8 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
}
|
||||
|
||||
case OLSR_HNA_MSG:
|
||||
printf("\n\t Advertised networks (total %u)",
|
||||
(unsigned int) (msg_tlen / sizeof(struct olsr_hna6)));
|
||||
ND_PRINT((ndo, "\n\t Advertised networks (total %u)",
|
||||
(unsigned int) (msg_tlen / sizeof(struct olsr_hna6))));
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
{
|
||||
@ -478,14 +479,14 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
while (msg_tlen >= sizeof(struct olsr_hna6)) {
|
||||
struct olsr_hna6 *hna6;
|
||||
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hna6)))
|
||||
if (!ND_TTEST2(*msg_data, sizeof(struct olsr_hna6)))
|
||||
goto trunc;
|
||||
|
||||
hna6 = (struct olsr_hna6 *)msg_data;
|
||||
|
||||
printf("\n\t #%i: %s/%u",
|
||||
ND_PRINT((ndo, "\n\t #%i: %s/%u",
|
||||
i, ip6addr_string(hna6->network),
|
||||
mask62plen (hna6->mask));
|
||||
mask62plen (hna6->mask)));
|
||||
|
||||
msg_data += sizeof(struct olsr_hna6);
|
||||
msg_tlen -= sizeof(struct olsr_hna6);
|
||||
@ -496,7 +497,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
{
|
||||
int col = 0;
|
||||
while (msg_tlen >= sizeof(struct olsr_hna4)) {
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hna4)))
|
||||
if (!ND_TTEST2(*msg_data, sizeof(struct olsr_hna4)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hna = (struct olsr_hna4 *)msg_data;
|
||||
@ -507,9 +508,9 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
else
|
||||
printf (", ");
|
||||
|
||||
printf("%s/%u",
|
||||
ND_PRINT((ndo, "%s/%u",
|
||||
ipaddr_string(ptr.hna->network),
|
||||
mask2plen(EXTRACT_32BITS(ptr.hna->mask)));
|
||||
mask2plen(EXTRACT_32BITS(ptr.hna->mask))));
|
||||
|
||||
msg_data += sizeof(struct olsr_hna4);
|
||||
msg_tlen -= sizeof(struct olsr_hna4);
|
||||
@ -535,12 +536,12 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
|
||||
if (msg_tlen < 4)
|
||||
goto trunc;
|
||||
if (!TTEST2(*msg_data, 4))
|
||||
if (!ND_TTEST2(*msg_data, 4))
|
||||
goto trunc;
|
||||
|
||||
printf("\n\t Version %u, Entries %u%s",
|
||||
ND_PRINT((ndo, "\n\t Version %u, Entries %u%s",
|
||||
EXTRACT_16BITS(msg_data),
|
||||
name_entries, (name_entries_valid == 0) ? " (invalid)" : "");
|
||||
name_entries, (name_entries_valid == 0) ? " (invalid)" : ""));
|
||||
|
||||
if (name_entries_valid == 0)
|
||||
break;
|
||||
@ -553,7 +554,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
|
||||
if (msg_tlen < 4)
|
||||
break;
|
||||
if (!TTEST2(*msg_data, 4))
|
||||
if (!ND_TTEST2(*msg_data, 4))
|
||||
goto trunc;
|
||||
|
||||
name_entry_type = EXTRACT_16BITS(msg_data);
|
||||
@ -565,9 +566,9 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
if ((name_entry_len > 0) && ((addr_size + name_entry_len) <= msg_tlen))
|
||||
name_entry_len_valid = 1;
|
||||
|
||||
printf("\n\t #%u: type %#06x, length %u%s",
|
||||
ND_PRINT((ndo, "\n\t #%u: type %#06x, length %u%s",
|
||||
(unsigned int) i, name_entry_type,
|
||||
name_entry_len, (name_entry_len_valid == 0) ? " (invalid)" : "");
|
||||
name_entry_len, (name_entry_len_valid == 0) ? " (invalid)" : ""));
|
||||
|
||||
if (name_entry_len_valid == 0)
|
||||
break;
|
||||
@ -580,19 +581,19 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
if (msg_tlen < addr_size + name_entry_len + name_entry_padding)
|
||||
goto trunc;
|
||||
|
||||
if (!TTEST2(*msg_data, addr_size + name_entry_len + name_entry_padding))
|
||||
if (!ND_TTEST2(*msg_data, addr_size + name_entry_len + name_entry_padding))
|
||||
goto trunc;
|
||||
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
printf(", address %s, name \"",
|
||||
ip6addr_string(msg_data));
|
||||
ND_PRINT((ndo, ", address %s, name \"",
|
||||
ip6addr_string(msg_data)));
|
||||
else
|
||||
#endif
|
||||
printf(", address %s, name \"",
|
||||
ipaddr_string(msg_data));
|
||||
ND_PRINT((ndo, ", address %s, name \"",
|
||||
ipaddr_string(msg_data)));
|
||||
fn_printn(msg_data + addr_size, name_entry_len, NULL);
|
||||
printf("\"");
|
||||
ND_PRINT((ndo, "\""));
|
||||
|
||||
msg_data += addr_size + name_entry_len + name_entry_padding;
|
||||
msg_tlen -= addr_size + name_entry_len + name_entry_padding;
|
||||
@ -606,7 +607,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
*/
|
||||
case OLSR_POWERINFO_MSG:
|
||||
default:
|
||||
print_unknown_data(gndo,msg_data, "\n\t ", msg_tlen);
|
||||
print_unknown_data(ndo, msg_data, "\n\t ", msg_tlen);
|
||||
break;
|
||||
} /* switch (msg_type) */
|
||||
tptr += msg_len;
|
||||
@ -615,7 +616,7 @@ olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|olsr]");
|
||||
ND_PRINT((ndo, "[|olsr]"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -567,7 +567,7 @@ void sctp_print(netdissect_options *ndo,
|
||||
return;
|
||||
}
|
||||
|
||||
forces_print(payloadPtr, EXTRACT_16BITS(&chunkDescPtr->chunkLength)- chunksize);
|
||||
forces_print(ndo, payloadPtr, EXTRACT_16BITS(&chunkDescPtr->chunkLength)- chunksize);
|
||||
} else if (ndo->ndo_vflag >= 2) { /* if verbose output is specified */
|
||||
/* at the command line */
|
||||
const u_char *payloadPtr;
|
||||
|
@ -645,14 +645,14 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
|
||||
else if (ISPORT(LDP_PORT))
|
||||
ldp_print(ndo, (const u_char *)(up + 1), length);
|
||||
else if (ISPORT(OLSR_PORT))
|
||||
olsr_print((const u_char *)(up + 1), length,
|
||||
olsr_print(ndo, (const u_char *)(up + 1), length,
|
||||
#if INET6
|
||||
(IP_V(ip) == 6) ? 1 : 0);
|
||||
#else
|
||||
0);
|
||||
#endif
|
||||
else if (ISPORT(MPLS_LSP_PING_PORT))
|
||||
lspping_print((const u_char *)(up + 1), length);
|
||||
lspping_print(ndo, (const u_char *)(up + 1), length);
|
||||
else if (dport == BFD_CONTROL_PORT ||
|
||||
dport == BFD_ECHO_PORT )
|
||||
bfd_print(ndo, (const u_char *)(up+1), length, dport);
|
||||
|
Loading…
Reference in New Issue
Block a user