Skip to content

Support 2.6.31; fix building on < 2.6.37 where IPv6 is built as a module #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ hone_notify-defsyms :=
obj-$(CONFIG_HONEEVENT) += honeevent.o
honeevent-y := honeevent_imp.o mmutil.o pcapng.o ringbuf.o \
$(call COMBINE,HONE_NOTIFY,$(hone_notify-y))
honeevent-defsyms := uts_sem socket_file_ops get_files_struct put_files_struct
honeevent-defsyms := uts_sem socket_file_ops get_files_struct put_files_struct getboottime

# Handle all the *-defsyms magic.
include $(src)/defsyms.mk
Expand Down
10 changes: 3 additions & 7 deletions src/mmutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
#include <linux/mm.h>
#include <linux/highmem.h>

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
#define D_PATH(mnt, dentry, buf, size) \
({ struct path _p = {(mnt), (dentry)}; d_path(&_p, (buf), (size)); })
#else
#define D_PATH d_path
#endif
#define D_PATH(dentry, mnt, buf, size) \
({ struct path _p = {(mnt), (dentry)}; d_path(&_p, (buf), (size)); })

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
#define __get_exe_file(mm) ((mm)->exe_file)
Expand Down Expand Up @@ -51,7 +47,7 @@ static char *__exe_path(struct mm_struct *mm, char *buf, int buflen)
dentry = dget(exe_file->f_path.dentry);

if (mnt && dentry) {
path = D_PATH(mnt, dentry, buf, buflen);
path = D_PATH(dentry, mnt, buf, buflen);
dput(dentry);
mntput(mnt);
}
Expand Down
15 changes: 2 additions & 13 deletions src/rhel6.patch
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
--- a/src/defsyms.mk
+++ b/src/defsyms.mk
@@ -62,6 +62,7 @@ KBUILD_EXTRA_SYMBOLS += $(obj)/defsyms.symvers
@@ -56,6 +56,7 @@ KBUILD_EXTRA_SYMBOLS += $(obj)/defsyms.symvers
LDFLAGS_MODULE += $(DEFSYMS_LDFLAGS_$(notdir $@))

$(foreach N,$(defsyms-names),$(eval DEFSYMS_LDFLAGS_$(N).ko = -T $(obj)/$(N).defsyms))
+$(foreach N,$(defsyms-names),$(eval DEFSYMS_LDFLAGS_$(N).ko.unsigned = -T $(obj)/$(N).defsyms))

$(defsyms-lds): $(obj)/%.defsyms: $(obj)/.System.map.md5
$(call cmd,defsyms)
--- a/src/socket_lookup.h
+++ b/src/socket_lookup.h
@@ -368,7 +368,7 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
return nexthdr;
}

-# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
extern struct sock *__udp6_lib_lookup(struct net *net,
struct in6_addr *saddr, __be16 sport,
struct in6_addr *daddr, __be16 dport,
--- a/src/socket_notify.c
+++ b/src/socket_notify.c
@@ -31,7 +31,7 @@
@@ -26,7 +26,7 @@
#warning Hone will not provide IPv6 packet/process correlation.
#endif

Expand Down
9 changes: 7 additions & 2 deletions src/socket_lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */

# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
#if defined(CONFIG_IPV6)
extern struct sock *__udp6_lib_lookup(struct net *net,
struct in6_addr *saddr, __be16 sport,
struct in6_addr *daddr, __be16 dport,
Expand All @@ -288,7 +289,11 @@ extern struct sock *__udp6_lib_lookup(struct net *net,
#define udp6_lib_lookup(net, saddr, sport, daddr, dport, dif) \
__udp6_lib_lookup((net), (struct in6_addr *) (saddr), (sport), \
(struct in6_addr *) (daddr), (dport), (dif), &udp_table)
# endif
#else
#define udp6_lib_lookup(net, saddr, sport, daddr, dport, dif) \
NULL
#endif
#endif

static struct sock *lookup_v6_sock(const struct sk_buff *skb,
const struct net_device *indev)
Expand Down