summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxeb <xeb@mail.ru>2009-06-17 10:51:36 +0400
committerxeb <xeb@mail.ru>2009-06-17 10:51:36 +0400
commit6fac2c05c6ad0ea9684ad8be38ae2f12687a4df2 (patch)
treeef3f9ac2392184c0fbc5220fddfb66237e9c45f7
parentdf2441c834cf341d9b969dacc2dd8dac07cd588e (diff)
downloadaccel-ppp-xebd-6fac2c05c6ad0ea9684ad8be38ae2f12687a4df2.tar.gz
accel-ppp-xebd-6fac2c05c6ad0ea9684ad8be38ae2f12687a4df2.zip
* updated support for 2.4 kernel (tested on 2.4.37)
* fixed compilation issue for 2.6.19 kernel
-rw-r--r--.gitignore22
-rw-r--r--kernel/driver/Makefile1
-rw-r--r--kernel/driver/pptp.c84
3 files changed, 106 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9ec4d67
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,22 @@
+*.o
+*.lo
+*.la
+kernel/driver/.pptp.o.flags
+pppd_plugin/Makefile
+pppd_plugin/config.h
+pppd_plugin/config.log
+pppd_plugin/config.status
+pppd_plugin/libtool
+pppd_plugin/src/.deps/
+pppd_plugin/src/.libs/
+pppd_plugin/src/Makefile
+pppd_plugin/stamp-h1
+pptpd-1.3.3/Makefile
+pptpd-1.3.3/bcrelay
+pptpd-1.3.3/config.h
+pptpd-1.3.3/config.log
+pptpd-1.3.3/config.status
+pptpd-1.3.3/plugins/pptpd-logwtmp.so
+pptpd-1.3.3/pptpctrl
+pptpd-1.3.3/pptpd
+pptpd-1.3.3/stamp-h1
diff --git a/kernel/driver/Makefile b/kernel/driver/Makefile
index f36be86..4e7be60 100644
--- a/kernel/driver/Makefile
+++ b/kernel/driver/Makefile
@@ -32,6 +32,7 @@ kernel_headers:
echo "using \"$(KDIR)\" kernel headers"; \
fi
+default: all
clean:
-rm -f *.o *.ko .*.cmd .*.flags *.mod.c
diff --git a/kernel/driver/pptp.c b/kernel/driver/pptp.c
index a12a106..e76fea6 100644
--- a/kernel/driver/pptp.c
+++ b/kernel/driver/pptp.c
@@ -89,6 +89,86 @@ static inline void *kzalloc(size_t size,int gfp)
memset(p,0,size);
return p;
}
+
+/**
+ * __ffs - find first bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __ffs(unsigned long word)
+{
+ int num = 0;
+
+#if BITS_PER_LONG == 64
+ if ((word & 0xffffffff) == 0) {
+ num += 32;
+ word >>= 32;
+ }
+#endif
+ if ((word & 0xffff) == 0) {
+ num += 16;
+ word >>= 16;
+ }
+ if ((word & 0xff) == 0) {
+ num += 8;
+ word >>= 8;
+ }
+ if ((word & 0xf) == 0) {
+ num += 4;
+ word >>= 4;
+ }
+ if ((word & 0x3) == 0) {
+ num += 2;
+ word >>= 2;
+ }
+ if ((word & 0x1) == 0)
+ num += 1;
+ return num;
+}
+
+#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
+/*
+ * Find the next set bit in a memory region.
+ */
+static unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
+ unsigned long offset)
+{
+ const unsigned long *p = addr + BITOP_WORD(offset);
+ unsigned long result = offset & ~(BITS_PER_LONG-1);
+ unsigned long tmp;
+
+ if (offset >= size)
+ return size;
+ size -= result;
+ offset %= BITS_PER_LONG;
+ if (offset) {
+ tmp = *(p++);
+ tmp &= (~0UL << offset);
+ if (size < BITS_PER_LONG)
+ goto found_first;
+ if (tmp)
+ goto found_middle;
+ size -= BITS_PER_LONG;
+ result += BITS_PER_LONG;
+ }
+ while (size & ~(BITS_PER_LONG-1)) {
+ if ((tmp = *(p++)))
+ goto found_middle;
+ result += BITS_PER_LONG;
+ size -= BITS_PER_LONG;
+ }
+ if (!size)
+ return result;
+ tmp = *p;
+
+found_first:
+ tmp &= (~0UL >> (BITS_PER_LONG - size));
+ if (tmp == 0UL) /* Are any bits set? */
+ return result + size; /* Nope. */
+found_middle:
+ return result + __ffs(tmp);
+}
#endif
@@ -489,7 +569,9 @@ static int pptp_rcv_core(struct sock *sk,struct sk_buff *skb)
}
skb->ip_summed=CHECKSUM_NONE;
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
skb_set_network_header(skb,skb->head-skb->data);
+ #endif
ppp_input(&po->chan,skb);
return NET_RX_SUCCESS;
@@ -567,7 +649,7 @@ static int pptp_rcv(struct sk_buff *skb)
#else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */
- #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
+ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,19)
return sk_receive_skb(sk_pppox(po), skb);
#else
return sk_receive_skb(sk_pppox(po), skb, 0);