From patchwork Wed Sep 18 19:58:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schmidt X-Patchwork-Id: 11151187 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E28AD16B1 for ; Wed, 18 Sep 2019 19:58:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CAA0E222CD for ; Wed, 18 Sep 2019 19:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731746AbfIRT6n (ORCPT ); Wed, 18 Sep 2019 15:58:43 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:46933 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731476AbfIRT6n (ORCPT ); Wed, 18 Sep 2019 15:58:43 -0400 Received: from localhost.localdomain (p200300E9D7197EFAD2D4565022F53F4F.dip0.t-ipconnect.de [IPv6:2003:e9:d719:7efa:d2d4:5650:22f5:3f4f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@sostec.de) by proxima.lasnet.de (Postfix) with ESMTPSA id B3B8FC1515; Wed, 18 Sep 2019 21:58:40 +0200 (CEST) From: Stefan Schmidt To: alex.aring@gmail.com Cc: linux-wpan@vger.kernel.org, Stefan Schmidt Subject: [PATCH rpld 1/6] build: test various names for our lua dependency Date: Wed, 18 Sep 2019 21:58:14 +0200 Message-Id: <20190918195819.7492-2-stefan@datenfreihafen.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918195819.7492-1-stefan@datenfreihafen.org> References: <20190918195819.7492-1-stefan@datenfreihafen.org> MIME-Version: 1.0 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org Distros name this differently in their pkgconfig files. This is a first attempt to cope with all of them. If we depend on a recent meson version at some later point we could handle this in a cleaner way by using the break keyword coming in 0.49 --- meson.build | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 8f2ccfe..70a2bc3 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,16 @@ else error('Couldn\'t find libev header / library') endif -luadep = dependency('lua5.3') +foreach name : ['lua', 'lua5.3', 'lua-5.3', 'lua53'] + dep = dependency(name, version: '>=5.3', required: false) + if dep.found() + luadep = dep + endif +endforeach +if not luadep.found() + error('Couldn\'t find Lua.') +endif + mnldep = dependency('libmnl') srcs = files( From patchwork Wed Sep 18 19:58:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schmidt X-Patchwork-Id: 11151189 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E45B13BD for ; Wed, 18 Sep 2019 19:58:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35C08222D0 for ; Wed, 18 Sep 2019 19:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732196AbfIRT6o (ORCPT ); Wed, 18 Sep 2019 15:58:44 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:46937 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731752AbfIRT6o (ORCPT ); Wed, 18 Sep 2019 15:58:44 -0400 Received: from localhost.localdomain (p200300E9D7197EFAD2D4565022F53F4F.dip0.t-ipconnect.de [IPv6:2003:e9:d719:7efa:d2d4:5650:22f5:3f4f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@sostec.de) by proxima.lasnet.de (Postfix) with ESMTPSA id CBB1DC151B; Wed, 18 Sep 2019 21:58:42 +0200 (CEST) From: Stefan Schmidt To: alex.aring@gmail.com Cc: linux-wpan@vger.kernel.org, Stefan Schmidt Subject: [PATCH rpld 2/6] send: make sure we check on scope id usage Date: Wed, 18 Sep 2019 21:58:15 +0200 Message-Id: <20190918195819.7492-3-stefan@datenfreihafen.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918195819.7492-1-stefan@datenfreihafen.org> References: <20190918195819.7492-1-stefan@datenfreihafen.org> MIME-Version: 1.0 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org It fails on my machine and likely fails on others, better check for it. --- send.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/send.c b/send.c index 97c566d..d026f6a 100644 --- a/send.c +++ b/send.c @@ -53,11 +53,9 @@ static int really_send(int sock, const struct iface *iface, pkt_info->ipi6_ifindex = iface->ifindex; memcpy(&pkt_info->ipi6_addr, iface->ifaddr_src, sizeof(struct in6_addr)); -#if 1 -//#ifdef HAVE_SIN6_SCOPE_ID +#ifdef HAVE_SIN6_SCOPE_ID if (IN6_IS_ADDR_LINKLOCAL(&addr.sin6_addr) || IN6_IS_ADDR_MC_LINKLOCAL(&addr.sin6_addr)) addr.sin6_scope_id = iface->ifindex; -//#endif #endif struct msghdr mhdr; From patchwork Wed Sep 18 19:58:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schmidt X-Patchwork-Id: 11151191 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DF3216B1 for ; Wed, 18 Sep 2019 19:58:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A897222CD for ; Wed, 18 Sep 2019 19:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727231AbfIRT65 (ORCPT ); Wed, 18 Sep 2019 15:58:57 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:46941 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387870AbfIRT65 (ORCPT ); Wed, 18 Sep 2019 15:58:57 -0400 Received: from localhost.localdomain (p200300E9D7197EFAD2D4565022F53F4F.dip0.t-ipconnect.de [IPv6:2003:e9:d719:7efa:d2d4:5650:22f5:3f4f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@sostec.de) by proxima.lasnet.de (Postfix) with ESMTPSA id 29280C14F9; Wed, 18 Sep 2019 21:58:54 +0200 (CEST) From: Stefan Schmidt To: alex.aring@gmail.com Cc: linux-wpan@vger.kernel.org, Stefan Schmidt Subject: [PATCH rpld 3/6] ci: travis: initial setup for CI testing with Travis Date: Wed, 18 Sep 2019 21:58:16 +0200 Message-Id: <20190918195819.7492-4-stefan@datenfreihafen.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918195819.7492-1-stefan@datenfreihafen.org> References: <20190918195819.7492-1-stefan@datenfreihafen.org> MIME-Version: 1.0 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org Basic setup of building with gcc and clang, as well as using Coverity scan service. --- .travis.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0bbefea --- /dev/null +++ b/.travis.yml @@ -0,0 +1,38 @@ +env: + global: + # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created + # via the "travis encrypt" command using the project repo's public key + - secure: "H2LC/vR1TNyECl8K1MJnvBay7je0NO4hzVdxk1TanJM4Cjo66Bdf+iMsIWW9KifTWlF+I8ATC8yrweGm02b9FqKSl7gBEPpgOev3q/IXlcU5HHqP+TDrGnn4aLFVYDiTjNYI39TpouUEQBN5cbDljN0GlYFyrXQkP28rvnhGyvvF65t0yQWRXrE1vlAeXq/1/IK/DwMams5YmGAVanH9TtOfePomAGtFtpiryHSgrZugyC03W6eiIzmJ2jzIJ6Wkykv1ASy1v2MEC5xl0YYOpZM1EF8hfScqKbA5Vn1JwM6yrGmDbjwFZCEYBj8N8EPAaZFXj6VNtJoaRB9jnO9Im1GqnD6TuYVc4caXYSrgxT7nMZhFe/Jt9y2mVsy5/nngJjZ5me3hLJlWuRgWDfo9hi02U6K8GkoHNumejGzOikErqGPVp4+aEFy3qr1sElWXgVYQP0/nKHGtciLnE3g2Tbt3mNEAakv+38Rh2zu2icn6vAXD5o4tlr7B86YUaSZlWVNr3LmW/GCZazdcR+I8zAwwo7Tj66pDvdejAe4s8yotOJw1/TMnBvJTO2w+ngggSoo/Ftp6AfdvNWqNBLV8h62uHjL5rXQh/Nx2lE3pA4PyN4mJegFPvqUSAdQurk+JZbfeP9HJ1R3CvP34LNsqoRWziKvv895xxjD3vjlJ7s8=" + +notifications: + irc: "chat.freenode.net#linux-wpan" + +language: c + +dist: bionic +sudo: true + +compiler: + - clang + - gcc + +addons: + apt: + packages: + - libev-dev + - liblua5.3-dev + - libmnl-dev + - meson + - ninja-build + coverity_scan: + project: + name: "linux-wpan/rpld" + description: "Build submitted via Travis CI" + notification_email: stefan@datenfreihafen.org + build_command_prepend: "rm -rf build && mkdir build && meson build" + build_command: "ninja -C build" + branch_pattern: coverity_scan + +script: + - rm -rf build && mkdir build && meson build . + - ninja -C build From patchwork Wed Sep 18 19:58:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schmidt X-Patchwork-Id: 11151193 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32D7416B1 for ; Wed, 18 Sep 2019 19:58:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12227222CD for ; Wed, 18 Sep 2019 19:58:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387870AbfIRT66 (ORCPT ); Wed, 18 Sep 2019 15:58:58 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:46943 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389132AbfIRT66 (ORCPT ); Wed, 18 Sep 2019 15:58:58 -0400 Received: from localhost.localdomain (p200300E9D7197EFAD2D4565022F53F4F.dip0.t-ipconnect.de [IPv6:2003:e9:d719:7efa:d2d4:5650:22f5:3f4f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@sostec.de) by proxima.lasnet.de (Postfix) with ESMTPSA id 7473BC151A; Wed, 18 Sep 2019 21:58:56 +0200 (CEST) From: Stefan Schmidt To: alex.aring@gmail.com Cc: linux-wpan@vger.kernel.org, Stefan Schmidt Subject: [PATCH rpld 4/6] config : fix leaks on error paths Date: Wed, 18 Sep 2019 21:58:17 +0200 Message-Id: <20190918195819.7492-5-stefan@datenfreihafen.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918195819.7492-1-stefan@datenfreihafen.org> References: <20190918195819.7492-1-stefan@datenfreihafen.org> MIME-Version: 1.0 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org We should make sure to free resources also on an error path. Address sanitizer was really helpfull in findings and fixing these leaks. --- config.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/config.c b/config.c index 66567c8..58526d7 100644 --- a/config.c +++ b/config.c @@ -167,6 +167,7 @@ static struct iface *iface_create() static void iface_free(struct iface *iface) { free(iface->ifaddrs); + free(iface->llinfo.addr); free(iface); } @@ -299,12 +300,17 @@ int config_load(const char *filename, struct list_head *ifaces) lua_pushnil(L); while (lua_next(L, -2) != 0) { iface = iface_create(); - if (!iface) + if (!iface) { + lua_close(L); return -1; + } lua_getfield(L, -1, "ifname"); - if (!lua_isstring(L, -1)) + if (!lua_isstring(L, -1)) { + iface_free(iface); + lua_close(L); return -1; + } strncpy(iface->ifname, lua_tostring(L, -1), IFNAMSIZ); lua_pop(L, 1); @@ -320,28 +326,38 @@ int config_load(const char *filename, struct list_head *ifaces) #endif if (rc == -1) { flog(LOG_ERR, "Failed to set forwarding"); + iface_free(iface); + lua_close(L); return -1; } iface->ifindex = if_nametoindex(iface->ifname); if (iface->ifindex == 0) { flog(LOG_ERR, "%s not found: %s", iface->ifname, strerror(errno)); + iface_free(iface); + lua_close(L); return -1; } nl_get_llinfo(iface->ifindex, &iface->llinfo); rc = get_iface_addrs(iface->ifname, &iface->ifaddr, &iface->ifaddrs); - if (rc == -1) + if (rc == -1) { + iface_free(iface); + lua_close(L); return rc; + } /* TODO because compression might be different here... */ iface->ifaddr_src = &iface->ifaddr; iface->ifaddrs_count = rc; lua_getfield(L, -1, "dodag_root"); - if (!lua_isboolean(L, -1)) + if (!lua_isboolean(L, -1)) { + iface_free(iface); + lua_close(L); return -1; + } iface->dodag_root = lua_toboolean(L, -1); lua_pop(L, 1); From patchwork Wed Sep 18 19:58:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schmidt X-Patchwork-Id: 11151195 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F7C313BD for ; Wed, 18 Sep 2019 19:58:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7ED3A222D0 for ; Wed, 18 Sep 2019 19:58:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732231AbfIRT67 (ORCPT ); Wed, 18 Sep 2019 15:58:59 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:46946 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729601AbfIRT67 (ORCPT ); Wed, 18 Sep 2019 15:58:59 -0400 Received: from localhost.localdomain (p200300E9D7197EFAD2D4565022F53F4F.dip0.t-ipconnect.de [IPv6:2003:e9:d719:7efa:d2d4:5650:22f5:3f4f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@sostec.de) by proxima.lasnet.de (Postfix) with ESMTPSA id 08596C151F; Wed, 18 Sep 2019 21:58:56 +0200 (CEST) From: Stefan Schmidt To: alex.aring@gmail.com Cc: linux-wpan@vger.kernel.org, Stefan Schmidt Subject: [PATCH rpld 5/6] socket: make sure we close our socket if setsockopt() fails Date: Wed, 18 Sep 2019 21:58:18 +0200 Message-Id: <20190918195819.7492-6-stefan@datenfreihafen.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918195819.7492-1-stefan@datenfreihafen.org> References: <20190918195819.7492-1-stefan@datenfreihafen.org> MIME-Version: 1.0 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org If any of our setsockopt() calls fails we returned a -1 but kept the socket available. Fixes Coverity ID 250804 --- socket.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/socket.c b/socket.c index 866b544..e6bbb52 100644 --- a/socket.c +++ b/socket.c @@ -92,30 +92,35 @@ int open_icmpv6_socket(const struct list_head *ifaces) err = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, (int[]){1}, sizeof(int)); if (err < 0) { flog(LOG_ERR, "setsockopt(IPV6_RECVPKTINFO): %s", strerror(errno)); + close(sock); return -1; } err = setsockopt(sock, IPPROTO_RAW, IPV6_CHECKSUM, (int[]){2}, sizeof(int)); if (err < 0) { flog(LOG_ERR, "setsockopt(IPV6_CHECKSUM): %s", strerror(errno)); + close(sock); return -1; } err = setsockopt(sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (int[]){255}, sizeof(int)); if (err < 0) { flog(LOG_ERR, "setsockopt(IPV6_UNICAST_HOPS): %s", strerror(errno)); + close(sock); return -1; } err = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (int[]){1}, sizeof(int)); if (err < 0) { flog(LOG_ERR, "setsockopt(IPV6_MULTICAST_HOPS): %s", strerror(errno)); + close(sock); return -1; } err = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (int[]){0}, sizeof(int)); if (err < 0) { flog(LOG_ERR, "setsockopt(IPV6_MULTICAST_LOOP): %s", strerror(errno)); + close(sock); return -1; } @@ -123,6 +128,7 @@ int open_icmpv6_socket(const struct list_head *ifaces) err = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, (int[]){1}, sizeof(int)); if (err < 0) { flog(LOG_ERR, "setsockopt(IPV6_RECVHOPLIMIT): %s", strerror(errno)); + close(sock); return -1; } #endif @@ -130,6 +136,7 @@ int open_icmpv6_socket(const struct list_head *ifaces) err = subscribe_rpl_multicast(sock, ifaces); if (err < 0) { flog(LOG_ERR, "Failed to subscribe rpl multicast: %s", strerror(errno)); + close(sock); return -1; } From patchwork Wed Sep 18 19:58:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schmidt X-Patchwork-Id: 11151197 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BEFFA197C for ; Wed, 18 Sep 2019 19:58:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A823221928 for ; Wed, 18 Sep 2019 19:58:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729601AbfIRT67 (ORCPT ); Wed, 18 Sep 2019 15:58:59 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:46948 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732225AbfIRT67 (ORCPT ); Wed, 18 Sep 2019 15:58:59 -0400 Received: from localhost.localdomain (p200300E9D7197EFAD2D4565022F53F4F.dip0.t-ipconnect.de [IPv6:2003:e9:d719:7efa:d2d4:5650:22f5:3f4f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@sostec.de) by proxima.lasnet.de (Postfix) with ESMTPSA id 9B80AC1520; Wed, 18 Sep 2019 21:58:57 +0200 (CEST) From: Stefan Schmidt To: alex.aring@gmail.com Cc: linux-wpan@vger.kernel.org, Stefan Schmidt Subject: [PATCH rpld 6/6] send: ensure we free the buffer after sending the message Date: Wed, 18 Sep 2019 21:58:19 +0200 Message-Id: <20190918195819.7492-7-stefan@datenfreihafen.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918195819.7492-1-stefan@datenfreihafen.org> References: <20190918195819.7492-1-stefan@datenfreihafen.org> MIME-Version: 1.0 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org We have been leaking all buffers for every send so far. Fixes Coverity IDs 250810, 250807, 250806, 250805 --- send.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/send.c b/send.c index d026f6a..50f73da 100644 --- a/send.c +++ b/send.c @@ -29,9 +29,10 @@ static int really_send(int sock, const struct iface *iface, const struct in6_addr *dest, - const struct safe_buffer *sb) + struct safe_buffer *sb) { struct sockaddr_in6 addr; + int rc; memset((void *)&addr, 0, sizeof(addr)); addr.sin6_family = AF_INET6; addr.sin6_port = htons(IPPROTO_ICMPV6); @@ -67,7 +68,10 @@ static int really_send(int sock, const struct iface *iface, mhdr.msg_control = (void *)cmsg; mhdr.msg_controllen = sizeof(chdr); - return sendmsg(sock, &mhdr, 0); + rc = sendmsg(sock, &mhdr, 0); + safe_buffer_free(sb); + + return rc; } void send_dio(int sock, struct dag *dag) {