Skip to content
Browse files

Use the correct EtherType for logging IPv6 packets.

Reviewed by:	melifaro
Approved by:	re (kib, glebius)
MFC after:	3 days
  • Loading branch information...
1 parent e112eec commit eb3631100bf76c92971c7d24886264812747a789 @ppaeps ppaeps committed Sep 28, 2013
Showing with 9 additions and 2 deletions.
  1. +9 −2 sys/netpfil/ipfw/ip_fw_log.c
View
11 sys/netpfil/ipfw/ip_fw_log.c
@@ -255,11 +255,18 @@ ipfw_log(struct ip_fw *f, u_int hlen, struct ip_fw_args *args,
if (args->eh) /* layer2, use orig hdr */
BPF_MTAP2(log_if, args->eh, ETHER_HDR_LEN, m);
- else
+ else {
/* Add fake header. Later we will store
* more info in the header.
*/
- BPF_MTAP2(log_if, "DDDDDDSSSSSS\x08\x00", ETHER_HDR_LEN, m);
+ if (ip->ip_v == 4)
+ BPF_MTAP2(log_if, "DDDDDDSSSSSS\x08\x00", ETHER_HDR_LEN, m);
+ else if (ip->ip_v == 6)
+ BPF_MTAP2(log_if, "DDDDDDSSSSSS\x86\xdd", ETHER_HDR_LEN, m);
+ else
+ /* Obviously bogus EtherType. */
+ BPF_MTAP2(log_if, "DDDDDDSSSSSS\xff\xff", ETHER_HDR_LEN, m);
+ }
LOGIF_RUNLOCK();
#endif /* !WITHOUT_BPF */
return;

0 comments on commit eb36311

Please sign in to comment.
Something went wrong with that request. Please try again.