-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathENETDUMP.C
57 lines (52 loc) · 1.26 KB
/
ENETDUMP.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* Ethernet header tracing routines
* Copyright 1991 Phil Karn, KA9Q
*/
/* Tracing to sockets, mods April '95 by Johan. K. Reinalda, WG7J */
#include "global.h"
#if defined PC_EC || defined PACKET
#include "mbuf.h"
#include "enet.h"
#include "trace.h"
#include "socket.h"
void
ether_dump(s,bpp,check)
int s;
struct mbuf **bpp;
int check; /* Not used */
{
struct ether ehdr;
char src[20],dest[20];
ntohether(&ehdr,bpp);
pether(src,ehdr.source);
pether(dest,ehdr.dest);
usprintf(s,"Ether: len %u %s->%s",ETHERLEN + len_p(*bpp),src,dest);
switch(ehdr.type){
case IP_TYPE:
usprintf(s," type IP\n");
ip_dump(s,bpp,1);
break;
case REVARP_TYPE:
usprintf(s," type REVARP\n");
arp_dump(s,bpp);
break;
case ARP_TYPE:
usprintf(s," type ARP\n");
arp_dump(s,bpp);
break;
default:
usprintf(s," type 0x%x\n",ehdr.type);
break;
}
}
int
ether_forus(iface,bp)
struct iface *iface;
struct mbuf *bp;
{
/* Just look at the multicast bit */
if(bp->data[0] & 1)
return 0;
else
return 1;
}
#endif /* PC_EC || PACKET */