ntrack-libnl.c:544:3: error: invalid use of undefined type 'struct nl_object_ops'

Bug #1115449 reported by Arkadiusz Miśkiewicz
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
ntrack
Fix Released
Medium
Alexander Sack

Bug Description

building ntrack from bzr with latest libnl (3.2.21) fails with:
ntrack-libnl.c:544:3: error: invalid use of undefined type 'struct nl_object_ops'

because contents of nl_object_ops are hidden now

Making all in modules
make[2]: Wejście do katalogu `/home/users/arekm/test/ntrack/modules'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/libnl3 -DHAVE_LIBNL3_X -Wall -Werror -Wno-variadic-macros -I../common/ -g -O2 -MT ntrack_libnl3_x_la-ntrack-libnl.lo -MD -MP -MF .deps/ntrack_libnl3_x_la-ntrack-libnl.Tpo -c -o ntrack_libnl3_x_la-ntrack-libnl.lo `test -f 'ntrack-libnl.c' || echo './'`ntrack-libnl.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/libnl3 -DHAVE_LIBNL3_X -Wall -Werror -Wno-variadic-macros -I../common/ -g -O2 -MT ntrack_libnl3_x_la-ntrack-libnl.lo -MD -MP -MF .deps/ntrack_libnl3_x_la-ntrack-libnl.Tpo -c ntrack-libnl.c -fPIC -DPIC -o .libs/ntrack_libnl3_x_la-ntrack-libnl.o
ntrack-libnl.c: In function 'update_connectivity':
ntrack-libnl.c:544:3: error: invalid use of undefined type 'struct nl_object_ops'
make[2]: *** [ntrack_libnl3_x_la-ntrack-libnl.lo] Błąd 1

Related branches

Revision history for this message
Kelly Anderson (kelly-h) wrote :

This patch should resolve the problem.

--- ./modules/ntrack-libnl.c.orig 2011-10-21 14:46:13.000000000 -0600
+++ ./modules/ntrack-libnl.c 2013-07-27 20:56:33.075448734 -0600
@@ -530,7 +530,7 @@ update_connectivity (ntrack_monitor_t *s
   op_default_route_disappeared ((struct _ntrack_monitor_arch*) self, nl_info);
  } else if (nl_info->topmost_route && topmost_route) {
   int diff_bits;
- if ((diff_bits = (route_obj_ops.oo_id_attrs | ROUTE_ATTR_OIF
+ if ((diff_bits = (nl_object_get_id_attrs(&route_obj_ops) | ROUTE_ATTR_OIF
                     | ROUTE_ATTR_GATEWAY) &
                     nl_object_diff (OBJ_CAST (nl_info->topmost_route),
                                     OBJ_CAST (topmost_route)))) {

Revision history for this message
Philipp Hagemeister (phihag) wrote :

@kelly-h For me, it fails with that patch as well, with

ntrack-libnl.c: In function ‘update_connectivity’:
ntrack-libnl.c:544:3: error: passing argument 1 of ‘nl_object_get_id_attrs’ from incompatible pointer type [-Werror]
   if ((diff_bits = (nl_object_get_id_attrs(&route_obj_ops) | ROUTE_ATTR_OIF
   ^
In file included from /usr/include/libnl3/netlink/netlink.h:34:0,
                 from ntrack-libnl.c:35:
/usr/include/libnl3/netlink/object.h:67:12: note: expected ‘struct nl_object *’ but argument is of type ‘struct nl_object_ops *’
 uint32_t nl_object_get_id_attrs(struct nl_object *obj);
            ^

At least to me, this error looks justified, or am I missing something?

Revision history for this message
Alexander Sack (asac) wrote :

Hi,
sorry for slow reponse, but mail setup is screwed; next time ping me on freenode irc ... nick is asac ...

So I just did a fresh build on trunk on latest Ubuntu trusty. That seem to work. Please give me more info what libnl version you are targetting here...

asac@thinki:~/Development/asac/ntrack/build/modules$ make
/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../modules -I.. -I/home/asac/local/include/libnl3 -DHAVE_LIBNL3_X -Wall -Werror -Wno-variadic-macros -I../../common/ -g -O2 -MT ntrack_libnl3_x_la-ntrack-libnl.lo -MD -MP -MF .deps/ntrack_libnl3_x_la-ntrack-libnl.Tpo -c -o ntrack_libnl3_x_la-ntrack-libnl.lo `test -f 'ntrack-libnl.c' || echo '../../modules/'`ntrack-libnl.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../modules -I.. -I/home/asac/local/include/libnl3 -DHAVE_LIBNL3_X -Wall -Werror -Wno-variadic-macros -I../../common/ -g -O2 -MT ntrack_libnl3_x_la-ntrack-libnl.lo -MD -MP -MF .deps/ntrack_libnl3_x_la-ntrack-libnl.Tpo -c ../../modules/ntrack-libnl.c -fPIC -DPIC -o .libs/ntrack_libnl3_x_la-ntrack-libnl.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../modules -I.. -I/home/asac/local/include/libnl3 -DHAVE_LIBNL3_X -Wall -Werror -Wno-variadic-macros -I../../common/ -g -O2 -MT ntrack_libnl3_x_la-ntrack-libnl.lo -MD -MP -MF .deps/ntrack_libnl3_x_la-ntrack-libnl.Tpo -c ../../modules/ntrack-libnl.c -o ntrack_libnl3_x_la-ntrack-libnl.o >/dev/null 2>&1
mv -f .deps/ntrack_libnl3_x_la-ntrack-libnl.Tpo .deps/ntrack_libnl3_x_la-ntrack-libnl.Plo
/bin/bash ../libtool --tag=CC --mode=link gcc -I/home/asac/local/include/libnl3 -DHAVE_LIBNL3_X -Wall -Werror -Wno-variadic-macros -I../../common/ -g -O2 -module -avoid-version -o ntrack-libnl3_x.la -rpath /home/asac/local/lib/ntrack/modules ntrack_libnl3_x_la-ntrack-libnl.lo -L/home/asac/local/lib -lnl-route-3 -lnl-3
libtool: link: gcc -shared -fPIC -DPIC .libs/ntrack_libnl3_x_la-ntrack-libnl.o -Wl,-rpath -Wl,/home/asac/local/lib -Wl,-rpath -Wl,/home/asac/local/lib -L/home/asac/local/lib /home/asac/local/lib/libnl-route-3.so /home/asac/local/lib/libnl-3.so -O2 -Wl,-soname -Wl,ntrack-libnl3_x.so -o .libs/ntrack-libnl3_x.so
libtool: link: ar cru .libs/ntrack-libnl3_x.a ntrack_libnl3_x_la-ntrack-libnl.o
libtool: link: ranlib .libs/ntrack-libnl3_x.a
libtool: link: ( cd ".libs" && rm -f "ntrack-libnl3_x.la" && ln -s "../ntrack-libnl3_x.la" "ntrack-libnl3_x.la" )

Revision history for this message
Alexander Sack (asac) wrote :

its odd; see that you say libnl 3.2.21 in your bug and I have that very same version:

ii libnl-3-200:i386 3.2.21-1 i386 library for dealing with netlink sockets
ii libnl-3-dev 3.2.21-1 i386 development library and headers for libnl-3

Revision history for this message
Alexander Sack (asac) wrote :

err, /me kinda stupid for having test lib version wrong locally :). let me check

Revision history for this message
Alexander Sack (asac) wrote :

------------------------------------------------------------
revno: 368
fixes bug: https://launchpad.net/bugs/1115449
committer: Alexander Sack <email address hidden>
branch nick: ntrack
timestamp: Sun 2014-10-26 19:00:42 +0100
message:
  modules[libnl]: make libnl module easy to migrate from versions below 3.2.21 to later versions - lp:1115449

  Comment from configure.ac by author
    # route_obj_ops struct members were made private in 3.2.21 build headers; hence we
    # make a special 3.2 build that is produced with headers from libnl < 3.2.21;
    # the old struct element seem to be still available and not changed, so for now
    # we can be happily continuing using binaries using these headers in versions >= .21
    #
    # Integrators with deployed ntrack libnl 3.x module built against a version < 3.2.21
    # are urged to upgrade to ntrack 017 and do at least one respin with it when moving to
    # 3.2.21 or later to get back ABI/API protection.

Changed in ntrack:
importance: Undecided → Medium
milestone: none → 017
status: New → Fix Committed
Alexander Sack (asac)
Changed in ntrack:
assignee: nobody → Alexander Sack (asac)
Alexander Sack (asac)
Changed in ntrack:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.