/* * netsniff-ng - the packet sniffing beast * Copyright 2014 Tobias Klauser. * Subject to the GPL, version 2. */ #include #include #include #include #include "pkt_buff.h" #include "proto.h" static void nlmsg(struct pkt_buff *pkt) { struct nlmsghdr *hdr = (struct nlmsghdr *) pkt_pull(pkt, sizeof(*hdr)); char type[32]; char flags[128]; char procname[1024]; if (hdr == NULL) return; /* Look up the process name if message is not coming from the kernel. * * Note that the port id is not necessarily equal to the PID of the * receiving process (e.g. if the application is multithreaded or using * multiple sockets). In these cases we're not able to find a matching * PID and the information will not be printed. */ if (hdr->nlmsg_pid != 0) { char path[1024]; int ret; snprintf(path, sizeof(path), "/proc/%u/exe", hdr->nlmsg_pid); ret = readlink(path, procname, sizeof(procname) - 1); if (ret < 0) procname[0] = '\0'; } else snprintf(procname, sizeof(procname), "kernel"); tprintf(" [ NLMSG "); tprintf("Len %u, ", hdr->nlmsg_len); tprintf("Type 0x%.4x (%s%s%s), ", hdr->nlmsg_type, colorize_start(bold), nl_nlmsgtype2str(hdr->nlmsg_type, type, sizeof(type)), colorize_end()); tprintf("Flags 0x%.4x (%s%s%s), ", hdr->nlmsg_flags, colorize_start(bold), nl_nlmsg_flags2str(hdr->nlmsg_flags, flags, sizeof(flags)), colorize_end()); tprintf("Seq-Nr %u, ", hdr->nlmsg_seq); tprintf("PID %u", hdr->nlmsg_pid); if (procname[0]) tprintf(" (%s%s%s)", colorize_start(bold), basename(procname), colorize_end()); tprintf(" ]\n"); } static void nlmsg_less(struct pkt_buff *pkt) { struct nlmsghdr *hdr = (struct nlmsghdr *) pkt_pull(pkt, sizeof(*hdr)); char type[32]; if (hdr == NULL) return; tprintf(" NLMSG %u (%s%s%s)", hdr->nlmsg_type, colorize_start(bold), nl_nlmsgtype2str(hdr->nlmsg_type, type, sizeof(type)), colorize_end()); } struct protocol nlmsg_ops = { .print_full = nlmsg, .print_less = nlmsg_less, }; b07ad2bb'>commitdiff
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2017-01-29 21:00:48 -0800
committerOlof Johansson <olof@lixom.net>2017-01-29 21:00:48 -0800
commit0a019a28e0ca0af7dc2691d1a9527960b07ad2bb (patch)
tree5ee1db9aacacd6af6701fb290e8a294ef3cc2bf2 /net/ipv4/tcp_dctcp.c
parentec026b5020688a8bde5fae9a69ae3c59b66ba3ae (diff)
parent8413299cb3933dade6186bbee8363f190032107e (diff)
Merge tag 'sti-dt-for-v4.10-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/pchotard/sti into fixes
STi DT fix: Since v4.10-rc1, xhci is complaining in loop with : [ 801.953836] usb usb6-port1: Cannot enable. Maybe the USB cable is bad? [ 801.960455] xhci-hcd xhci-hcd.0.auto: Cannot set link state. [ 801.966611] usb usb6-port1: cannot disable (err = -32) set property "snps,dis_u3_susphy_quirk" in DT fix it. * tag 'sti-dt-for-v4.10-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/pchotard/sti: ARM: dts: STiH407-family: set snps,dis_u3_susphy_quirk Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'net/ipv4/tcp_dctcp.c')