[radvd-devel-l] [PATCH] netlink.c: Fix build failure when NETLINK_NO_ENOBUFS is not defined

Reuben Hawkins reubenhwk at gmail.com
Mon Aug 12 10:44:47 EDT 2013


Hi Sedat,

The change looks good.  I haven't tested it yet, but when I get a chance to
test I doubt I'll find any reason to not merge the change.

I'll make a new release in a few weeks with the change.

Thanks,
Reuben


On Wed, Aug 7, 2013 at 6:12 PM, Sedat Dilek <sedat.dilek at gmail.com> wrote:

> My build with radvd-1.9.3 and the Freetz build-system breaks with a
> Linux-kernel v2.6.13.1 like this:
>
> netlink.c: In function 'netlink_socket':
> netlink.c:84:41: error: 'NETLINK_NO_ENOBUFS' undeclared (first use in
> this function)
> netlink.c:84:41: note: each undeclared identifier is reported only
> once for each function it appears in
> make[2]: *** [netlink.o] Error 1
>
> This is obvious as my kernel-sources have no "NETLINK_NO_ENOBUFS"
> definition
> in "include/linux/netlink.h".
>
> The culprit is the else-if line here:
>
> [ netlink.c ]
>
> int netlink_socket(void)
> {
> ...
>         if (sock == -1) {
>                 flog(LOG_ERR, "Unable to open netlink socket: %s",
> strerror(errno));
>         }
>         else if (setsockopt(sock, SOL_NETLINK, NETLINK_NO_ENOBUFS, &val,
> sizeof(val)) < 0 ) {
>                 flog(LOG_ERR, "Unable to setsockopt NETLINK_NO_ENOBUFS:
> %s", strerror(errno));
>         }
> ...
>
> The NETLINK_NO_ENOBUFS socket flag was first introduced with Linux-kernel
> v2.6.29-rc7:
>
>    commit 38938bfe3489394e2eed5e40c9bb8f66a2ce1405
>    "netlink: add NETLINK_NO_ENOBUFS socket flag"
>
> The issue in radvd was introduced with:
>
>    commit de9a8849258b2a6a125d686dcb9c424affad354d
>    "setsockopt NETLINK_NO_ENOBUFS"
>
> I have added extra checks for SOL_NETLINK and NETLINK_NO_ENOBUFS
> definitions
> which fixes the issue for me.
>
> NOTE: Compile-tested only!
> Signed-off-by: Sedat Dilek <sedat.dilek at gmail.com>
> ---
>  netlink.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/netlink.c b/netlink.c
> index a37ccad..d405731 100644
> --- a/netlink.c
> +++ b/netlink.c
> @@ -81,9 +81,11 @@ int netlink_socket(void)
>         if (sock == -1) {
>                 flog(LOG_ERR, "Unable to open netlink socket: %s",
> strerror(errno));
>         }
> +#if defined SOL_NETLINK && defined NETLINK_NO_ENOBUFS
>         else if (setsockopt(sock, SOL_NETLINK, NETLINK_NO_ENOBUFS, &val,
> sizeof(val)) < 0 ) {
>                 flog(LOG_ERR, "Unable to setsockopt NETLINK_NO_ENOBUFS:
> %s", strerror(errno));
>         }
> +#endif
>
>         memset(&snl, 0, sizeof(snl));
>         snl.nl_family = AF_NETLINK;
> --
> 1.8.3.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litech.org/pipermail/radvd-devel-l/attachments/20130812/aa3863d0/attachment.html>


More information about the radvd-devel-l mailing list