* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.216 2003-10-27 10:13:45 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.217 2003-11-05 06:02:58 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
extern void msdp_print(const unsigned char *, u_int);
extern void nfsreply_print(const u_char *, u_int, const u_char *);
extern void nfsreq_print(const u_char *, u_int, const u_char *);
-extern void ns_print(const u_char *, u_int);
+extern void ns_print(const u_char *, u_int, int);
extern void ntp_print(const u_char *, u_int);
extern u_int null_if_print(const struct pcap_pkthdr *, const u_char *);
extern void ospf_print(const u_char *, u_int, const u_char *);
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.85 2003-09-25 22:30:22 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.86 2003-11-05 06:03:00 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
/* print a query */
static const u_char *
-ns_qprint(register const u_char *cp, register const u_char *bp)
+ns_qprint(register const u_char *cp, register const u_char *bp, int is_mdns)
{
register const u_char *np = cp;
register u_int i;
printf(" %s", tok2str(ns_type2str, "Type%d", i));
i = EXTRACT_16BITS(cp);
cp += 2;
- if (i != C_IN)
+ if (is_mdns && i == (C_IN|C_CACHE_FLUSH))
+ printf(" (Cache flush)");
+ else if (i != C_IN)
printf(" %s", tok2str(ns_class2str, "(Class %d)", i));
fputs("? ", stdout);
/* print a reply */
static const u_char *
-ns_rprint(register const u_char *cp, register const u_char *bp)
+ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
{
register u_int class;
register u_short typ, len;
cp += 2;
class = EXTRACT_16BITS(cp);
cp += 2;
- if (class != C_IN && typ != T_OPT)
+ if (is_mdns && class == (C_IN|C_CACHE_FLUSH))
+ printf(" (Cache flush)");
+ else if (class != C_IN && typ != T_OPT)
printf(" %s", tok2str(ns_class2str, "(Class %d)", class));
/* ignore ttl */
}
void
-ns_print(register const u_char *bp, u_int length)
+ns_print(register const u_char *bp, u_int length, int is_mdns)
{
register const HEADER *np;
register int qdcount, ancount, nscount, arcount;
putchar(',');
if (vflag > 1) {
fputs(" q:", stdout);
- if ((cp = ns_qprint(cp, bp)) == NULL)
+ if ((cp = ns_qprint(cp, bp, is_mdns)) == NULL)
goto trunc;
} else {
if ((cp = ns_nskip(cp)) == NULL)
}
printf(" %d/%d/%d", ancount, nscount, arcount);
if (ancount--) {
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && ancount--) {
putchar(',');
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
if (vflag > 1) {
if (cp < snapend && nscount--) {
fputs(" ns:", stdout);
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && nscount--) {
putchar(',');
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
goto trunc;
if (cp < snapend && arcount--) {
fputs(" ar:", stdout);
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && arcount--) {
putchar(',');
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
cp = (const u_char *)(np + 1);
if (qdcount--) {
- cp = ns_qprint(cp, (const u_char *)np);
+ cp = ns_qprint(cp, (const u_char *)np, is_mdns);
if (!cp)
goto trunc;
while (cp < snapend && qdcount--) {
cp = ns_qprint((const u_char *)cp,
- (const u_char *)np);
+ (const u_char *)np,
+ is_mdns);
if (!cp)
goto trunc;
}
/* Print remaining sections on -vv */
if (vflag > 1) {
if (ancount--) {
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && ancount--) {
putchar(',');
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
goto trunc;
if (cp < snapend && nscount--) {
fputs(" ns:", stdout);
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (nscount-- && cp < snapend) {
putchar(',');
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
goto trunc;
if (cp < snapend && arcount--) {
fputs(" ar:", stdout);
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && arcount--) {
putchar(',');
- if ((cp = ns_rprint(cp, bp)) == NULL)
+ if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}