diff options
author | Thomas Graf <tgraf@suug.ch> | 2011-08-11 14:30:24 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2011-08-11 14:30:24 +0200 |
commit | f1c8d5b0a3a1baa87a773feb34866ca51e0989bb (patch) | |
tree | 0fa3765ed3d131011c578b08b9f2fef62d9855d7 | |
parent | 70c93717607a15d37b60d7caefb58e78d28c5e59 (diff) | |
download | libnl-f1c8d5b0a3a1baa87a773feb34866ca51e0989bb.tar.gz |
3.1 release
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | configure.in | 7 | ||||
-rw-r--r-- | doc/core.txt | 17 | ||||
-rw-r--r-- | doc/route.txt | 2 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | libnl-3.1.pc.in (renamed from libnl-3.0.pc.in) | 0 | ||||
-rw-r--r-- | libnl-genl-3.1.pc.in | 11 | ||||
-rw-r--r-- | libnl-nf-3.1.pc.in | 11 | ||||
-rw-r--r-- | libnl-route-3.1.pc.in | 11 | ||||
-rw-r--r-- | src/lib/link.c | 2 | ||||
-rw-r--r-- | tests/Makefile | 14 | ||||
-rw-r--r-- | tests/test-create-bond.c | 33 | ||||
-rw-r--r-- | tests/test-create-vlan.c | 48 | ||||
-rw-r--r-- | tests/test-delete-link.c | 28 |
15 files changed, 170 insertions, 27 deletions
@@ -1,12 +1,14 @@ .deps .libs .dirstamp -*.in *.la *.lo *.o *.swp Makefile +Makefile.in +defs.h.in +defs.h.in~ /lib/stamp-h1 /libnl-1.pc @@ -24,5 +26,5 @@ cscope.* /ltmain.sh /install-sh /missing - /*.pc + diff --git a/Makefile.am b/Makefile.am index 07017c8..68d236c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,10 @@ endif SUBDIRS = include lib doc man $(OPT_DIRS) -pkgconfig_DATA = libnl-3.0.pc +pkgconfig_DATA = libnl-3.1.pc \ + libnl-route-3.1.pc \ + libnl-genl-3.1.pc \ + libnl-nf-3.1.pc sysconfdir = @sysconfdir@/libnl sysconf_DATA = etc/pktloc etc/classid diff --git a/configure.in b/configure.in index 00ad3ee..47567af 100644 --- a/configure.in +++ b/configure.in @@ -9,7 +9,7 @@ # Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> # -AC_INIT(libnl, 3.0, tgraf@suug.ch) +AC_INIT(libnl, 3.1, tgraf@suug.ch) AC_CONFIG_HEADERS([lib/defs.h]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) @@ -17,7 +17,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], []) MAJ_VERSION=3 AC_SUBST([MAJ_VERSION]) -MIN_VERSION=0 +MIN_VERSION=1 AC_SUBST([MIN_VERSION]) AC_PROG_CC @@ -49,5 +49,6 @@ AC_CHECK_LIB([m], [pow], [], AC_MSG_ERROR([libm is required])) AC_CONFIG_FILES([Makefile doc/Doxyfile doc/Makefile lib/Makefile include/Makefile src/Makefile src/lib/Makefile man/Makefile - libnl-3.0.pc include/netlink/version.h]) + libnl-3.1.pc libnl-route-3.1.pc libnl-genl-3.1.pc libnl-nf-3.1.pc + include/netlink/version.h]) AC_OUTPUT diff --git a/doc/core.txt b/doc/core.txt index 0ab32ec..796e9fc 100644 --- a/doc/core.txt +++ b/doc/core.txt @@ -7,7 +7,7 @@ Netlink Library (libnl) ======================= Thomas Graf <tgraf@suug.ch> -3.0, July 17 2011: +3.1, Aug 11 2011: :numbered: == Introduction @@ -70,8 +70,8 @@ makes use of. ----- #include <netlink/version.h> -#if LIBNL_VER_NUM >= LIBNL_VER(3,0) - /* include code if compiled with libnl version >= 3.0 */ +#if LIBNL_VER_NUM >= LIBNL_VER(3,1) + /* include code if compiled with libnl version >= 3.1 */ #endif ----- @@ -2549,11 +2549,12 @@ dealing with network addresses is a common task. Currently the following address families are supported: - - `AF_INET` - - `AF_INET6` - - `AF_LLC` - - `AF_DECnet` - - `AF_UNSPEC` +[options="compact"] + * `AF_INET` + * `AF_INET6` + * `AF_LLC` + * `AF_DECnet` + * `AF_UNSPEC` [[core_addr_alloc]] .Address Allocation diff --git a/doc/route.txt b/doc/route.txt index 757b4bd..33f58d0 100644 --- a/doc/route.txt +++ b/doc/route.txt @@ -7,7 +7,7 @@ Routing Family Netlink Library (libnl-route) ============================================ Thomas Graf <tgraf@suug.ch> -3.1, July 17 2011: +3.1, Aug 11 2011: == Introduction diff --git a/lib/Makefile.am b/lib/Makefile.am index ddda933..cb5403f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,7 @@ # -*- Makefile -*- AM_CPPFLAGS = -Wall -I${top_srcdir}/include -I${top_builddir}/include -I${builddir}/route -I${builddir}/route/cls -D_GNU_SOURCE -DSYSCONFDIR=\"$(sysconfdir)/libnl\" -AM_LDFLAGS = -version-info 3:0:0 +AM_LDFLAGS = -version-info 3:1:0 lib_LTLIBRARIES = \ libnl.la libnl-genl.la libnl-route.la libnl-nf.la diff --git a/libnl-3.0.pc.in b/libnl-3.1.pc.in index e44f0fb..e44f0fb 100644 --- a/libnl-3.0.pc.in +++ b/libnl-3.1.pc.in diff --git a/libnl-genl-3.1.pc.in b/libnl-genl-3.1.pc.in new file mode 100644 index 0000000..5b5f841 --- /dev/null +++ b/libnl-genl-3.1.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libnl-genl +Description: Generic Netlink Library +Version: @PACKAGE_VERSION@ +Requires: libnl +Libs: -L${libdir} -lnl-genl +Cflags: -I${includedir} diff --git a/libnl-nf-3.1.pc.in b/libnl-nf-3.1.pc.in new file mode 100644 index 0000000..ffff22b --- /dev/null +++ b/libnl-nf-3.1.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libnl-nf +Description: Netfilter Netlink Library +Version: @PACKAGE_VERSION@ +Requires: libnl +Libs: -L${libdir} -lnl-nf +Cflags: -I${includedir} diff --git a/libnl-route-3.1.pc.in b/libnl-route-3.1.pc.in new file mode 100644 index 0000000..95be862 --- /dev/null +++ b/libnl-route-3.1.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libnl-route +Description: Netlink Routing Family Library +Version: @PACKAGE_VERSION@ +Requires: libnl +Libs: -L${libdir} -lnl-route +Cflags: -I${includedir} diff --git a/src/lib/link.c b/src/lib/link.c index db90558..5bce824 100644 --- a/src/lib/link.c +++ b/src/lib/link.c @@ -86,8 +86,6 @@ void nl_cli_link_parse_txqlen(struct rtnl_link *link, char *arg) void nl_cli_link_parse_weight(struct rtnl_link *link, char *arg) { - uint32_t weight = nl_cli_parse_u32(arg); - rtnl_link_set_weight(link, weight); } void nl_cli_link_parse_ifalias(struct rtnl_link *link, char *arg) diff --git a/tests/Makefile b/tests/Makefile index 8494eea..d072ddb 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -13,25 +13,21 @@ ifeq ($(shell [ ! -r ../Makefile.opts ] && echo 1),) include ../Makefile.opts endif -LDFLAGS += -L../lib -lnl ../src/utils.o +LDFLAGS += -L../lib -lnl -lnl-genl -lnl-route CIN := $(wildcard test-*.c) -TOOLS := $(CIN:%.c=%) +TESTS := $(CIN:%.c=%) -all: $(TOOLS) - -$(TOOLS): ../src/utils.o +all: $(TESTS) test-%: test-%.c @echo " LD $@"; \ - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -lnl-genl -lnl-route + $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) clean: @echo " CLEAN src"; \ - rm -f $(TOOLS) + rm -f $(TESTS) distclean: clean install: @true - -include ../Makefile.rules diff --git a/tests/test-create-bond.c b/tests/test-create-bond.c new file mode 100644 index 0000000..99166aa --- /dev/null +++ b/tests/test-create-bond.c @@ -0,0 +1,33 @@ +#include <netlink/netlink.h> +#include <netlink/route/link.h> + +int main(int argc, char *argv[]) +{ + struct rtnl_link *link; + struct nl_sock *sk; + int err; + + sk = nl_socket_alloc(); + if ((err = nl_connect(sk, NETLINK_ROUTE)) < 0) { + nl_perror(err, "Unable to connect socket"); + return err; + } + + link = rtnl_link_alloc(); + rtnl_link_set_name(link, "my_bond"); + + if ((err = rtnl_link_set_info_type(link, "bond")) < 0) { + nl_perror(err, "Unable to set link info type"); + return err; + } + + if ((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0) { + nl_perror(err, "Unable to add link"); + return err; + } + + rtnl_link_put(link); + nl_close(sk); + + return 0; +} diff --git a/tests/test-create-vlan.c b/tests/test-create-vlan.c new file mode 100644 index 0000000..00a4d91 --- /dev/null +++ b/tests/test-create-vlan.c @@ -0,0 +1,48 @@ +#include <netlink/netlink.h> +#include <netlink/route/link.h> +#include <netlink/route/link/vlan.h> + +int main(int argc, char *argv[]) +{ + struct rtnl_link *link; + struct nl_cache *link_cache; + struct nl_sock *sk; + int err, master_index; + + sk = nl_socket_alloc(); + if ((err = nl_connect(sk, NETLINK_ROUTE)) < 0) { + nl_perror(err, "Unable to connect socket"); + return err; + } + + if ((err = rtnl_link_alloc_cache(sk, AF_UNSPEC, &link_cache)) < 0) { + nl_perror(err, "Unable to allocate cache"); + return err; + } + + if (!(master_index = rtnl_link_name2i(link_cache, "eth0"))) { + fprintf(stderr, "Unable to lookup eth0"); + return -1; + } + + link = rtnl_link_alloc(); + + rtnl_link_set_link(link, master_index); + + if ((err = rtnl_link_set_type(link, "vlan")) < 0) { + nl_perror(err, "Unable to set link info type"); + return err; + } + + rtnl_link_vlan_set_id(link, 10); + + if ((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0) { + nl_perror(err, "Unable to add link"); + return err; + } + + rtnl_link_put(link); + nl_close(sk); + + return 0; +} diff --git a/tests/test-delete-link.c b/tests/test-delete-link.c new file mode 100644 index 0000000..9cf1034 --- /dev/null +++ b/tests/test-delete-link.c @@ -0,0 +1,28 @@ +#include <netlink/netlink.h> +#include <netlink/route/link.h> + +int main(int argc, char *argv[]) +{ + struct rtnl_link *link; + struct nl_sock *sk; + int err; + + sk = nl_socket_alloc(); + if ((err = nl_connect(sk, NETLINK_ROUTE)) < 0) { + nl_perror(err, "Unable to connect socket"); + return err; + } + + link = rtnl_link_alloc(); + rtnl_link_set_name(link, "my_bond"); + + if ((err = rtnl_link_delete(sk, link)) < 0) { + nl_perror(err, "Unable to delete link"); + return err; + } + + rtnl_link_put(link); + nl_close(sk); + + return 0; +} |