Commit 23f92684 authored by Alessandro Rubini's avatar Alessandro Rubini

tools: fix ptpdump to only dump one interface

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <>
parent f5dbcdd3
......@@ -55,6 +55,7 @@ int main(int argc, char **argv)
int sock, ret;
struct packet_mreq req;
struct sockaddr_ll addr;
struct ifreq ifr;
char *ifname = "eth0";
......@@ -73,12 +74,25 @@ int main(int argc, char **argv)
ifname, strerror(errno));
memset(&addr, 0, sizeof(addr));
addr.sll_family = AF_PACKET;
addr.sll_protocol = htons(ETH_P_ALL); /* ETH_P_1588, but also vlan */
addr.sll_ifindex = ifr.ifr_ifindex;
addr.sll_pkttype = PACKET_MULTICAST;
if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
fprintf(stderr, "%s: bind(%s)): %s\n", argv[0],
ifname, strerror(errno));
fprintf(stderr, "Dumping PTP packets from interface \"%s\"\n", ifname);
memset(&req, 0, sizeof(req));
req.mr_ifindex = ifr.ifr_ifindex;
req.mr_type = PACKET_MR_PROMISC;
&req, sizeof(req)) < 0) {
fprintf(stderr, "%s: set promiscuous(%s): %s\n", argv[0],
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment