2 * netsniff-ng - the packet sniffing beast
3 * Subject to the GPL, version 2.
10 #include "dissector.h"
11 #include "dissector_sll.h"
12 #include "dissector_eth.h"
14 static char *pkt_type2str(uint8_t pkttype
)
19 case PACKET_BROADCAST
:
21 case PACKET_MULTICAST
:
23 case PACKET_OTHERHOST
:
36 static void sll_print_full(struct pkt_buff
*pkt
)
38 struct sockaddr_ll
*sll
= pkt
->sll
;
39 char addr_str
[40] = {};
44 tprintf(" [ Linux \"cooked\"");
45 tprintf(" Pkt Type %d (%s)", sll
->sll_pkttype
,
46 pkt_type2str(sll
->sll_pkttype
));
47 tprintf(", If Type %d (%s)", sll
->sll_hatype
,
48 device_type2str(sll
->sll_hatype
));
49 tprintf(", Addr Len %d", sll
->sll_halen
);
50 tprintf(", Src (%s)", device_addr2str(sll
->sll_addr
, sll
->sll_halen
,
51 sll
->sll_hatype
, addr_str
, sizeof(addr_str
)));
52 tprintf(", Proto 0x%x", ntohs(sll
->sll_protocol
));
55 switch (pcap_devtype_to_linktype(sll
->sll_hatype
)) {
57 case ___constant_swab32(LINKTYPE_EN10MB
):
58 pkt_set_dissector(pkt
, ð_lay2
, ntohs(sll
->sll_protocol
));
60 case LINKTYPE_NETLINK
:
61 case ___constant_swab32(LINKTYPE_NETLINK
):
62 pkt
->dissector
= &nlmsg_ops
;
65 tprintf(" [ Uknown protocol ]\n");
69 static void sll_print_less(struct pkt_buff
*pkt
)
71 struct sockaddr_ll
*sll
= pkt
->sll
;
72 char addr_str
[40] = {};
77 tprintf(" Pkt Type %d (%s)", sll
->sll_pkttype
,
78 pkt_type2str(sll
->sll_pkttype
));
79 tprintf(", If Type %d (%s)", sll
->sll_hatype
,
80 device_type2str(sll
->sll_hatype
));
81 tprintf(", Addr Len %d", sll
->sll_halen
);
82 tprintf(", Src (%s)", device_addr2str(sll
->sll_addr
, sll
->sll_halen
,
83 sll
->sll_hatype
, addr_str
, sizeof(addr_str
)));
84 tprintf(", Proto 0x%x", ntohs(sll
->sll_protocol
));
87 struct protocol sll_ops
= {
89 .print_full
= sll_print_full
,
90 .print_less
= sll_print_less
,
93 struct protocol
*dissector_get_sll_entry_point(void)
98 struct protocol
*dissector_get_sll_exit_point(void)
103 void dissector_init_sll(int fnttype
)
105 dissector_set_print_type(&sll_ops
, fnttype
);
106 dissector_set_print_type(&none_ops
, fnttype
);
107 dissector_init_oui();
110 void dissector_cleanup_sll(void)
112 dissector_cleanup_oui();