From abcaad6b65ed368c13c353ed71619332f76d9c2a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 3 Apr 2010 13:06:20 +0200 Subject: check portid of received messages in examples netlink is not connection-oriented, we have to check the origin of the message. Signed-off-by: Pablo Neira Ayuso --- examples/rtnl-link-dump.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'examples/rtnl-link-dump.c') diff --git a/examples/rtnl-link-dump.c b/examples/rtnl-link-dump.c index 7cf061d..cc3fdf7 100644 --- a/examples/rtnl-link-dump.c +++ b/examples/rtnl-link-dump.c @@ -14,6 +14,10 @@ static int data_cb(const struct nlmsghdr *nlh, void *data) int len = mnl_nlmsg_get_len(nlh); struct nlattr *attr; + /* this does not come from the kernel. */ + if (nlh->nlmsg_pid != 0) + return MNL_CB_OK; + printf("index=%d type=%d flags=%d family=%d ", ifm->ifi_index, ifm->ifi_type, ifm->ifi_flags, ifm->ifi_family); -- cgit v1.2.3