]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix getsockopt_cmsg_data retrieval
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 30 May 2018 20:04:57 +0000 (17:04 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 1 Aug 2018 12:42:16 +0000 (09:42 -0300)
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>
lib/sockopt.c

index 815be86c2e152eec3f943f4d87007ca25363e8a2..e979bef17401159ffaaa09277ad4d06c329410f9 100644 (file)
@@ -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;