]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Print AppleTalk layer-3 network numbers as 16-bit unsigned decimal numbers.
authorGuy Harris <[email protected]>
Mon, 16 Aug 2010 22:02:12 +0000 (15:02 -0700)
committerGuy Harris <[email protected]>
Mon, 16 Aug 2010 22:02:12 +0000 (15:02 -0700)
Pick up from FreeBSD:

  revision 1.3
  date: 1996/09/11 06:18:26;  author: pst;  state: Exp;  lines: +9 -12
  branches:  1.3.2;
  Print appletalk layer 3 addresses as 16 bit unsigned decimal numbers,
  not two 8 bit values.  This conforms to industry standard.

  These changes have been sent back to LBL.

Inside AppleTalk(R), Second Edition speaks of node numbers as 16-bit.

print-atalk.c

index fe51cba0b5cf19b18e9ad7e5c8e3fcbad1324513..995fcff5a9dfb0e54f3db65da61883d2953b43cd 100644 (file)
@@ -543,26 +543,24 @@ ataddr_string(u_short atnet, u_char athost)
        if (first && (first = 0, !nflag)
            && (fp = fopen("/etc/atalk.names", "r"))) {
                char line[256];
-               int i1, i2, i3;
+               int i1, i2;
 
                while (fgets(line, sizeof(line), fp)) {
                        if (line[0] == '\n' || line[0] == 0 || line[0] == '#')
                                continue;
-                       if (sscanf(line, "%d.%d.%d %256s", &i1, &i2, &i3,
-                                    nambuf) == 4)
+                       if (sscanf(line, "%d.%d %256s", &i1, &i2, nambuf) == 3)
                                /* got a hostname. */
-                               i3 |= ((i1 << 8) | i2) << 8;
-                       else if (sscanf(line, "%d.%d %256s", &i1, &i2,
-                                       nambuf) == 3)
+                               i2 |= (i1 << 8);
+                       else if (sscanf(line, "%d %256s", &i1, nambuf) == 2)
                                /* got a net name */
-                               i3 = (((i1 << 8) | i2) << 8) | 255;
+                               i2 = (i1 << 8) | 255;
                        else
                                continue;
 
-                       for (tp = &hnametable[i3 & (HASHNAMESIZE-1)];
+                       for (tp = &hnametable[i2 & (HASHNAMESIZE-1)];
                             tp->nxt; tp = tp->nxt)
                                ;
-                       tp->addr = i3;
+                       tp->addr = i2;
                        tp->nxt = newhnamemem();
                        tp->name = strdup(nambuf);
                }
@@ -588,11 +586,9 @@ ataddr_string(u_short atnet, u_char athost)
        tp->addr = (atnet << 8) | athost;
        tp->nxt = newhnamemem();
        if (athost != 255)
-               (void)snprintf(nambuf, sizeof(nambuf), "%d.%d.%d",
-                   atnet >> 8, atnet & 0xff, athost);
+               (void)snprintf(nambuf, sizeof(nambuf), "%d.%d", atnet, athost);
        else
-               (void)snprintf(nambuf, sizeof(nambuf), "%d.%d", atnet >> 8,
-                   atnet & 0xff);
+               (void)snprintf(nambuf, sizeof(nambuf), "%d", atnet);
        tp->name = strdup(nambuf);
 
        return (tp->name);