Remove old patches
This commit is contained in:
parent
1b69650ed4
commit
d605289d23
@ -1,222 +0,0 @@
|
||||
From d82ed2081cf58fb2504ba037d7a1e6444ec5019a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
|
||||
Date: Wed, 28 May 2014 00:11:37 -0400
|
||||
Subject: [PATCH] Port to libnl3
|
||||
|
||||
---
|
||||
libnetlabel/netlabel_comm.c | 35 -----------------------------
|
||||
libnetlabel/netlabel_internal.h | 49 +++++++----------------------------------
|
||||
libnetlabel/netlabel_msg.c | 4 ----
|
||||
macros.mk | 2 +-
|
||||
netlabelctl/Makefile | 2 +-
|
||||
5 files changed, 10 insertions(+), 82 deletions(-)
|
||||
|
||||
diff --git a/libnetlabel/netlabel_comm.c b/libnetlabel/netlabel_comm.c
|
||||
index 289629b..02869e8 100644
|
||||
--- a/libnetlabel/netlabel_comm.c
|
||||
+++ b/libnetlabel/netlabel_comm.c
|
||||
@@ -102,13 +102,8 @@ struct nlbl_handle *nlbl_comm_open(void)
|
||||
goto open_failure;
|
||||
|
||||
/* set the netlink handle properties */
|
||||
-#if LIBNL_VERSION >= 1008
|
||||
nl_socket_set_peer_port(hndl->nl_hndl, 0);
|
||||
nl_set_passcred(hndl->nl_hndl, 1);
|
||||
-#elif LIBNL_VERSION == 1006
|
||||
- nl_handle_set_peer_pid(hndl->nl_hndl, 0);
|
||||
- nl_set_passcred(hndl->nl_hndl, 1);
|
||||
-#endif
|
||||
nl_disable_sequence_check(hndl->nl_hndl);
|
||||
|
||||
/* connect to the generic netlink subsystem in the kernel */
|
||||
@@ -177,11 +172,7 @@ int nlbl_comm_recv_raw(struct nlbl_handle *hndl, unsigned char **data)
|
||||
* no data is waiting to be read from the handle */
|
||||
timeout.tv_sec = nlcomm_read_timeout;
|
||||
timeout.tv_usec = 0;
|
||||
-#if LIBNL_VERSION >= 1008
|
||||
nl_fd = nl_socket_get_fd(hndl->nl_hndl);
|
||||
-#else
|
||||
- nl_fd = nl_handle_get_fd(hndl->nl_hndl);
|
||||
-#endif
|
||||
FD_ZERO(&read_fds);
|
||||
FD_SET(nl_fd, &read_fds);
|
||||
ret_val = select(nl_fd + 1, &read_fds, NULL, NULL, &timeout);
|
||||
@@ -192,15 +183,9 @@ int nlbl_comm_recv_raw(struct nlbl_handle *hndl, unsigned char **data)
|
||||
|
||||
/* perform the read operation */
|
||||
*data = NULL;
|
||||
-#if LIBNL_VERSION >= 1006
|
||||
ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, data, &creds);
|
||||
if (ret_val < 0)
|
||||
return ret_val;
|
||||
-#else
|
||||
- ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, data);
|
||||
- if (ret_val < 0)
|
||||
- return ret_val;
|
||||
-#endif
|
||||
|
||||
/* if we are setup to receive credentials, only accept messages from
|
||||
* the kernel (ignore all others and send an -EAGAIN) */
|
||||
@@ -251,11 +236,7 @@ int nlbl_comm_recv(struct nlbl_handle *hndl, nlbl_msg **msg)
|
||||
* no data is waiting to be read from the handle */
|
||||
timeout.tv_sec = nlcomm_read_timeout;
|
||||
timeout.tv_usec = 0;
|
||||
-#if LIBNL_VERSION >= 1008
|
||||
nl_fd = nl_socket_get_fd(hndl->nl_hndl);
|
||||
-#else
|
||||
- nl_fd = nl_handle_get_fd(hndl->nl_hndl);
|
||||
-#endif
|
||||
FD_ZERO(&read_fds);
|
||||
FD_SET(nl_fd, &read_fds);
|
||||
ret_val = select(nl_fd + 1, &read_fds, NULL, NULL, &timeout);
|
||||
@@ -265,19 +246,9 @@ int nlbl_comm_recv(struct nlbl_handle *hndl, nlbl_msg **msg)
|
||||
return -EAGAIN;
|
||||
|
||||
/* perform the read operation */
|
||||
-#if LIBNL_VERSION >= 1100
|
||||
ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, &data, &creds);
|
||||
if (ret_val < 0)
|
||||
return ret_val;
|
||||
-#elif LIBNL_VERSION >= 1006
|
||||
- ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, data, &creds);
|
||||
- if (ret_val < 0)
|
||||
- return ret_val;
|
||||
-#else
|
||||
- ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, data);
|
||||
- if (ret_val < 0)
|
||||
- return ret_val;
|
||||
-#endif
|
||||
|
||||
/* if we are setup to receive credentials, only accept messages from
|
||||
* the kernel (ignore all others and send an -EAGAIN) */
|
||||
@@ -344,9 +315,7 @@ int nlbl_comm_send(struct nlbl_handle *hndl, nlbl_msg *msg)
|
||||
creds.gid = getegid();
|
||||
|
||||
/* set the message properties */
|
||||
-#if LIBNL_VERSION >= 1006
|
||||
nlmsg_set_creds(msg, &creds);
|
||||
-#endif
|
||||
|
||||
/* request a netlink ack message */
|
||||
nl_hdr = nlbl_msg_nlhdr(msg);
|
||||
@@ -355,9 +324,5 @@ int nlbl_comm_send(struct nlbl_handle *hndl, nlbl_msg *msg)
|
||||
nl_hdr->nlmsg_flags |= NLM_F_ACK;
|
||||
|
||||
/* send the message */
|
||||
-#if LIBNL_VERSION == 1005
|
||||
- return nl_send_auto_complete(hndl->nl_hndl, nlbl_msg_nlhdr(msg));
|
||||
-#elif LIBNL_VERSION >= 1006
|
||||
return nl_send_auto_complete(hndl->nl_hndl, msg);
|
||||
-#endif
|
||||
}
|
||||
diff --git a/libnetlabel/netlabel_internal.h b/libnetlabel/netlabel_internal.h
|
||||
index acc2f03..54200af 100644
|
||||
--- a/libnetlabel/netlabel_internal.h
|
||||
+++ b/libnetlabel/netlabel_internal.h
|
||||
@@ -27,6 +27,14 @@
|
||||
|
||||
#include <netlink/netlink.h>
|
||||
|
||||
+#define nl_handle_alloc nl_socket_alloc
|
||||
+#define nl_handle_destroy nl_socket_free
|
||||
+#define nl_handle nl_sock
|
||||
+#define nlmsg_build(ptr) nlmsg_inherit(ptr)
|
||||
+#define nl_set_passcred nl_socket_set_passcred
|
||||
+#define nl_disable_sequence_check nl_socket_disable_seq_check
|
||||
+#define nlmsg_len nlmsg_datalen
|
||||
+
|
||||
/* NetLabel communication handle */
|
||||
struct nlbl_handle {
|
||||
struct nl_handle *nl_hndl;
|
||||
@@ -37,46 +45,5 @@ struct nlbl_handle {
|
||||
(((hdr)->nlmsg_flags & NLM_F_MULTI) && \
|
||||
((hdr)->nlmsg_type != NLMSG_DONE)))
|
||||
|
||||
-/* Specify which version of libnl we are using */
|
||||
-/* 1.0-pre5 => 1005 */
|
||||
-/* 1.0-pre6 => 1006 */
|
||||
-/* 1.0-pre8 => 1008 */
|
||||
-/* 1.1 => 1100 */
|
||||
-#define LIBNL_VERSION 1100
|
||||
-
|
||||
-/* XXX - this whole block will most likely go away once libnl supports Generic
|
||||
- * Netlink */
|
||||
-#if LIBNL_VERSION <= 1006 /* Generic Netlink types */
|
||||
-
|
||||
-/* Generic Netlink message header */
|
||||
-struct genlmsghdr {
|
||||
- uint8_t cmd;
|
||||
- uint8_t version;
|
||||
- uint16_t reserved;
|
||||
-};
|
||||
-
|
||||
-#define GENL_ID_CTRL 0x10
|
||||
-
|
||||
-enum {
|
||||
- CTRL_CMD_UNSPEC,
|
||||
- CTRL_CMD_NEWFAMILY,
|
||||
- CTRL_CMD_DELFAMILY,
|
||||
- CTRL_CMD_GETFAMILY,
|
||||
- CTRL_CMD_NEWOPS,
|
||||
- CTRL_CMD_DELOPS,
|
||||
- CTRL_CMD_GETOPS,
|
||||
- __CTRL_CMD_MAX,
|
||||
-};
|
||||
-#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
|
||||
-
|
||||
-enum {
|
||||
- CTRL_ATTR_UNSPEC,
|
||||
- CTRL_ATTR_FAMILY_ID,
|
||||
- CTRL_ATTR_FAMILY_NAME,
|
||||
- __CTRL_ATTR_MAX,
|
||||
-};
|
||||
-#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
|
||||
-
|
||||
-#endif /* Generic Netlink types */
|
||||
|
||||
#endif
|
||||
diff --git a/libnetlabel/netlabel_msg.c b/libnetlabel/netlabel_msg.c
|
||||
index fb2fc58..af00fbe 100644
|
||||
--- a/libnetlabel/netlabel_msg.c
|
||||
+++ b/libnetlabel/netlabel_msg.c
|
||||
@@ -63,11 +63,7 @@ nlbl_msg *nlbl_msg_new(void)
|
||||
struct genlmsghdr genl_hdr;
|
||||
|
||||
/* create the message with a simple netlink header */
|
||||
-#if LIBNL_VERSION >= 1008
|
||||
msg = nlmsg_alloc();
|
||||
-#else
|
||||
- msg = nlmsg_build_no_hdr();
|
||||
-#endif
|
||||
if (msg == NULL)
|
||||
goto msg_new_failure;
|
||||
|
||||
diff --git a/macros.mk b/macros.mk
|
||||
index a9466f0..b9f8813 100644
|
||||
--- a/macros.mk
|
||||
+++ b/macros.mk
|
||||
@@ -53,7 +53,7 @@ CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/include
|
||||
LIBFLAGS =
|
||||
|
||||
CFLAGS ?= -Wl,-z,relro -Wall -O0 -g
|
||||
-CFLAGS += -fPIC
|
||||
+CFLAGS += `pkg-config --cflags libnl-3.0` -fPIC
|
||||
LDFLAGS ?= -z relro -g
|
||||
|
||||
#
|
||||
diff --git a/netlabelctl/Makefile b/netlabelctl/Makefile
|
||||
index 06af6a5..07cebbb 100644
|
||||
--- a/netlabelctl/Makefile
|
||||
+++ b/netlabelctl/Makefile
|
||||
@@ -49,7 +49,7 @@ CONF_FILE = netlabel.rules
|
||||
|
||||
OBJS = main.o mgmt.o map.o unlabeled.o cipsov4.o
|
||||
|
||||
-LDFLAGS := ../libnetlabel/libnetlabel.a -lnl -lm
|
||||
+LDFLAGS := ../libnetlabel/libnetlabel.a `pkg-config --libs libnl-3.0` -lm
|
||||
|
||||
DEPS = $(OBJS:%.o=%.d)
|
||||
|
||||
--
|
||||
1.8.4.5
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
diff -up netlabel_tools-0.19/Makefile.new-hdrs netlabel_tools-0.19/Makefile
|
||||
--- netlabel_tools-0.19/Makefile.new-hdrs 2009-01-05 22:24:24.000000000 +0100
|
||||
+++ netlabel_tools-0.19/Makefile 2010-06-16 13:36:55.170646610 +0200
|
||||
@@ -41,8 +41,9 @@ INSTALL_SBIN_DIR = $(INSTALL_PREFIX)/sbi
|
||||
INSTALL_BIN_DIR = $(INSTALL_PREFIX)/bin
|
||||
INSTALL_MAN_DIR = $(INSTALL_PREFIX)/share/man
|
||||
|
||||
-OWNER = root
|
||||
-GROUP = root
|
||||
+# Mock doesn't allow this.
|
||||
+# OWNER = root
|
||||
+# GROUP = root
|
||||
|
||||
#
|
||||
# targets
|
||||
@@ -70,15 +71,15 @@ install: $(SUBDIRS)
|
||||
@echo "INFO: installing files in $(INSTALL_PREFIX)"
|
||||
@mkdir -p $(INSTALL_SBIN_DIR)
|
||||
@mkdir -p $(INSTALL_MAN_DIR)/man8
|
||||
- @install -o $(OWNER) -g $(GROUP) -m 755 netlabelctl/netlabelctl \
|
||||
+ @install -m 755 netlabelctl/netlabelctl \
|
||||
$(INSTALL_SBIN_DIR)/netlabelctl
|
||||
- @install -o $(OWNER) -g $(GROUP) -m 644 docs/man/netlabelctl.8 \
|
||||
+ @install -m 644 docs/man/netlabelctl.8 \
|
||||
$(INSTALL_MAN_DIR)/man8
|
||||
|
||||
$(VERSION_HDR): version_info
|
||||
@echo "INFO: creating the version header file"
|
||||
@hdr="$(VERSION_HDR)"; \
|
||||
- . version_info; \
|
||||
+ . ./version_info; \
|
||||
echo "/* automatically generated - do not edit */" > $$hdr; \
|
||||
echo "#ifndef _VERSION_H" >> $$hdr; \
|
||||
echo "#define _VERSION_H" >> $$hdr; \
|
||||
@ -1,10 +0,0 @@
|
||||
--- netlabel_tools-0.19/netlabelctl/main.c 2009-01-05 16:24:16.000000000 -0500
|
||||
+++ netlabel_tools-0.19.new/netlabelctl/main.c 2010-06-17 02:54:06.864494476 -0400
|
||||
@@ -352,6 +352,7 @@
|
||||
fprintf(stderr,
|
||||
MSG_ERR("unknown or missing module '%s'\n"),
|
||||
module_name);
|
||||
+ ret_val = 1;
|
||||
goto exit;
|
||||
}
|
||||
ret_val = module_main(argc - optind - 1, argv + optind + 1);
|
||||
Loading…
Reference in New Issue
Block a user