Merge lp:~asac/ntrack/lp743879 into lp:ntrack

Proposed by Alexander Sack
Status: Merged
Approved by: Alexander Sack
Approved revision: 290
Merged at revision: 289
Proposed branch: lp:~asac/ntrack/lp743879
Merge into: lp:ntrack
Diff against target: 94 lines (+24/-6)
3 files modified
configure.ac (+8/-1)
modules/Makefile.am (+12/-1)
modules/ntrack-libnl.c (+4/-4)
To merge this branch: bzr merge lp:~asac/ntrack/lp743879
Reviewer Review Type Date Requested Status
Alexander Sack Approve
Review via email: mp+56076@code.launchpad.net

Commit message

add support for libnl-3.0 - lp:743879
 + merged branch lp:~asac/ntrack/lp743879
 + Thanks to Arkadiusz Miśkiewicz for the prototype patch

To post a comment you must log in.
Revision history for this message
Alexander Sack (asac) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2011-03-27 22:26:04 +0000
3+++ configure.ac 2011-04-03 12:20:50 +0000
4@@ -145,6 +145,13 @@
5
6 AM_CONDITIONAL(HAVE_QT4, test $ac_have_qt4 = 1)
7
8+PKG_CHECK_MODULES(LIBNL3, libnl-3.0, ac_have_libnl3=1, ac_have_libnl3=0)
9+AS_IF([test x$ac_have_libnl3 = x1],
10+ [LIBNL3_LIBS="$LIBNL3_LIBS -lnl-route"])
11+AC_SUBST(LIBNL3_CFLAGS)
12+AC_SUBST(LIBNL3_LIBS)
13+AM_CONDITIONAL(HAVE_LIBNL3, test $ac_have_libnl3 = 1)
14+
15 PKG_CHECK_MODULES(LIBNL2, libnl-2.0, ac_have_libnl2=1, ac_have_libnl2=0)
16 AC_SUBST(LIBNL2_CFLAGS)
17 AC_SUBST(LIBNL2_LIBS)
18@@ -156,7 +163,7 @@
19 AM_CONDITIONAL(HAVE_LIBNL1, test $ac_have_libnl1 = 1)
20
21 # consistency checks
22-if ! test "$ac_have_libnl1" = "1" -o "$ac_have_libnl2" = 1; then
23+if ! test "$ac_have_libnl1" = "1" -o "$ac_have_libnl2" = 1 -o "$ac_have_libnl3" = 1; then
24 AC_ERROR([libnl is required])
25 fi
26
27
28=== modified file 'modules/Makefile.am'
29--- modules/Makefile.am 2011-04-03 12:02:56 +0000
30+++ modules/Makefile.am 2011-04-03 12:20:50 +0000
31@@ -38,8 +38,12 @@
32 LIBNL_DEF = -DHAVE_LIBNL2
33 NTRACK_LIB2 = ntrack-libnl2.la
34 endif
35+if HAVE_LIBNL3
36+LIBNL_DEF = -DHAVE_LIBNL3
37+NTRACK_LIB3 = ntrack-libnl3.la
38+endif
39
40-ntrackmodules_LTLIBRARIES = $(NTRACK_LIB1) $(NTRACK_LIB2)
41+ntrackmodules_LTLIBRARIES = $(NTRACK_LIB1) $(NTRACK_LIB2) $(NTRACK_LIB3)
42
43 ntrack_libnl_sources = \
44 ntrack-libnl.c \
45@@ -61,3 +65,10 @@
46 ntrack_libnl2_la_LDFLAGS = $(ntrack_libnl_ldflags)
47 endif
48
49+if HAVE_LIBNL3
50+ntrack_libnl3_la_SOURCES = $(ntrack_libnl_sources)
51+ntrack_libnl3_la_CFLAGS = $(LIBNL3_CFLAGS) $(ntrack_libnl_cflags)
52+ntrack_libnl3_la_LIBADD = $(LIBNL3_LIBS)
53+ntrack_libnl3_la_LDFLAGS = $(ntrack_libnl_ldflags)
54+endif
55+
56
57=== modified file 'modules/ntrack-libnl.c'
58--- modules/ntrack-libnl.c 2011-04-03 12:04:51 +0000
59+++ modules/ntrack-libnl.c 2011-04-03 12:20:50 +0000
60@@ -63,7 +63,7 @@
61
62 #define RTNL_ROUTE_GET_PRIO rtnl_route_get_prio
63
64-#elif defined(HAVE_LIBNL2)
65+#elif defined(HAVE_LIBNL2) || defined (HAVE_LIBNL3)
66 typedef struct nl_sock NTRACK_nl_handle;
67
68 #define NL_CACHE_MNGR_ALLOC(handle,mngr_o) \
69@@ -145,7 +145,7 @@
70 #ifdef HAVE_LIBNL1
71 nl_info->handle = nl_handle_alloc();
72 nl_info->smart_update_handle = nl_handle_alloc();
73-#elif defined(HAVE_LIBNL2)
74+#elif defined(HAVE_LIBNL2) || defined(HAVE_LIBNL3)
75 nl_info->handle = nl_socket_alloc();
76 nl_info->smart_update_handle = nl_socket_alloc();
77 #else
78@@ -411,14 +411,14 @@
79 iter = nl_cache_get_first (nl_info->route_cache);
80 while (iter) {
81 struct rtnl_link *iter_link;
82-#if defined(HAVE_LIBNL2)
83+#if defined(HAVE_LIBNL2) || defined(HAVE_LIBNL3)
84 struct rtnl_nexthop *nexth=0;
85 int nhops=0;
86 #endif
87 if (!nl_object_match_filter (iter, OBJ_CAST(filter_route)))
88 goto next;
89
90-#if defined(HAVE_LIBNL2)
91+#if defined(HAVE_LIBNL2) || defined(HAVE_LIBNL3)
92 nhops = rtnl_route_get_nnexthops ((struct rtnl_route*) iter);
93 if (nhops > 0)
94 nexth = rtnl_route_nexthop_n ((struct rtnl_route*) iter, 0);

Subscribers

People subscribed via source and target branches

to all changes: