]> granicus.if.org Git - strace/commitdiff
decode packet options
authorWichert Akkerman <wichert@deephackmode.org>
Mon, 1 Apr 2002 12:48:06 +0000 (12:48 +0000)
committerWichert Akkerman <wichert@deephackmode.org>
Mon, 1 Apr 2002 12:48:06 +0000 (12:48 +0000)
ChangeLog
net.c

index e09cf619a3c10da379e37746ac77ea1c15f3e049..db8bdfe2b0f6f7cb503b197e756817a80ee5327c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-04-01  Wichert Akkerman <wichert@deephackmode.org>
+
+       * net.c: decode packet options
+
 2002-03-31  Wichert Akkerman <wichert@deephackmode.org>
 
        * linux/{alpha,hppa,ia64,mips,powerpc,sparc}/syscallent.h: regenerated
diff --git a/net.c b/net.c
index 3da89945d7d535f2b14d27692dbb6981a164f7f5..068f84cfba9be3d01ca9e704866fab237d8ce238 100644 (file)
--- a/net.c
+++ b/net.c
@@ -597,6 +597,33 @@ static struct xlat icmpfilterflags[] = {
 };
 #endif /* SOL_RAW */
 
+#if defined(AF_PACKET) /* from e.g. linux/if_packet.h */
+static struct xlat af_packet_types[] = {
+#if defined(PACKET_HOST)
+       { PACKET_HOST,                  "PACKET_HOST"           },
+#endif
+#if defined(PACKET_BROADCAST)
+       { PACKET_BROADCAST,             "PACKET_BROADCAST"      },
+#endif
+#if defined(PACKET_MULTICAST)
+       { PACKET_MULTICAST,             "PACKET_MULTICAST"      },
+#endif
+#if defined(PACKET_OTHERHOST)
+       { PACKET_OTHERHOST,             "PACKET_OTHERHOST"      },
+#endif
+#if defined(PACKET_OUTGOING)
+       { PACKET_OUTGOING,              "PACKET_OUTGOING"       },
+#endif
+#if defined(PACKET_LOOPBACK)
+       { PACKET_LOOPBACK,              "PACKET_LOOPBACK"       },
+#endif
+#if defined(PACKET_FASTROUTE)
+       { PACKET_FASTROUTE,             "PACKET_FASTROUTE"      },
+#endif
+       { 0,                            NULL                    },
+};
+#endif /* defined(AF_PACKET) */
+
 
 void
 printsock(tcp, addr, addrlen)
@@ -709,13 +736,14 @@ int addrlen;
        case AF_PACKET:
                {
                        int i;
-                       tprintf("proto=%#04x, if%d, pkttype=%d, addr(%d)={%d, ",
+                       tprintf("proto=%#04x, if%d, pkttype=",
                                        ntohs(addrbuf.ll.sll_protocol),
-                                       addrbuf.ll.sll_ifindex,
-                                       addrbuf.ll.sll_pkttype,
+                                       addrbuf.ll.sll_ifindex);
+                       printxval(af_packet_types, addrbuf.ll.sll_pkttype, "?");
+                       tprintf(", addr(%d)={%d, ",
                                        addrbuf.ll.sll_halen,
                                        addrbuf.ll.sll_hatype);
-                       for (i=0; i<addrbuf.ll.sll_addr[i]; i++) 
+                       for (i=0; i<addrbuf.ll.sll_halen; i++) 
                                tprintf("%02x", addrbuf.ll.sll_addr[i]);
                }
                break;