dect
/
libnl
Archived
13
0
Fork 0

3.1 release

This commit is contained in:
Thomas Graf 2011-08-11 14:30:24 +02:00
parent 70c9371760
commit f1c8d5b0a3
15 changed files with 170 additions and 27 deletions

6
.gitignore vendored
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

11
libnl-genl-3.1.pc.in Normal file
View File

@ -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}

11
libnl-nf-3.1.pc.in Normal file
View File

@ -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}

11
libnl-route-3.1.pc.in Normal file
View File

@ -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}

View File

@ -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)

View File

@ -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

33
tests/test-create-bond.c Normal file
View File

@ -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;
}

48
tests/test-create-vlan.c Normal file
View File

@ -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;
}

28
tests/test-delete-link.c Normal file
View File

@ -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;
}