@@ -14,7 +14,7 @@
#define __LIBCTNETLINK_H
#include <sys/time.h>
-#include <libnfnetlink/libnfnetlink.h>
+#include <libmnl/libmnl.h>
#include <libnetfilter_queue/linux_list.h>
#include <libnetfilter_queue/linux_nfnetlink_queue.h>
@@ -26,6 +26,7 @@ extern "C" {
struct nfq_handle;
struct nfq_q_handle;
struct nfq_data;
+struct nlif_handle;
extern int nfq_errno;
@@ -156,8 +157,41 @@ int nfq_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr **attr);
struct nlmsghdr *nfq_nlmsg_put(char *buf, int type, uint32_t queue_num);
struct nlmsghdr *nfq_nlmsg_put2(char *buf, int type, uint32_t queue_num, uint16_t flags);
+/*
+ * Network Interface Table API
+ */
+
+#ifndef IFNAMSIZ
+#define IFNAMSIZ 16
+#endif
+
+struct nlif_handle *nlif_open(void);
+void nlif_close(struct nlif_handle *orig);
+int nlif_fd(struct nlif_handle *nlif_handle);
+int nlif_query(struct nlif_handle *nlif_handle);
+int nlif_catch(struct nlif_handle *nlif_handle);
+int nlif_index2name(struct nlif_handle *nlif_handle, unsigned int if_index, char *name);
+int nlif_get_ifflags(const struct nlif_handle *h, unsigned int index, unsigned int *flags);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
+/*
+ * __be46 stuff - should be in libmnl.h maybe?
+ */
+
+#include <byteswap.h>
+#if __BYTE_ORDER == __BIG_ENDIAN
+# ifndef __be64_to_cpu
+# define __be64_to_cpu(x) (x)
+# endif
+# else
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# ifndef __be64_to_cpu
+# define __be64_to_cpu(x) __bswap_64(x)
+# endif
+# endif
+#endif
+
#endif /* __LIBNFQNETLINK_H */
@@ -151,7 +151,7 @@ struct nfnl_subsys_handle {
uint32_t subscriptions;
uint8_t subsys_id;
uint8_t cb_count;
- struct nfnl_callback *cb; /* array of callbacks */
+ struct nfnl_callback2 *cb; /* Not an exact copy: array of callbacks */
};
struct nfnl_handle {
@@ -479,7 +479,7 @@ struct nfq_handle *nfq_open(void)
h->nfnlh->fd = h->nl->fd;
h->nfnlh->local = h->nl->addr;
h->nfnlh->peer.nl_family = AF_NETLINK;
- h->nfnlh->rcv_buffer_size = NFNL_BUFFSIZE;
+ h->nfnlh->rcv_buffer_size = MNL_SOCKET_BUFFER_SIZE;
if (!fill_nfnl_subsys_handle(h))
goto err_close;
Add nlif_* prototypes and 64-bit converters to libnetfilter_queue.h. Fix a couple of libnfnetlink.h references still in libnetfilter_queue.c. Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au> --- .../libnetfilter_queue/libnetfilter_queue.h | 36 ++++++++++++++++++- src/libnetfilter_queue.c | 4 +-- 2 files changed, 37 insertions(+), 3 deletions(-)