Commit e15c8882 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[master] Add assertion to test that cmsg != NULL

The assert() should silence clang-analyer.
parent ccdbcf02
......@@ -727,6 +727,13 @@ IfaceMgr::send(const Pkt6Ptr& pkt) {
m.msg_control = &control_buf_[0];
m.msg_controllen = control_buf_len_;
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&m);
// FIXME: Code below assumes that cmsg is not NULL, but
// CMSG_FIRSTHDR() is coded to return NULL as a possibility. The
// following assertion should never fail, but if it did and you came
// here, fix the code. :)
assert(cmsg != NULL);
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
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