libnl: portability fixes from Alpine.

This commit is contained in:
Juan RP 2015-05-08 11:52:54 +02:00
parent ba558c6519
commit 292ce123d1
4 changed files with 87 additions and 1 deletions

View file

@ -0,0 +1,25 @@
--- lib/netfilter/log.c
+++ lib/netfilter/log.c
@@ -18,6 +18,7 @@
* @{
*/
+#include <byteswap.h>
#include <sys/types.h>
#include <linux/netfilter/nfnetlink_log.h>
--- include/netlink/netlink.h
+++ include/netlink/netlink.h
@@ -12,11 +12,11 @@
#ifndef NETLINK_NETLINK_H_
#define NETLINK_NETLINK_H_
+#include <poll.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
-#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/time.h>

View file

@ -0,0 +1,50 @@
--- lib/fib_lookup/lookup.c
+++ lib/fib_lookup/lookup.c
@@ -124,7 +124,7 @@
static int result_dump_brief(struct nl_object *obj, struct nl_dump_params *p)
{
struct flnl_result *res = (struct flnl_result *) obj;
- char buf[256];
+ char buf[256], buf2[256];
int line = 1;
dp_dump(p, "table %s prefixlen %u next-hop-selector %u\n",
@@ -132,9 +132,10 @@
res->fr_prefixlen, res->fr_nh_sel);
dp_dump_line(p, line++, "type %s ",
nl_rtntype2str(res->fr_type, buf, sizeof(buf)));
+ strerror_r(-res->fr_error, buf2, sizeof(buf2));
dp_dump(p, "scope %s error %s (%d)\n",
rtnl_scope2str(res->fr_scope, buf, sizeof(buf)),
- strerror_r(-res->fr_error, buf, sizeof(buf)), res->fr_error);
+ buf2, res->fr_error);
return line;
}
--- lib/handlers.c
+++ lib/handlers.c
@@ -136,8 +136,8 @@
FILE *ofd = arg ? arg : stderr;
char buf[256];
- fprintf(ofd, "-- Error received: %s\n-- Original message: ",
- strerror_r(-e->error, buf, sizeof(buf)));
+ strerror_r(-e->error, buf, sizeof(buf));
+ fprintf(ofd, "-- Error received: %s\n-- Original message: ", buf);
print_header_content(ofd, &e->msg);
fprintf(ofd, "\n");
--- lib/msg.c
+++ lib/msg.c
@@ -961,9 +961,9 @@
struct nlmsgerr *err = nlmsg_data(hdr);
char buf[256];
+ strerror_r(-err->error, buf, sizeof(buf));
fprintf(ofd, " [ERRORMSG] %Zu octets\n", sizeof(*err));
- fprintf(ofd, " .error = %d \"%s\"\n", err->error,
- strerror_r(-err->error, buf, sizeof(buf)));
+ fprintf(ofd, " .error = %d \"%s\"\n", err->error, buf);
fprintf(ofd, " [ORIGINAL MESSAGE] %Zu octets\n", sizeof(*hdr));
errmsg = nlmsg_inherit(&err->msg);

View file

@ -0,0 +1,11 @@
--- lib/Makefile.orig 2008-01-14 16:48:45.000000000 +0100
+++ lib/Makefile 2009-05-26 09:47:42.000000000 +0200
@@ -48,7 +48,7 @@
$(OUT_SLIB): ../Makefile.opts $(OBJ)
@echo " LD $(OUT_SLIB)"; \
- $(CC) -shared -Wl,-soname,libnl.so.1 -o $(OUT_SLIB) $(OBJ) $(LIBNL_LIB) -lc
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,libnl.so.1 -o $(OUT_SLIB) $(OBJ) $(LIBNL_LIB) -lc
@echo " LN $(OUT_SLIB) $(LN1_SLIB)"; \
rm -f $(LN1_SLIB) ; $(LN) -s $(OUT_SLIB) $(LN1_SLIB)
@echo " LN $(LN1_SLIB) $(LN_SLIB)"; \

View file

@ -1,7 +1,7 @@
# Template file for 'libnl'
pkgname=libnl
version=1.1.4
revision=2
revision=3
build_style=gnu-configure
short_desc="Library for applications dealing with netlink sockets"
homepage="http://www.infradead.org/~tgr/libnl/"