Add define for nlmsg_types with timestamp
Add #define for nlmsg_type = 15 Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
This commit is contained in:
parent
ff041f1619
commit
27b14f2e87
|
|
@ -74,14 +74,12 @@ static int accept_msg(const struct sockaddr_nl *who,
|
||||||
fprintf(fp, "[MDB]");
|
fprintf(fp, "[MDB]");
|
||||||
return print_mdb(who, n, arg);
|
return print_mdb(who, n, arg);
|
||||||
|
|
||||||
case 15:
|
case NLMSG_TSTAMP:
|
||||||
return show_mark(fp, n);
|
return show_mark(fp, n);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_monitor(int argc, char **argv)
|
int do_monitor(int argc, char **argv)
|
||||||
|
|
|
||||||
|
|
@ -158,5 +158,9 @@ extern int rtnl_from_file(FILE *, rtnl_filter_t handler,
|
||||||
#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
|
#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* User defined nlmsg_type which is used mostly for logging netlink
|
||||||
|
* messages from dump file */
|
||||||
|
#define NLMSG_TSTAMP 15
|
||||||
|
|
||||||
#endif /* __LIBNETLINK_H__ */
|
#endif /* __LIBNETLINK_H__ */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ static int accept_msg(const struct sockaddr_nl *who,
|
||||||
print_netconf(who, n, arg);
|
print_netconf(who, n, arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (n->nlmsg_type == 15) {
|
if (n->nlmsg_type == NLMSG_TSTAMP) {
|
||||||
char *tstr;
|
char *tstr;
|
||||||
time_t secs = ((__u32*)NLMSG_DATA(n))[0];
|
time_t secs = ((__u32*)NLMSG_DATA(n))[0];
|
||||||
long usecs = ((__u32*)NLMSG_DATA(n))[1];
|
long usecs = ((__u32*)NLMSG_DATA(n))[1];
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ static void write_stamp(FILE *fp)
|
||||||
struct nlmsghdr *n1 = (void*)buf;
|
struct nlmsghdr *n1 = (void*)buf;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
n1->nlmsg_type = 15;
|
n1->nlmsg_type = NLMSG_TSTAMP;
|
||||||
n1->nlmsg_flags = 0;
|
n1->nlmsg_flags = 0;
|
||||||
n1->nlmsg_seq = 0;
|
n1->nlmsg_seq = 0;
|
||||||
n1->nlmsg_pid = 0;
|
n1->nlmsg_pid = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue