summaryrefslogtreecommitdiffstats
path: root/lib/sockopt.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2018-05-30 22:04:57 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2018-08-01 14:42:16 +0200
commitdc094865dbf79b7b6da5499a284598aa5e4ca8a5 (patch)
tree35d190f485dba8ae7254e1f58ebaf7e6b75d1787 /lib/sockopt.c
parentMerge pull request #2763 from lyq140/master (diff)
downloadfrr-dc094865dbf79b7b6da5499a284598aa5e4ca8a5.tar.xz
frr-dc094865dbf79b7b6da5499a284598aa5e4ca8a5.zip
lib: fix getsockopt_cmsg_data retrieval
The `type` parameter was not being compared with `cmsg_type`, so the result of this function was always a pointer to the first header matching the level. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/sockopt.c')
-rw-r--r--lib/sockopt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c
index 815be86c2..e979bef17 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -75,7 +75,7 @@ static void *getsockopt_cmsg_data(struct msghdr *msgh, int level, int type)
for (cmsg = ZCMSG_FIRSTHDR(msgh); cmsg != NULL;
cmsg = CMSG_NXTHDR(msgh, cmsg))
- if (cmsg->cmsg_level == level && cmsg->cmsg_type)
+ if (cmsg->cmsg_level == level && cmsg->cmsg_type == type)
return (ptr = CMSG_DATA(cmsg));
return NULL;