[Jool-list] jool 4.1.1 compile notes

Alberto Leiva ydahhrk at gmail.com
Wed Jul 8 11:19:04 CDT 2020


> Error
> src/mod/common/db/global.c:91:26: error: invalid suffix "b1011" on
> integer constant
>
> I converted DEFAULT_F_ARGS binary to hex. (Since 4.0.7-my first jool
> compile)
>
> Are there any problem here?

Ok, I don't actually have much problem changing the constant from
binary to hex, but this actually looks like a gcc bug. Which version
of gcc are you using?

> Solution
> jool tools minimum libnl3 requierment >= 3.2.22
> I compiled and fixed.

You're completely right. nla_nest_cancel first appeared in libnl
3.2.22. Updated: [0]

> Do we no longer need these libraries?(I think since 4.0.8)

Short answer: Correct; those libraries were abandoned.

Long answer: Actually, I want to use those libraries, but there's an
autotools error that's preventing me from doing so: [1]

Here's a summary of the problem, in case someone can help:

The autotools have three types of libraries: Public Libraries
(lib_LTLIBRARIES), Private Libraries (pkglib_LTLIBRARIES) and
non-libraries (noinst_LTLIBRARIES).

For now, I want all Jool libraries to be Private Libraries (PL), but
autotools prints a warning and behaves strangely when PLs depend on
other PLs. (PL libjoolargp depends on PL libjoolnl, which in turn
depends on PL libjoolutil.)

(The warning is "relinking" and the strange behavior is dumb error
messages when you try to install a version of the library on top of a
different version of the same library that exports a different API.
See [2])

I "solved" the problem by converting all the PLs into non-libraries.
In other words, the current library code is being merged into the
jool, jool_siit and joold programs. But I would like to revert them
back to PLs.

> Kernel compile warnings
> src/mod/common/db/pool4/empty.c: In function ‘pool4empty_contains’:
> src/mod/common/db/pool4/empty.c:33: warning: comparison is always false
> due to limited range of data type

Ok. I removed this validation; It's not needed. ([0])

> Some tools warnings ?
> tribute.Tpo -c attribute.c  -fPIC -DPIC -o .libs/libjoolnl_la-attribute.o
> In file included from /usr/include/libnl3/netlink/netlink.h:26:0,
>                   from /usr/include/libnl3/netlink/attr.h:15,
>                   from ../../../src/usr/nl/attribute.h:4,
>                   from attribute.c:1:
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:289:15:
> warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic]
>    RT_TABLE_MAX=0xFFFFFFFF
>                 ^
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:369:9:
> warning: ISO C forbids zero-size array 'rtvia_addr' [-Wpedantic]
>    __u8   rtvia_addr[0];
>           ^

I don't think I can fix these; the problem is in kernel headers, not Jool code.

> attribute.c: In function 'jnla_validate_list':
> attribute.c:74:2: warning: passing argument 4 of 'nla_validate' discards
> 'const' qualifier from pointer target type [enabled by default]
>    error = nla_validate(head, len, JNLAL_MAX, policy);
>    ^
> In file included from ../../../src/usr/nl/attribute.h:4:0,
>                   from attribute.c:1:
> /usr/include/libnl3/netlink/attr.h:84:13: note: expected 'struct
> nla_policy *' but argument is of type 'const struct nla_policy *'
>   extern int  nla_validate(struct nlattr *, int, int,
>               ^

Good catch. I wonder why it's not showing this warning to me. ([0])

> wargp/global.c: In function 'handle_global_display':
> wargp/global.c:40:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct display_args dargs = { 0 };
>           ^
> wargp/global.c:40:9: warning: (near initialization for
> 'dargs.no_headers') [-Wmissing-braces]
> wargp/global.c: In function 'handle_global_update':
> wargp/global.c:87:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct update_args uargs = { 0 };
>           ^

Hm. The code is correct though. I think you're using an old version of
gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

The warning itself is a bug, and was fixed around gcc 4.7 apparently.

Assuming you're using an old gcc: Is a newer version available in your distro?


[0] https://github.com/NICMx/Jool/commit/bdab9612ffb2b548dd0d7d97a43101af9c205e66
[1] https://stackoverflow.com/questions/61533589
[2] https://github.com/NICMx/Jool/issues/325

On Wed, Jul 8, 2020 at 6:24 AM Fatih USTA via Jool-list
<jool-list at nic.mx> wrote:
>
> Hi,
>
> I compiled 4.1.1 successfully. Thank you for your effort.
>
> I just  want to share some notes with you.
>
> Kernel version 4.9.228
>
> Error
> src/mod/common/db/global.c:91:26: error: invalid suffix "b1011" on
> integer constant
>
>
> I converted DEFAULT_F_ARGS binary to hex. (Since 4.0.7-my first jool
> compile)
>
> Are there any problem here?
>
> Patch
> cat binary_to_hex.patch
> diff -aur a/src/common/constants.h b/src/common/constants.h
> --- a/src/common/constants.h    2020-07-08 09:51:44.000000000 +0300
> +++ b/src/common/constants.h    2020-07-08 09:52:12.000000000 +0300
> @@ -68,7 +68,7 @@
>   #define DEFAULT_DROP_EXTERNAL_CONNECTIONS false
>   #define DEFAULT_MAX_STORED_PKTS 10
>   #define DEFAULT_SRC_ICMP6ERRS_BETTER true
> -#define DEFAULT_F_ARGS 0b1011
> +#define DEFAULT_F_ARGS 0xb
>   #define DEFAULT_HANDLE_FIN_RCV_RST false
>   #define DEFAULT_BIB_LOGGING false
>   #define DEFAULT_SESSION_LOGGING false
>
>
> By the way I still see binary output. I think there is no problem here.
> #jool global display | grep f-arg
>    f-args: 11 (0b1011): SrcAddr:1 SrcPort:0 DstAddr:1 DstPort:1
>
>
>
> Error nla_nest_cancel
>
> gcc -Wall -pedantic -std=gnu11 -I../../../src -m32
> -I/usr/local/include/kernel-headers-4.9.228/usr/include -m32 -o
> jool_siit jool_siit-main-siit.o  ../argp/.libs/libjoolargp.a -lnl-genl-3
> -lnl-3 -lpthread -lm
> ../argp/.libs/libjoolargp.a(libjoolnl_la-attribute.o): In function
> `nla_put_prefix6':
> attribute.c:(.text+0xe34): undefined reference to `nla_nest_cancel'
> ../argp/.libs/libjoolargp.a(libjoolnl_la-attribute.o): In function
> `nla_put_prefix4':
> attribute.c:(.text+0xf0a): undefined reference to `nla_nest_cancel'
> ../argp/.libs/libjoolargp.a(libjoolnl_la-attribute.o): In function
> `nla_put_taddr6':
> attribute.c:(.text+0xfbb): undefined reference to `nla_nest_cancel'
> ../argp/.libs/libjoolargp.a(libjoolnl_la-attribute.o): In function
> `nla_put_taddr4':
> attribute.c:(.text+0x106c): undefined reference to `nla_nest_cancel'
> ../argp/.libs/libjoolargp.a(libjoolnl_la-attribute.o): In function
> `nla_put_plateaus':
> attribute.c:(.text+0x10ee): undefined reference to `nla_nest_cancel'
> ../argp/.libs/libjoolargp.a(libjoolnl_la-attribute.o):attribute.c:(.text+0x11ca):
> more undefined references to `nla_nest_cancel' follow
> collect2: error: ld returned 1 exit status
>
>
> Solution
> jool tools minimum libnl3 requierment >= 3.2.22
> I compiled and fixed.
>
>
> Do we no longer need these libraries?(I think since 4.0.8)
>
> /usr/lib/jool/libjoolargp.so
> /usr/lib/jool/libjoolargp.so.0
> /usr/lib/jool/libjoolargp.so.0.0.0
> /usr/lib/jool/libjoolnl.so
> /usr/lib/jool/libjoolnl.so.0
> /usr/lib/jool/libjoolnl.so.0.0.0
> /usr/lib/jool/libjoolutil.so
> /usr/lib/jool/libjoolutil.so.0
> /usr/lib/jool/libjoolutil.so.0.0.0
>
>
>
> Kernel compile warnings
> src/mod/common/db/pool4/empty.c: In function ‘pool4empty_contains’:
> src/mod/common/db/pool4/empty.c:33: warning: comparison is always false
> due to limited range of data type
>
>
>
> Some tools warnings ?
> tribute.Tpo -c attribute.c  -fPIC -DPIC -o .libs/libjoolnl_la-attribute.o
> In file included from /usr/include/libnl3/netlink/netlink.h:26:0,
>                   from /usr/include/libnl3/netlink/attr.h:15,
>                   from ../../../src/usr/nl/attribute.h:4,
>                   from attribute.c:1:
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:289:15:
> warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic]
>    RT_TABLE_MAX=0xFFFFFFFF
>                 ^
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:369:9:
> warning: ISO C forbids zero-size array 'rtvia_addr' [-Wpedantic]
>    __u8   rtvia_addr[0];
>           ^
> attribute.c: In function 'jnla_validate_list':
> attribute.c:74:2: warning: passing argument 4 of 'nla_validate' discards
> 'const' qualifier from pointer target type [enabled by default]
>    error = nla_validate(head, len, JNLAL_MAX, policy);
>    ^
> In file included from ../../../src/usr/nl/attribute.h:4:0,
>                   from attribute.c:1:
> /usr/include/libnl3/netlink/attr.h:84:13: note: expected 'struct
> nla_policy *' but argument is of type 'const struct nla_policy *'
>   extern int  nla_validate(struct nlattr *, int, int,
>               ^
> ................
>
> In file included from /usr/include/libnl3/netlink/netlink.h:26:0,
>                   from /usr/include/libnl3/netlink/attr.h:15,
>                   from ../../../src/common/config.h:13,
>                   from ../../../src/usr/argp/command.h:5,
>                   from wargp/global.c:3:
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:289:15:
> warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic]
>    RT_TABLE_MAX=0xFFFFFFFF
>                 ^
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:369:9:
> warning: ISO C forbids zero-size array 'rtvia_addr' [-Wpedantic]
>    __u8   rtvia_addr[0];
>           ^
> wargp/global.c: In function 'handle_global_display':
> wargp/global.c:40:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct display_args dargs = { 0 };
>           ^
> wargp/global.c:40:9: warning: (near initialization for
> 'dargs.no_headers') [-Wmissing-braces]
> wargp/global.c: In function 'handle_global_update':
> wargp/global.c:87:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct update_args uargs = { 0 };
>           ^
>
> .............................
>
> In file included from /usr/include/libnl3/netlink/netlink.h:26:0,
>                   from /usr/include/libnl3/netlink/attr.h:15,
>                   from ../../../src/common/config.h:13,
>                   from wargp/instance.c:4:
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:289:15:
> warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic]
>    RT_TABLE_MAX=0xFFFFFFFF
>                 ^
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:369:9:
> warning: ISO C forbids zero-size array 'rtvia_addr' [-Wpedantic]
>    __u8   rtvia_addr[0];
>           ^
> wargp/instance.c: In function 'handle_instance_display':
> wargp/instance.c:116:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct display_args dargs = { 0 };
>           ^
> wargp/instance.c:116:9: warning: (near initialization for
> 'dargs.no_headers') [-Wmissing-braces]
> wargp/instance.c: In function 'handle_instance_add':
> wargp/instance.c:194:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct add_args aargs = { 0 };
>           ^
> wargp/instance.c:194:9: warning: (near initialization for 'aargs.iname')
> [-Wmissing-braces]
> wargp/instance.c: In function 'handle_instance_remove':
> wargp/instance.c:252:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct rm_args rargs = { 0 };
>           ^
> .............................
>
>
> In file included from /usr/include/libnl3/netlink/netlink.h:26:0,
>                   from ../../../src/usr/nl/core.h:4,
>                   from wargp/pool4.c:4:
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:289:15:
> warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic]
>    RT_TABLE_MAX=0xFFFFFFFF
>                 ^
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:369:9:
> warning: ISO C forbids zero-size array 'rtvia_addr' [-Wpedantic]
>    __u8   rtvia_addr[0];
>           ^
> wargp/pool4.c: In function 'handle_pool4_display':
> wargp/pool4.c:115:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct display_args dargs = { 0 };
>           ^
> wargp/pool4.c:115:9: warning: (near initialization for 'dargs.proto')
> [-Wmissing-braces]
> wargp/pool4.c: In function 'handle_pool4_add':
> wargp/pool4.c:251:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct add_args aargs = { 0 };
>           ^
> wargp/pool4.c:251:9: warning: (near initialization for 'aargs.entry')
> [-Wmissing-braces]
> wargp/pool4.c: In function 'handle_pool4_remove':
> wargp/pool4.c:331:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct rm_args rargs = { 0 };
>           ^
> wargp/pool4.c:331:9: warning: (near initialization for 'rargs.entry')
> [-Wmissing-braces]
>
>
> .....................
>
> In file included from /usr/include/libnl3/netlink/netlink.h:26:0,
>                   from ../../../src/usr/nl/core.h:4,
>                   from wargp/stats.c:3:
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:289:15:
> warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic]
>    RT_TABLE_MAX=0xFFFFFFFF
>                 ^
> /usr/local/include/kernel-headers-4.9.228/usr/include/linux/rtnetlink.h:369:9:
> warning: ISO C forbids zero-size array 'rtvia_addr' [-Wpedantic]
>    __u8   rtvia_addr[0];
>           ^
> wargp/stats.c: In function 'handle_stats_display':
> wargp/stats.c:59:9: warning: missing braces around initializer
> [-Wmissing-braces]
>    struct display_args dargs = { 0 };
>           ^
> wargp/stats.c:59:9: warning: (near initialization for 'dargs.all')
> [-Wmissing-braces]
>
>
>
>
> --
> Fatih USTA
>
> _______________________________________________
> Jool-list mailing list
> Jool-list at nic.mx
> https://mail-lists.nic.mx/listas/listinfo/jool-list


More information about the Jool-list mailing list