From 7832dfcb40682e969a9fcade776a1c03a7c9000c Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Fri, 16 Aug 2013 16:59:32 -0400 Subject: [PATCH] Make kernel version default to the latest one we support in the Makefile --- Makefile | 12 ++++++++++-- transforward.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2965572..78b34dd 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,15 @@ obj-m += transforward.o +KVER=$(shell uname -r) +ARCH=$(shell uname -m) +DIST=fc18 # Is there an easy way of fetching this automatically, short of mapping /etc/redhat-release + +ifeq ($(wildcard /lib/modules/$(KVER)/build),) + KVER=3.10.6-100.$(DIST).$(KVER) +endif + all: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + make -C /lib/modules/$(KVER)/build M=$(PWD) modules clean: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean + make -C /lib/modules/$(KVER)/build M=$(PWD) clean diff --git a/transforward.c b/transforward.c index 13e6156..cd1b512 100644 --- a/transforward.c +++ b/transforward.c @@ -41,7 +41,6 @@ MODULE_LICENSE("GPL"); MODULE_VERSION(VERSION_STR); static int address_in_root(unsigned int haddr) { - //printk(KERN_CRIT "In address_in_root: %u",haddr); struct net_device *dev; struct net *net = &init_net; @@ -56,6 +55,7 @@ static int address_in_root(unsigned int haddr) { static int inet_bind_entry(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sockaddr_in *addr = (struct sockaddr_in *)uaddr; unsigned int snum = addr->sin_addr.s_addr; + //printk(KERN_CRIT "Checking address %d",snum); if (address_in_root(snum)) { put_net(sock_net(sock->sk)); sock_net_set(sock->sk, get_net(&init_net)); -- 2.43.0