/* * netsniff-ng - the packet sniffing beast * Copyright 2009, 2010 Daniel Borkmann. * Subject to the GPL, version 2. */ #include #include #include /* for ntohs() */ #include "proto.h" #include "protos.h" #include "csum.h" #include "dissector_eth.h" #include "pkt_buff.h" #include "built_in.h" struct icmphdr { uint8_t type; uint8_t code; uint16_t checksum; union { struct { uint16_t id; uint16_t sequence; } echo; uint32_t gateway; struct { uint16_t ____unused; uint16_t mtu; } frag; } un; } __packed; static void icmp(struct pkt_buff *pkt) { struct icmphdr *icmp = (struct icmphdr *) pkt_pull(pkt, sizeof(*icmp)); uint16_t csum; if (icmp == NULL) return; csum = calc_csum(icmp, pkt_len(pkt) + sizeof(*icmp), 0); tprintf(" [ ICMP "); tprintf("Type (%u), ", icmp->type); tprintf("Code (%u), ", icmp->code); tprintf("CSum (0x%.4x) is %s", ntohs(icmp->checksum), csum ? colorize_start_full(black, red) "bogus (!)" colorize_end() : "ok"); tprintf(" ]\n"); } static void icmp_less(struct pkt_buff *pkt) { struct icmphdr *icmp = (struct icmphdr *) pkt_pull(pkt, sizeof(*icmp)); if (icmp == NULL) return; tprintf(" Type %u Code %u", icmp->type, icmp->code); } struct protocol icmpv4_ops = { .key = 0x01, .print_full = icmp, .print_less = icmp_less, }; -pump-back net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Yang <yang_philip@projectara.com>2016-08-31 11:11:18 +0800
committerGreg Kroah-Hartman <gregkh@google.com>2016-09-02 14:13:39 +0200
commit4e013b64c1ee3a60438caa0df6bf79664e0272bc (patch)
tree0beb3ffb4af912f0bdf40329442a946d44bf68d3 /drivers/staging/greybus
parent6a57ddc97acb2a1d37ce94a237dc0fab2e5a3f5b (diff)
greybus: power_supply: Add runtime pm support
Modify Power_supply greybus driver to support runtime PM framework. During charging state, the driver will block remote device of suspending, and then enables runtime suspend when remote device is in none chargin state. Testing Done: Compiled and verified on EVT2, EVT2 1x2 GPB test module and Device class daughter board. Signed-off-by: Philip Yang <yang_philip@projectara.com> Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus')