/* * netsniff-ng - the packet sniffing beast * Copyright 2009 - 2013 Daniel Borkmann. * Subject to the GPL, version 2. */ #ifndef DISSECTOR_H #define DISSECTOR_H #include #include #include "ring.h" #include "tprintf.h" #include "pcap_io.h" #define PRINT_NORM 0 #define PRINT_LESS 1 #define PRINT_HEX 2 #define PRINT_ASCII 3 #define PRINT_HEX_ASCII 4 #define PRINT_NONE 5 static const char * const packet_types[256]={ "<", /* Incoming */ "B", /* Broadcast */ "M", /* Multicast */ "P", /* Promisc */ ">", /* Outgoing */ "?", /* Unknown */ }; extern char *if_indextoname(unsigned ifindex, char *ifname); static inline void show_frame_hdr(struct frame_map *hdr, int mode) { char tmp[IFNAMSIZ]; if (mode == PRINT_NONE) return; switch (mode) { case PRINT_LESS: tprintf("%s %s %u", packet_types[hdr->s_ll.sll_pkttype] ? : "?", if_indextoname(hdr->s_ll.sll_ifindex, tmp) ? : "?", hdr->tp_h.tp_len); break; default: tprintf("%s %s %u %us.%uns\n", packet_types[hdr->s_ll.sll_pkttype] ? : "?", if_indextoname(hdr->s_ll.sll_ifindex, tmp) ? : "?", hdr->tp_h.tp_len, hdr->tp_h.tp_sec, hdr->tp_h.tp_nsec); break; } } extern void dissector_init_all(int fnttype); extern void dissector_entry_point(uint8_t *packet, size_t len, int linktype, int mode); extern void dissector_cleanup_all(void); extern int dissector_set_print_type(void *ptr, int type); #endif /* DISSECTOR_H */ plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-09-03 10:39:51 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-09-03 12:10:37 -0400
commitbf0291dd2267a2b9a4cd74d65249553d11bb45d6 (patch)
tree2d96c81ac142ac7c9462d4cdae731f60e26d2100
parentc49edecd513693ea7530ab18efbd7d6d5b7cbf90 (diff)
pNFS: Ensure LAYOUTGET and LAYOUTRETURN are properly serialised
According to RFC5661, the client is responsible for serialising LAYOUTGET and LAYOUTRETURN to avoid ambiguity. Consider the case where we send both in parallel. Client Server ====== ====== LAYOUTGET(seqid=X) LAYOUTRETURN(seqid=X) LAYOUTGET return seqid=X+1 LAYOUTRETURN return seqid=X+2 Process LAYOUTRETURN Forget layout stateid Process LAYOUTGET Set seqid=X+1 The client processes the layoutget/layoutreturn in the wrong order, and since the result of the layoutreturn was to clear the only existing layout segment, the client forgets the layout stateid. When the LAYOUTGET comes in, it is treated as having a completely new stateid, and so the client sets the wrong sequence id... Fix is to check if there are outstanding LAYOUTGET requests before we send the LAYOUTRETURN (note that LAYOUGET will already wait if it sees an outstanding LAYOUTRETURN). Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Cc: stable@vger.kernel.org # v4.5+ Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>