From 96920d5c73b957c95ca3dede47ea7070778595c6 Mon Sep 17 00:00:00 2001 From: itojun Date: Wed, 9 May 2001 02:43:40 +0000 Subject: [PATCH] support draft-draves-ipngwg-router-selection-01.txt router preference. from jinmei --- print-icmp6.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/print-icmp6.c b/print-icmp6.c index d0bad1ea..860f8a96 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.47 2001-05-09 01:08:03 fenner Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.48 2001-05-09 02:43:40 itojun Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -65,6 +65,13 @@ void icmp6_rrenum_print(int, const u_char *, const u_char *); #define abs(a) ((0 < (a)) ? (a) : -(a)) #endif +static char *rtpref_str[] = { + "medium", /* 00 */ + "high", /* 01 */ + "rsv", /* 10 */ + "low" /* 11 */ +}; + void icmp6_print(register const u_char *bp, register const u_char *bp2) { @@ -224,6 +231,7 @@ icmp6_print(register const u_char *bp, register const u_char *bp2) printf("icmp6: router advertisement"); if (vflag) { struct nd_router_advert *p; + int rtpref; p = (struct nd_router_advert *)dp; TCHECK(p->nd_ra_retransmit); @@ -237,8 +245,17 @@ icmp6_print(register const u_char *bp, register const u_char *bp2) #endif if (p->nd_ra_flags_reserved & ND_RA_FLAG_HA) printf("H"); - if (p->nd_ra_flags_reserved != 0) +#ifndef ND_RA_FLAG_RTPREF_MASK +#define ND_RA_FLAG_RTPREF_MASK 0x18 +#endif + + if ((p->nd_ra_flags_reserved & ~ND_RA_FLAG_RTPREF_MASK) + != 0) printf(" "); + + rtpref = ((p->nd_ra_flags_reserved & ND_RA_FLAG_RTPREF_MASK) >> 3) & 0xff; + printf("pref=%s, ", rtpref_str[rtpref]); + printf("router_ltime=%d, ", ntohs(p->nd_ra_router_lifetime)); printf("reachable_time=%u, ", (u_int32_t)ntohl(p->nd_ra_reachable));