print-bootp.c (75118) | print-bootp.c (98527) |
---|---|
1/* 2 * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 6 unchanged lines hidden (view full) --- 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * Format and print bootp packets. 22 * | 1/* 2 * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 6 unchanged lines hidden (view full) --- 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * Format and print bootp packets. 22 * |
23 * $FreeBSD: head/contrib/tcpdump/print-bootp.c 75118 2001-04-03 07:50:46Z fenner $ | 23 * $FreeBSD: head/contrib/tcpdump/print-bootp.c 98527 2002-06-21 00:49:02Z fenner $ |
24 */ 25#ifndef lint 26static const char rcsid[] = | 24 */ 25#ifndef lint 26static const char rcsid[] = |
27 "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.56 2000/12/04 00:00:08 fenner Exp $ (LBL)"; | 27 "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.60 2001/09/17 21:57:56 fenner Exp $ (LBL)"; |
28#endif 29 30#ifdef HAVE_CONFIG_H 31#include "config.h" 32#endif 33 34#include <sys/param.h> 35#include <sys/time.h> --- 9 unchanged lines hidden (view full) --- 45#include <string.h> 46 47#include "interface.h" 48#include "addrtoname.h" 49#include "extract.h" 50#include "ether.h" 51#include "bootp.h" 52 | 28#endif 29 30#ifdef HAVE_CONFIG_H 31#include "config.h" 32#endif 33 34#include <sys/param.h> 35#include <sys/time.h> --- 9 unchanged lines hidden (view full) --- 45#include <string.h> 46 47#include "interface.h" 48#include "addrtoname.h" 49#include "extract.h" 50#include "ether.h" 51#include "bootp.h" 52 |
53static void rfc1048_print(const u_char *, u_int); 54static void cmu_print(const u_char *, u_int); | 53static void rfc1048_print(const u_char *); 54static void cmu_print(const u_char *); |
55 56static char tstr[] = " [|bootp]"; 57 58/* 59 * Print bootp requests 60 */ 61void 62bootp_print(register const u_char *cp, u_int length, 63 u_short sport, u_short dport) 64{ 65 register const struct bootp *bp; | 55 56static char tstr[] = " [|bootp]"; 57 58/* 59 * Print bootp requests 60 */ 61void 62bootp_print(register const u_char *cp, u_int length, 63 u_short sport, u_short dport) 64{ 65 register const struct bootp *bp; |
66 static u_char vm_cmu[4] = VM_CMU; 67 static u_char vm_rfc1048[4] = VM_RFC1048; | 66 static const u_char vm_cmu[4] = VM_CMU; 67 static const u_char vm_rfc1048[4] = VM_RFC1048; |
68 | 68 |
69 bp = (struct bootp *)cp; | 69 bp = (const struct bootp *)cp; |
70 TCHECK(bp->bp_op); 71 switch (bp->bp_op) { 72 73 case BOOTREQUEST: 74 /* Usually, a request goes from a client to a server */ 75 if (sport != IPPORT_BOOTPC || dport != IPPORT_BOOTPS) 76 printf(" (request)"); 77 break; --- 49 unchanged lines hidden (view full) --- 127 printf(" G:%s", ipaddr_string(&bp->bp_giaddr)); 128 129 /* Client's Ethernet address */ 130 if (bp->bp_htype == 1 && bp->bp_hlen == 6) { 131 register const struct ether_header *eh; 132 register const char *e; 133 134 TCHECK2(bp->bp_chaddr[0], 6); | 70 TCHECK(bp->bp_op); 71 switch (bp->bp_op) { 72 73 case BOOTREQUEST: 74 /* Usually, a request goes from a client to a server */ 75 if (sport != IPPORT_BOOTPC || dport != IPPORT_BOOTPS) 76 printf(" (request)"); 77 break; --- 49 unchanged lines hidden (view full) --- 127 printf(" G:%s", ipaddr_string(&bp->bp_giaddr)); 128 129 /* Client's Ethernet address */ 130 if (bp->bp_htype == 1 && bp->bp_hlen == 6) { 131 register const struct ether_header *eh; 132 register const char *e; 133 134 TCHECK2(bp->bp_chaddr[0], 6); |
135 eh = (struct ether_header *)packetp; | 135 eh = (const struct ether_header *)packetp; |
136 if (bp->bp_op == BOOTREQUEST) 137 e = (const char *)ESRC(eh); 138 else if (bp->bp_op == BOOTREPLY) 139 e = (const char *)EDST(eh); 140 else 141 e = 0; | 136 if (bp->bp_op == BOOTREQUEST) 137 e = (const char *)ESRC(eh); 138 else if (bp->bp_op == BOOTREPLY) 139 e = (const char *)EDST(eh); 140 else 141 e = 0; |
142 if (e == 0 || memcmp((char *)bp->bp_chaddr, e, 6) != 0) | 142 if (e == 0 || memcmp((const char *)bp->bp_chaddr, e, 6) != 0) |
143 printf(" ether %s", etheraddr_string(bp->bp_chaddr)); 144 } 145 146 TCHECK2(bp->bp_sname[0], 1); /* check first char only */ 147 if (*bp->bp_sname) { 148 printf(" sname \""); 149 if (fn_print(bp->bp_sname, snapend)) { 150 putchar('"'); --- 10 unchanged lines hidden (view full) --- 161 fputs(tstr + 1, stdout); 162 return; 163 } 164 putchar('"'); 165 } 166 167 /* Decode the vendor buffer */ 168 TCHECK(bp->bp_vend[0]); | 143 printf(" ether %s", etheraddr_string(bp->bp_chaddr)); 144 } 145 146 TCHECK2(bp->bp_sname[0], 1); /* check first char only */ 147 if (*bp->bp_sname) { 148 printf(" sname \""); 149 if (fn_print(bp->bp_sname, snapend)) { 150 putchar('"'); --- 10 unchanged lines hidden (view full) --- 161 fputs(tstr + 1, stdout); 162 return; 163 } 164 putchar('"'); 165 } 166 167 /* Decode the vendor buffer */ 168 TCHECK(bp->bp_vend[0]); |
169 length -= sizeof(*bp) - sizeof(bp->bp_vend); 170 if (memcmp((char *)bp->bp_vend, (char *)vm_rfc1048, | 169 if (memcmp((const char *)bp->bp_vend, vm_rfc1048, |
171 sizeof(u_int32_t)) == 0) | 170 sizeof(u_int32_t)) == 0) |
172 rfc1048_print(bp->bp_vend, length); 173 else if (memcmp((char *)bp->bp_vend, (char *)vm_cmu, | 171 rfc1048_print(bp->bp_vend); 172 else if (memcmp((const char *)bp->bp_vend, vm_cmu, |
174 sizeof(u_int32_t)) == 0) | 173 sizeof(u_int32_t)) == 0) |
175 cmu_print(bp->bp_vend, length); | 174 cmu_print(bp->bp_vend); |
176 else { 177 u_int32_t ul; 178 179 ul = EXTRACT_32BITS(&bp->bp_vend); 180 if (ul != 0) 181 printf("vend-#0x%x", ul); 182 } 183 184 return; 185trunc: 186 fputs(tstr, stdout); 187} 188 | 175 else { 176 u_int32_t ul; 177 178 ul = EXTRACT_32BITS(&bp->bp_vend); 179 if (ul != 0) 180 printf("vend-#0x%x", ul); 181 } 182 183 return; 184trunc: 185 fputs(tstr, stdout); 186} 187 |
189/* The first character specifies the format to print */ | 188/* 189 * The first character specifies the format to print: 190 * i - ip address (32 bits) 191 * p - ip address pairs (32 bits + 32 bits) 192 * l - long (32 bits) 193 * L - unsigned long (32 bits) 194 * s - short (16 bits) 195 * b - period-seperated decimal bytes (variable length) 196 * x - colon-seperated hex bytes (variable length) 197 * a - ascii string (variable length) 198 * B - on/off (8 bits) 199 * $ - special (explicit code to handle) 200 */ |
190static struct tok tag2str[] = { 191/* RFC1048 tags */ 192 { TAG_PAD, " PAD" }, 193 { TAG_SUBNET_MASK, "iSM" }, /* subnet mask (RFC950) */ 194 { TAG_TIME_OFFSET, "LTZ" }, /* seconds from UTC */ 195 { TAG_GATEWAY, "iDG" }, /* default gateway */ 196 { TAG_TIME_SERVER, "iTS" }, /* time servers (RFC868) */ 197 { TAG_NAME_SERVER, "iIEN" }, /* IEN name servers (IEN116) */ --- 35 unchanged lines hidden (view full) --- 233 { TAG_TCP_KEEPALIVE, "lKI" }, 234 { TAG_KEEPALIVE_GO, "BKG" }, 235 { TAG_NIS_DOMAIN, "aYD" }, 236 { TAG_NIS_SERVERS, "iYS" }, 237 { TAG_NTP_SERVERS, "iNTP" }, 238 { TAG_VENDOR_OPTS, "bVO" }, 239 { TAG_NETBIOS_NS, "iWNS" }, 240 { TAG_NETBIOS_DDS, "iWDD" }, | 201static struct tok tag2str[] = { 202/* RFC1048 tags */ 203 { TAG_PAD, " PAD" }, 204 { TAG_SUBNET_MASK, "iSM" }, /* subnet mask (RFC950) */ 205 { TAG_TIME_OFFSET, "LTZ" }, /* seconds from UTC */ 206 { TAG_GATEWAY, "iDG" }, /* default gateway */ 207 { TAG_TIME_SERVER, "iTS" }, /* time servers (RFC868) */ 208 { TAG_NAME_SERVER, "iIEN" }, /* IEN name servers (IEN116) */ --- 35 unchanged lines hidden (view full) --- 244 { TAG_TCP_KEEPALIVE, "lKI" }, 245 { TAG_KEEPALIVE_GO, "BKG" }, 246 { TAG_NIS_DOMAIN, "aYD" }, 247 { TAG_NIS_SERVERS, "iYS" }, 248 { TAG_NTP_SERVERS, "iNTP" }, 249 { TAG_VENDOR_OPTS, "bVO" }, 250 { TAG_NETBIOS_NS, "iWNS" }, 251 { TAG_NETBIOS_DDS, "iWDD" }, |
241 { TAG_NETBIOS_NODE, "bWNT" }, | 252 { TAG_NETBIOS_NODE, "$WNT" }, |
242 { TAG_NETBIOS_SCOPE, "aWSC" }, 243 { TAG_XWIN_FS, "iXFS" }, 244 { TAG_XWIN_DM, "iXDM" }, 245 { TAG_NIS_P_DOMAIN, "sN+D" }, 246 { TAG_NIS_P_SERVERS, "iN+S" }, 247 { TAG_MOBILE_HOME, "iMH" }, 248 { TAG_SMPT_SERVER, "iSMTP" }, 249 { TAG_POP3_SERVER, "iPOP3" }, 250 { TAG_NNTP_SERVER, "iNNTP" }, 251 { TAG_WWW_SERVER, "iWWW" }, 252 { TAG_FINGER_SERVER, "iFG" }, 253 { TAG_IRC_SERVER, "iIRC" }, 254 { TAG_STREETTALK_SRVR, "iSTS" }, 255 { TAG_STREETTALK_STDA, "iSTDA" }, 256 { TAG_REQUESTED_IP, "iRQ" }, 257 { TAG_IP_LEASE, "lLT" }, | 253 { TAG_NETBIOS_SCOPE, "aWSC" }, 254 { TAG_XWIN_FS, "iXFS" }, 255 { TAG_XWIN_DM, "iXDM" }, 256 { TAG_NIS_P_DOMAIN, "sN+D" }, 257 { TAG_NIS_P_SERVERS, "iN+S" }, 258 { TAG_MOBILE_HOME, "iMH" }, 259 { TAG_SMPT_SERVER, "iSMTP" }, 260 { TAG_POP3_SERVER, "iPOP3" }, 261 { TAG_NNTP_SERVER, "iNNTP" }, 262 { TAG_WWW_SERVER, "iWWW" }, 263 { TAG_FINGER_SERVER, "iFG" }, 264 { TAG_IRC_SERVER, "iIRC" }, 265 { TAG_STREETTALK_SRVR, "iSTS" }, 266 { TAG_STREETTALK_STDA, "iSTDA" }, 267 { TAG_REQUESTED_IP, "iRQ" }, 268 { TAG_IP_LEASE, "lLT" }, |
258 { TAG_OPT_OVERLOAD, "bOO" }, | 269 { TAG_OPT_OVERLOAD, "$OO" }, |
259 { TAG_TFTP_SERVER, "aTFTP" }, 260 { TAG_BOOTFILENAME, "aBF" }, 261 { TAG_DHCP_MESSAGE, " DHCP" }, 262 { TAG_SERVER_ID, "iSID" }, 263 { TAG_PARM_REQUEST, "bPR" }, 264 { TAG_MESSAGE, "aMSG" }, 265 { TAG_MAX_MSG_SIZE, "sMSZ" }, 266 { TAG_RENEWAL_TIME, "lRN" }, 267 { TAG_REBIND_TIME, "lRB" }, | 270 { TAG_TFTP_SERVER, "aTFTP" }, 271 { TAG_BOOTFILENAME, "aBF" }, 272 { TAG_DHCP_MESSAGE, " DHCP" }, 273 { TAG_SERVER_ID, "iSID" }, 274 { TAG_PARM_REQUEST, "bPR" }, 275 { TAG_MESSAGE, "aMSG" }, 276 { TAG_MAX_MSG_SIZE, "sMSZ" }, 277 { TAG_RENEWAL_TIME, "lRN" }, 278 { TAG_REBIND_TIME, "lRB" }, |
268 { TAG_VENDOR_CLASS, "bVC" }, 269 { TAG_CLIENT_ID, "xCID" }, | 279 { TAG_VENDOR_CLASS, "aVC" }, 280 { TAG_CLIENT_ID, "$CID" }, |
270/* RFC 2485 */ 271 { TAG_OPEN_GROUP_UAP, "aUAP" }, 272/* RFC 2563 */ 273 { TAG_DISABLE_AUTOCONF, "BNOAUTO" }, 274/* RFC 2610 */ 275 { TAG_SLP_DA, "bSLP-DA" }, /*"b" is a little wrong */ 276 { TAG_SLP_SCOPE, "bSLP-SCOPE" }, /*"b" is a little wrong */ 277/* RFC 2937 */ 278 { TAG_NS_SEARCH, "sNSSEARCH" }, /* XXX 's' */ 279/* RFC 3011 */ 280 { TAG_IP4_SUBNET_SELECT, "iSUBNET" }, 281/* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */ 282 { TAG_USER_CLASS, "aCLASS" }, 283 { TAG_SLP_NAMING_AUTH, "aSLP-NA" }, | 281/* RFC 2485 */ 282 { TAG_OPEN_GROUP_UAP, "aUAP" }, 283/* RFC 2563 */ 284 { TAG_DISABLE_AUTOCONF, "BNOAUTO" }, 285/* RFC 2610 */ 286 { TAG_SLP_DA, "bSLP-DA" }, /*"b" is a little wrong */ 287 { TAG_SLP_SCOPE, "bSLP-SCOPE" }, /*"b" is a little wrong */ 288/* RFC 2937 */ 289 { TAG_NS_SEARCH, "sNSSEARCH" }, /* XXX 's' */ 290/* RFC 3011 */ 291 { TAG_IP4_SUBNET_SELECT, "iSUBNET" }, 292/* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */ 293 { TAG_USER_CLASS, "aCLASS" }, 294 { TAG_SLP_NAMING_AUTH, "aSLP-NA" }, |
284 { TAG_CLIENT_FQDN, "bFQDN" }, /* XXX 'b' */ | 295 { TAG_CLIENT_FQDN, "$FQDN" }, |
285 { TAG_AGENT_CIRCUIT, "bACKT" }, 286 { TAG_AGENT_REMOTE, "bARMT" }, 287 { TAG_AGENT_MASK, "bAMSK" }, 288 { TAG_TZ_STRING, "aTZSTR" }, 289 { TAG_FQDN_OPTION, "bFQDNS" }, /* XXX 'b' */ 290 { TAG_AUTH, "bAUTH" }, /* XXX 'b' */ 291 { TAG_VINES_SERVERS, "iVINES" }, 292 { TAG_SERVER_RANK, "sRANK" }, --- 11 unchanged lines hidden (view full) --- 304 { TAG_FAILOVER, "bFAIL" }, /* XXX 'b' */ 305 { 0, NULL } 306}; 307/* 2-byte extended tags */ 308static struct tok xtag2str[] = { 309 { 0, NULL } 310}; 311 | 296 { TAG_AGENT_CIRCUIT, "bACKT" }, 297 { TAG_AGENT_REMOTE, "bARMT" }, 298 { TAG_AGENT_MASK, "bAMSK" }, 299 { TAG_TZ_STRING, "aTZSTR" }, 300 { TAG_FQDN_OPTION, "bFQDNS" }, /* XXX 'b' */ 301 { TAG_AUTH, "bAUTH" }, /* XXX 'b' */ 302 { TAG_VINES_SERVERS, "iVINES" }, 303 { TAG_SERVER_RANK, "sRANK" }, --- 11 unchanged lines hidden (view full) --- 315 { TAG_FAILOVER, "bFAIL" }, /* XXX 'b' */ 316 { 0, NULL } 317}; 318/* 2-byte extended tags */ 319static struct tok xtag2str[] = { 320 { 0, NULL } 321}; 322 |
323/* DHCP "options overload" types */ 324static struct tok oo2str[] = { 325 { 1, "file" }, 326 { 2, "sname" }, 327 { 3, "file+sname" }, 328 { 0, NULL } 329}; 330 331/* NETBIOS over TCP/IP node type options */ 332static struct tok nbo2str[] = { 333 { 0x1, "b-node" }, 334 { 0x2, "p-node" }, 335 { 0x4, "m-node" }, 336 { 0x8, "h-node" }, 337 { 0, NULL } 338}; 339 340/* ARP Hardware types, for Client-ID option */ 341static struct tok arp2str[] = { 342 { 0x1, "ether" }, 343 { 0x6, "ieee802" }, 344 { 0x7, "arcnet" }, 345 { 0xf, "frelay" }, 346 { 0x17, "strip" }, 347 { 0x18, "ieee1394" }, 348 { 0, NULL } 349}; 350 |
|
312static void | 351static void |
313rfc1048_print(register const u_char *bp, register u_int length) | 352rfc1048_print(register const u_char *bp) |
314{ 315 register u_char tag; 316 register u_int len, size; 317 register const char *cp; 318 register char c; 319 int first; 320 u_int32_t ul; 321 u_short us; --- 121 unchanged lines hidden (view full) --- 443 } 444 break; 445 446 case 'p': 447 /* IP address pairs */ 448 while (size >= 2*sizeof(ul)) { 449 if (!first) 450 putchar(','); | 353{ 354 register u_char tag; 355 register u_int len, size; 356 register const char *cp; 357 register char c; 358 int first; 359 u_int32_t ul; 360 u_short us; --- 121 unchanged lines hidden (view full) --- 482 } 483 break; 484 485 case 'p': 486 /* IP address pairs */ 487 while (size >= 2*sizeof(ul)) { 488 if (!first) 489 putchar(','); |
451 memcpy((char *)&ul, (char *)bp, sizeof(ul)); | 490 memcpy((char *)&ul, (const char *)bp, sizeof(ul)); |
452 printf("(%s:", ipaddr_string(&ul)); 453 bp += sizeof(ul); | 491 printf("(%s:", ipaddr_string(&ul)); 492 bp += sizeof(ul); |
454 memcpy((char *)&ul, (char *)bp, sizeof(ul)); | 493 memcpy((char *)&ul, (const char *)bp, sizeof(ul)); |
455 printf("%s)", ipaddr_string(&ul)); 456 bp += sizeof(ul); 457 size -= 2*sizeof(ul); 458 first = 0; 459 } 460 break; 461 462 case 's': --- 32 unchanged lines hidden (view full) --- 495 break; 496 497 case 'b': 498 case 'x': 499 default: 500 /* Bytes */ 501 while (size > 0) { 502 if (!first) | 494 printf("%s)", ipaddr_string(&ul)); 495 bp += sizeof(ul); 496 size -= 2*sizeof(ul); 497 first = 0; 498 } 499 break; 500 501 case 's': --- 32 unchanged lines hidden (view full) --- 534 break; 535 536 case 'b': 537 case 'x': 538 default: 539 /* Bytes */ 540 while (size > 0) { 541 if (!first) |
503 putchar (c == 'x' ? ':' : '.'); 504 printf (c == 'x' ? "%02x" : "%d", *bp); | 542 putchar(c == 'x' ? ':' : '.'); 543 if (c == 'x') 544 printf("%02x", *bp); 545 else 546 printf("%d", *bp); |
505 ++bp; 506 --size; 507 first = 0; 508 } 509 break; | 547 ++bp; 548 --size; 549 first = 0; 550 } 551 break; |
552 553 case '$': 554 /* Guys we can't handle with one of the usual cases */ 555 switch (tag) { 556 557 case TAG_NETBIOS_NODE: 558 tag = *bp++; 559 --size; 560 fputs(tok2str(nbo2str, NULL, tag), stdout); 561 break; 562 563 case TAG_OPT_OVERLOAD: 564 tag = *bp++; 565 --size; 566 fputs(tok2str(oo2str, NULL, tag), stdout); 567 break; 568 569 case TAG_CLIENT_FQDN: 570 if (*bp++) 571 printf("[svrreg]"); 572 if (*bp) 573 printf("%d/%d/", *bp, *(bp+1)); 574 bp += 2; 575 putchar('"'); 576 (void)fn_printn(bp, size - 3, NULL); 577 putchar('"'); 578 bp += size - 3; 579 size = 0; 580 break; 581 582 case TAG_CLIENT_ID: 583 { int type = *bp++; 584 size--; 585 if (type == 0) { 586 putchar('"'); 587 (void)fn_printn(bp, size, NULL); 588 putchar('"'); 589 break; 590 } else { 591 printf("[%s]", tok2str(arp2str, "type-%d", type)); 592 } 593 while (size > 0) { 594 if (!first) 595 putchar(':'); 596 printf("%02x", *bp); 597 ++bp; 598 --size; 599 first = 0; 600 } 601 break; 602 } 603 604 default: 605 printf("[unknown special tag %d, size %d]", 606 tag, size); 607 bp += size; 608 size = 0; 609 break; 610 } 611 break; |
|
510 } 511 /* Data left over? */ 512 if (size) 513 printf("[len %d]", len); 514 } 515 return; 516trunc: 517 printf("|[rfc1048]"); 518} 519 520static void | 612 } 613 /* Data left over? */ 614 if (size) 615 printf("[len %d]", len); 616 } 617 return; 618trunc: 619 printf("|[rfc1048]"); 620} 621 622static void |
521cmu_print(register const u_char *bp, register u_int length) | 623cmu_print(register const u_char *bp) |
522{ 523 register const struct cmu_vend *cmu; | 624{ 625 register const struct cmu_vend *cmu; |
524 char *fmt = " %s:%s"; | |
525 526#define PRINTCMUADDR(m, s) { TCHECK(cmu->m); \ 527 if (cmu->m.s_addr != 0) \ | 626 627#define PRINTCMUADDR(m, s) { TCHECK(cmu->m); \ 628 if (cmu->m.s_addr != 0) \ |
528 printf(fmt, s, ipaddr_string(&cmu->m.s_addr)); } | 629 printf(" %s:%s", s, ipaddr_string(&cmu->m.s_addr)); } |
529 530 printf(" vend-cmu"); | 630 631 printf(" vend-cmu"); |
531 cmu = (struct cmu_vend *)bp; | 632 cmu = (const struct cmu_vend *)bp; |
532 533 /* Only print if there are unknown bits */ 534 TCHECK(cmu->v_flags); 535 if ((cmu->v_flags & ~(VF_SMASK)) != 0) 536 printf(" F:0x%x", cmu->v_flags); 537 PRINTCMUADDR(v_dgate, "DG"); 538 PRINTCMUADDR(v_smask, cmu->v_flags & VF_SMASK ? "SM" : "SM*"); 539 PRINTCMUADDR(v_dns1, "NS1"); 540 PRINTCMUADDR(v_dns2, "NS2"); 541 PRINTCMUADDR(v_ins1, "IEN1"); 542 PRINTCMUADDR(v_ins2, "IEN2"); 543 PRINTCMUADDR(v_ts1, "TS1"); 544 PRINTCMUADDR(v_ts2, "TS2"); 545 return; 546 547trunc: 548 fputs(tstr, stdout); 549#undef PRINTCMUADDR 550} | 633 634 /* Only print if there are unknown bits */ 635 TCHECK(cmu->v_flags); 636 if ((cmu->v_flags & ~(VF_SMASK)) != 0) 637 printf(" F:0x%x", cmu->v_flags); 638 PRINTCMUADDR(v_dgate, "DG"); 639 PRINTCMUADDR(v_smask, cmu->v_flags & VF_SMASK ? "SM" : "SM*"); 640 PRINTCMUADDR(v_dns1, "NS1"); 641 PRINTCMUADDR(v_dns2, "NS2"); 642 PRINTCMUADDR(v_ins1, "IEN1"); 643 PRINTCMUADDR(v_ins2, "IEN2"); 644 PRINTCMUADDR(v_ts1, "TS1"); 645 PRINTCMUADDR(v_ts2, "TS2"); 646 return; 647 648trunc: 649 fputs(tstr, stdout); 650#undef PRINTCMUADDR 651} |