Hello community, here is the log from the commit of package ndiswrapper for openSUSE:Factory checked in at 2013-12-02 07:23:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ndiswrapper (Old) and /work/SRC/openSUSE:Factory/.ndiswrapper.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ndiswrapper" Changes: -------- --- /work/SRC/openSUSE:Factory/ndiswrapper/ndiswrapper.changes 2013-09-26 14:45:06.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ndiswrapper.new/ndiswrapper.changes 2013-12-02 07:23:58.000000000 +0100 @@ -1,0 +2,12 @@ +Fri Nov 29 09:40:03 UTC 2013 - [email protected] + +- Update to version 1.59 + * Support for Linux kernels from 2.6.13 to 3.12 + * 32-bit userspace on 64-bit kernel is supported now + * Fixed kernel hang if loadndisdriver exits with an error +- Removed patchs; fixed on upstream + * ndiswrapper-1.58-kernel-3.9.patch + * ndiswrapper-1.58-kernel-3.10.patch +- Adapt ndiswrapper.diff to upstream changes + +------------------------------------------------------------------- Old: ---- ndiswrapper-1.58-kernel-3.10.patch ndiswrapper-1.58-kernel-3.9.patch ndiswrapper-1.58.tar.gz ndiswrapper.diff New: ---- ndiswrapper-1.59.diff ndiswrapper-1.59.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ndiswrapper.spec ++++++ --- /var/tmp/diff_new_pack.WAcrvS/_old 2013-12-02 07:23:59.000000000 +0100 +++ /var/tmp/diff_new_pack.WAcrvS/_new 2013-12-02 07:23:59.000000000 +0100 @@ -17,7 +17,7 @@ Name: ndiswrapper -Version: 1.58 +Version: 1.59 Release: 0 Summary: Use Microsoft NDIS Network Drivers for WLAN Cards License: GPL-2.0+ @@ -26,9 +26,7 @@ Source0: http://downloads.sourceforge.net/project/ndiswrapper/stable/ndiswrapper-%{version}.tar.gz Source2: README.SUSE Source3: preamble -Patch1: ndiswrapper.diff -Patch2: ndiswrapper-1.58-kernel-3.9.patch -Patch3: ndiswrapper-1.58-kernel-3.10.patch +Patch1: ndiswrapper-1.59.diff BuildRequires: kernel-source BuildRequires: kernel-syms BuildRequires: module-init-tools @@ -59,8 +57,6 @@ %prep %setup -q %patch1 -%patch2 -p1 -%patch3 -p1 cp %{SOURCE2} . mkdir obj ++++++ ndiswrapper-1.59.diff ++++++ Index: utils/Makefile =================================================================== --- utils/Makefile.orig +++ utils/Makefile @@ -6,7 +6,7 @@ CC = gcc HOSTCC = $(CC) -CFLAGS = -g -Wall -I$(DRIVER_DIR) +CFLAGS = -I$(DRIVER_DIR) DISTFILES=Makefile ndiswrapper loadndisdriver.c ndiswrapper-buginfo ++++++ ndiswrapper-1.58.tar.gz -> ndiswrapper-1.59.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/ChangeLog new/ndiswrapper-1.59/ChangeLog --- old/ndiswrapper-1.58/ChangeLog 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/ChangeLog 2013-11-28 20:42:35.000000000 +0100 @@ -1,3 +1,9 @@ +Version 1.59 2013-11-28 +======================= +* Support for Linux kernels from 2.6.13 to 3.12 +* 32-bit userspace on 64-bit kernel is supported now +* Fixed kernel hang if loadndisdriver exits with an error + Version 1.58 2013-02-19 ======================= * Added support for Linux kernels up to 3.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/INSTALL new/ndiswrapper-1.59/INSTALL --- old/ndiswrapper-1.58/INSTALL 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/INSTALL 2013-11-28 20:42:35.000000000 +0100 @@ -7,7 +7,7 @@ Prerequisites ============= -You need a recent kernel, at least 2.6.14, with header files for the +You need a recent kernel, at least 2.6.13, with header files for the kernel. Make sure there is a link to the kernel source from the modules directory. The command diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/Makefile new/ndiswrapper-1.59/Makefile --- old/ndiswrapper-1.58/Makefile 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/Makefile 2013-11-28 20:42:35.000000000 +0100 @@ -15,8 +15,6 @@ mandir = /usr/share/man endif -KVERS ?= $(shell uname -r) - .PHONY: all all: $(SUBDIRS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/Makefile new/ndiswrapper-1.59/driver/Makefile --- old/ndiswrapper-1.58/driver/Makefile 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/Makefile 2013-11-28 20:42:35.000000000 +0100 @@ -28,6 +28,12 @@ $(error No .config found in $(KBUILD), please set KBUILD to configured kernel) endif +ifneq (,$(wildcard $(KBUILD)/include/linux/version.h)) +ifneq (,$(wildcard $(KBUILD)/include/generated/uapi/linux/version.h)) +$(error Multiple copies of version.h found, please clean your build tree) +endif +endif + # Kernel Makefile doesn't always know the exact kernel version, so we # get it from the kernel headers instead and pass it to make. VERSION_H := $(KBUILD)/include/generated/utsrelease.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/loader.c new/ndiswrapper-1.59/driver/loader.c --- old/ndiswrapper-1.58/driver/loader.c 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/loader.c 2013-11-28 20:42:35.000000000 +0100 @@ -93,8 +93,9 @@ TRACE1("loading driver %s", wd->driver_name); mutex_lock(&loader_mutex); - INIT_COMPLETION(loader_complete); - ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, 1); + reinit_completion(&loader_complete); + ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, + UMH_WAIT_PROC); if (ret) { mutex_unlock(&loader_mutex); ERROR("couldn't load driver %s; check system log " @@ -248,8 +249,9 @@ TRACE1("loading bin file %s/%s", driver->name, driver->bin_files[i].name); mutex_lock(&loader_mutex); - INIT_COMPLETION(loader_complete); - ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, 1); + reinit_completion(&loader_complete); + ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, + UMH_WAIT_PROC); if (ret) { mutex_unlock(&loader_mutex); ERROR("couldn't load file %s/%s; check system log " @@ -575,7 +577,7 @@ } else { printk(KERN_INFO "%s: driver %s (%s) loaded\n", DRIVER_NAME, wrap_driver->name, wrap_driver->version); - add_taint(TAINT_PROPRIETARY_MODULE); + add_taint(TAINT_PROPRIETARY_MODULE, LOCKDEP_NOW_UNRELIABLE); EXIT1(return 0); } } @@ -686,8 +688,9 @@ TRACE2("%s, %s, %s, %s, %s", vendor, device, subvendor, subdevice, bus); mutex_lock(&loader_mutex); - INIT_COMPLETION(loader_complete); - ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, 1); + reinit_completion(&loader_complete); + ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, + UMH_WAIT_PROC); if (ret) { mutex_unlock(&loader_mutex); TRACE1("couldn't load device %04x:%04x; check system " @@ -736,13 +739,8 @@ } /* called with loader_mutex is down */ -#ifdef HAVE_UNLOCKED_IOCTL -static long wrapper_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -#else -static int wrapper_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) -#endif +static long wrapper_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) { struct load_driver *load_driver; struct load_device load_device; @@ -750,7 +748,7 @@ int ret; void __user *addr = (void __user *)arg; - ENTER1("cmd: %u", cmd); + ENTER1("cmd: 0x%x", cmd); ret = 0; switch (cmd) { @@ -806,26 +804,124 @@ ret = add_bin_file(&load_bin_file); break; default: - ERROR("unknown ioctl %u", cmd); + ERROR("unknown ioctl 0x%x", cmd); + ret = -EINVAL; + break; + } + complete(&loader_complete); + EXIT1(return ret); +} + +#ifdef CONFIG_COMPAT +static int copy_load_driver_file32(struct load_driver_file *k, + struct load_driver_file32 __user *u) +{ + u32 data; + + if (copy_from_user(&k->driver_name, &u->driver_name, + sizeof(u->driver_name) + sizeof(u->name))) + return -EFAULT; + + if (get_user(k->size, &u->size)) + return -EFAULT; + if (get_user(data, &u->data)) + return -EFAULT; + + k->data = (void __user *)(unsigned long)data; + return 0; +} + +static int copy_load_driver32(struct load_driver *k, + struct load_driver32 __user *u) +{ + int i; + + if (copy_from_user(&k->name, &u->name, + sizeof(u->name) + sizeof(u->conf_file_name))) + return -EFAULT; + + if (get_user(k->num_sys_files, &u->num_sys_files)) + return -EFAULT; + + for (i = 0; i < k->num_sys_files; i++) + if (copy_load_driver_file32(&k->sys_files[i], &u->sys_files[i])) + return -EFAULT; + + if (get_user(k->num_settings, &u->num_settings)) + return -EFAULT; + + if (copy_from_user(&k->settings, &u->settings, + sizeof(u->settings[0]) * k->num_settings)) + return -EFAULT; + + if (get_user(k->num_bin_files, &u->num_bin_files)) + return -EFAULT; + + for (i = 0; i < k->num_bin_files; i++) + if (copy_load_driver_file32(&k->bin_files[i], &u->bin_files[i])) + return -EFAULT; + + return 0; +} + +static long wrapper_ioctl_compat(struct file *file, unsigned int cmd, + unsigned long arg) +{ + int ret = 0; + void __user *addr = (void __user *)arg; + struct load_driver *kdriver; + struct load_driver32 __user *udriver = addr; + struct load_driver_file kfile; + struct load_driver_file32 __user *ufile = addr; + + ENTER1("cmd: 0x%x", cmd); + + switch (cmd) { + case WRAP_IOCTL_LOAD_DEVICE32: + return wrapper_ioctl(file, WRAP_IOCTL_LOAD_DEVICE, arg); + case WRAP_IOCTL_LOAD_DRIVER32: + TRACE1("loading driver at %p", addr); + kdriver = vmalloc(sizeof(*kdriver)); + if (!kdriver) { + ret = -ENOMEM; + break; + } + + ret = copy_load_driver32(kdriver, udriver); + if (!ret) + ret = load_user_space_driver(kdriver); + + vfree(kdriver); + break; + case WRAP_IOCTL_LOAD_BIN_FILE32: + ret = copy_load_driver_file32(&kfile, ufile); + if (ret) + break; + + ret = add_bin_file(&kfile); + break; + default: + ERROR("unknown ioctl 0x%x", cmd); ret = -EINVAL; break; } complete(&loader_complete); EXIT1(return ret); } +#endif static int wrapper_ioctl_release(struct inode *inode, struct file *file) { ENTER1(""); + complete(&loader_complete); return 0; } static struct file_operations wrapper_fops = { .owner = THIS_MODULE, -#ifdef HAVE_UNLOCKED_IOCTL .unlocked_ioctl = wrapper_ioctl, -#else - .ioctl = wrapper_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = wrapper_ioctl_compat, #endif .release = wrapper_ioctl_release, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/loader.h new/ndiswrapper-1.59/driver/loader.h --- old/ndiswrapper-1.58/driver/loader.h 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/loader.h 2013-11-28 20:42:35.000000000 +0100 @@ -44,11 +44,6 @@ char driver_name[MAX_DRIVER_NAME_LEN]; }; -struct load_devices { - int count; - struct load_device *devices; -}; - struct load_driver { char name[MAX_DRIVER_NAME_LEN]; char conf_file_name[MAX_DRIVER_NAME_LEN]; @@ -67,6 +62,30 @@ #define WRAP_IOCTL_LOAD_BIN_FILE _IOW(('N' + 'd' + 'i' + 'S'), 2, \ struct load_driver_file *) +#ifdef CONFIG_COMPAT +struct load_driver_file32 { + char driver_name[MAX_DRIVER_NAME_LEN]; + char name[MAX_DRIVER_NAME_LEN]; + u32 size; + u32 data; +}; + +struct load_driver32 { + char name[MAX_DRIVER_NAME_LEN]; + char conf_file_name[MAX_DRIVER_NAME_LEN]; + u32 num_sys_files; + struct load_driver_file32 sys_files[MAX_DRIVER_PE_IMAGES]; + u32 num_settings; + struct load_device_setting settings[MAX_DEVICE_SETTINGS]; + u32 num_bin_files; + struct load_driver_file32 bin_files[MAX_DRIVER_BIN_FILES]; +} __packed; + +#define WRAP_IOCTL_LOAD_DEVICE32 _IOW(('N' + 'd' + 'i' + 'S'), 0, u32) +#define WRAP_IOCTL_LOAD_DRIVER32 _IOW(('N' + 'd' + 'i' + 'S'), 1, u32) +#define WRAP_IOCTL_LOAD_BIN_FILE32 _IOW(('N' + 'd' + 'i' + 'S'), 2, u32) +#endif + #define WRAP_CMD_LOAD_DEVICE "load_device" #define WRAP_CMD_LOAD_DRIVER "load_driver" #define WRAP_CMD_LOAD_BIN_FILE "load_bin_file" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/ndiswrapper.h new/ndiswrapper-1.59/driver/ndiswrapper.h --- old/ndiswrapper-1.58/driver/ndiswrapper.h 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/ndiswrapper.h 2013-11-28 20:42:36.000000000 +0100 @@ -16,7 +16,7 @@ #ifndef _NDISWRAPPER_H_ #define _NDISWRAPPER_H_ -#define DRIVER_VERSION "1.58" +#define DRIVER_VERSION "1.59" #define UTILS_VERSION "1.9" #define DRIVER_NAME "ndiswrapper" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/ntoskernel.h new/ndiswrapper-1.59/driver/ntoskernel.h --- old/ndiswrapper-1.58/driver/ntoskernel.h 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/ntoskernel.h 2013-11-28 20:42:36.000000000 +0100 @@ -51,6 +51,20 @@ #error "this module is for x86 or x86_64 architectures only" #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) +#define gfp_t unsigned int __nocast + +static inline void *_kzalloc(size_t size, gfp_t flags) +{ + void *p = kmalloc(size, flags); + if (likely(p != NULL)) + memset(p, 0, size); + return p; +} + +#define kzalloc(size, flags) _kzalloc(size, flags) +#endif + /* Interrupt backwards compatibility stuff */ #include <linux/interrupt.h> #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) @@ -76,6 +90,7 @@ #define set_cpus_allowed_ptr(task, mask) set_cpus_allowed(task, *mask) #endif /* Linux < 2.6.26 */ +#ifdef CONFIG_SMP #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) #define cpumask_copy(dst, src) do { *dst = *src; } while (0) #define cpumask_equal(mask1, mask2) cpus_equal(*mask1, *mask2) @@ -87,6 +102,7 @@ &cpumasks[cpu]; \ }) #endif /* Linux < 2.6.28 */ +#endif /* CONFIG_SMP */ #ifndef tsk_cpus_allowed #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) @@ -239,6 +255,10 @@ #define IRQF_SHARED SA_SHIRQ #endif +#ifndef UMH_WAIT_PROC +#define UMH_WAIT_PROC 1 +#endif + #define memcpy_skb(skb, from, length) \ memcpy(skb_put(skb, length), from, length) @@ -266,6 +286,14 @@ #define usb_free_coherent(dev, size, addr, dma) (usb_buffer_free((dev), (size), (addr), (dma))) #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) +#define daemonize(name, ...) do {} while (0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) +#define add_taint(flag, lockdep_ok) add_taint(flag) +#endif + #include "winnt_types.h" #include "ndiswrapper.h" #include "pe_linker.h" @@ -315,6 +343,17 @@ #endif #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) +#define netdev_notifier_info_to_dev(x) ((struct net_device *)(x)) +#endif + +#ifdef INIT_COMPLETION +static inline void reinit_completion(struct completion *x) +{ + INIT_COMPLETION(*x); +} +#endif + /* TICK is 100ns */ #define TICKSPERSEC 10000000 #define TICKSPERMSEC 10000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/ntoskernel_io.c new/ndiswrapper-1.59/driver/ntoskernel_io.c --- old/ndiswrapper-1.58/driver/ntoskernel_io.c 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/ntoskernel_io.c 2013-11-28 20:42:36.000000000 +0100 @@ -1150,3 +1150,12 @@ TODO(); IOEXIT(return STATUS_NOT_IMPLEMENTED); } + +wstdcall void WIN_FUNC(IoGetStackLimits,2) + (ULONG_PTR *LowLimit, ULONG_PTR *HighLimit) +{ + *LowLimit = (ULONG_PTR)&LowLimit & ~(THREAD_SIZE - 1); + *HighLimit = *LowLimit + THREAD_SIZE; + IOTRACE("LowLimit: 0x%lx, HighLimit: 0x%lx", *LowLimit, *HighLimit); + IOEXIT(return); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/proc.c new/ndiswrapper-1.59/driver/proc.c --- old/ndiswrapper-1.58/driver/proc.c 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/proc.c 2013-11-28 20:42:36.000000000 +0100 @@ -13,6 +13,7 @@ * */ #include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <linux/module.h> #include <asm/uaccess.h> @@ -24,117 +25,199 @@ #define MAX_PROC_STR_LEN 32 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) +static kuid_t proc_kuid; +static kgid_t proc_kgid; +#else +#define proc_kuid proc_uid +#define proc_kgid proc_gid +#define kuid_t uid_t +#define kgid_t gid_t +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static inline struct inode *file_inode(struct file *f) +{ + return f->f_dentry->d_inode; +} +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) +static inline struct inode *file_inode(struct file *f) +{ + return f->f_path.dentry->d_inode; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) +static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, + kgid_t gid) +{ + de->uid = uid; + de->gid = gid; +} + +static inline void proc_remove(struct proc_dir_entry *de) +{ + if (de) + remove_proc_entry(de->name, de->parent); +} + +static inline void *PDE_DATA(const struct inode *inode) +{ + return PDE(inode)->data; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) +static inline struct proc_dir_entry *proc_create_data(const char *name, + umode_t mode, struct proc_dir_entry *parent, + struct file_operations *fops, void *data) +{ + struct proc_dir_entry *de; + + de = create_proc_entry(name, mode, parent); + if (de) { + de->data = data; + de->proc_fops = fops; + } + + return de; +} +#endif + +static int do_proc_make_entry(const char *name, umode_t mode, + struct proc_dir_entry *parent, + struct file_operations *fops, kuid_t uid, + kgid_t gid, struct ndis_device *wnd) +{ + struct proc_dir_entry *de; + + de = proc_create_data(name, mode, parent, fops, wnd); + if (de == NULL) { + ERROR("couldn't create proc entry for '%s'", name); + return -ENOMEM; + } + proc_set_user(de, uid, gid); + return 0; +} + +#define PROC_DECLARE_RO(name) \ + static int proc_##name##_open(struct inode *inode, struct file *file) \ + { \ + return single_open(file, proc_##name##_read, PDE_DATA(inode)); \ + } \ + static struct file_operations name##_fops = { \ + .owner = THIS_MODULE, \ + .open = proc_##name##_open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ + }; + +#define PROC_DECLARE_RW(name) \ + static int proc_##name##_open(struct inode *inode, struct file *file) \ + { \ + return single_open(file, proc_##name##_read, PDE_DATA(inode)); \ + } \ + static struct file_operations name##_fops = { \ + .owner = THIS_MODULE, \ + .open = proc_##name##_open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ + .write = proc_##name##_write, \ + }; + +#define proc_make_entry_ro(name, parent, wnd) \ + do_proc_make_entry(#name, S_IFREG | S_IRUSR | S_IRGRP, parent, \ + &name##_fops, proc_kuid, proc_kgid, wnd) +#define proc_make_entry_rw(name, parent, wnd) \ + do_proc_make_entry(#name, \ + S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP, \ + parent, &name##_fops, proc_kuid, proc_kgid, wnd) + +#define add_text(fmt, ...) seq_printf(sf, fmt, ##__VA_ARGS__) + static struct proc_dir_entry *wrap_procfs_entry; -static int procfs_read_ndis_stats(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int proc_stats_read(struct seq_file *sf, void *v) { - char *p = page; - struct ndis_device *wnd = (struct ndis_device *)data; + struct ndis_device *wnd = (struct ndis_device *)sf->private; struct ndis_wireless_stats stats; NDIS_STATUS res; ndis_rssi rssi; - if (off != 0) { - *eof = 1; - return 0; - } - res = mp_query(wnd, OID_802_11_RSSI, &rssi, sizeof(rssi)); if (!res) - p += sprintf(p, "signal_level=%d dBm\n", (s32)rssi); + add_text("signal_level=%d dBm\n", (s32)rssi); res = mp_query(wnd, OID_802_11_STATISTICS, &stats, sizeof(stats)); if (!res) { - - p += sprintf(p, "tx_frames=%llu\n", stats.tx_frag); - p += sprintf(p, "tx_multicast_frames=%llu\n", - stats.tx_multi_frag); - p += sprintf(p, "tx_failed=%llu\n", stats.failed); - p += sprintf(p, "tx_retry=%llu\n", stats.retry); - p += sprintf(p, "tx_multi_retry=%llu\n", stats.multi_retry); - p += sprintf(p, "tx_rtss_success=%llu\n", stats.rtss_succ); - p += sprintf(p, "tx_rtss_fail=%llu\n", stats.rtss_fail); - p += sprintf(p, "ack_fail=%llu\n", stats.ack_fail); - p += sprintf(p, "frame_duplicates=%llu\n", stats.frame_dup); - p += sprintf(p, "rx_frames=%llu\n", stats.rx_frag); - p += sprintf(p, "rx_multicast_frames=%llu\n", - stats.rx_multi_frag); - p += sprintf(p, "fcs_errors=%llu\n", stats.fcs_err); - } - - if (p - page > count) { - ERROR("wrote %td bytes (limit is %u)\n", - p - page, count); - *eof = 1; + add_text("tx_frames=%llu\n", stats.tx_frag); + add_text("tx_multicast_frames=%llu\n", stats.tx_multi_frag); + add_text("tx_failed=%llu\n", stats.failed); + add_text("tx_retry=%llu\n", stats.retry); + add_text("tx_multi_retry=%llu\n", stats.multi_retry); + add_text("tx_rtss_success=%llu\n", stats.rtss_succ); + add_text("tx_rtss_fail=%llu\n", stats.rtss_fail); + add_text("ack_fail=%llu\n", stats.ack_fail); + add_text("frame_duplicates=%llu\n", stats.frame_dup); + add_text("rx_frames=%llu\n", stats.rx_frag); + add_text("rx_multicast_frames=%llu\n", stats.rx_multi_frag); + add_text("fcs_errors=%llu\n", stats.fcs_err); } - return p - page; + return 0; } -static int procfs_read_ndis_encr(char *page, char **start, off_t off, - int count, int *eof, void *data) +PROC_DECLARE_RO(stats) + +static int proc_encr_read(struct seq_file *sf, void *v) { - char *p = page; - struct ndis_device *wnd = (struct ndis_device *)data; + struct ndis_device *wnd = (struct ndis_device *)sf->private; int i, encr_status, auth_mode, infra_mode; NDIS_STATUS res; struct ndis_essid essid; mac_address ap_address; - if (off != 0) { - *eof = 1; - return 0; - } - res = mp_query(wnd, OID_802_11_BSSID, &ap_address, sizeof(ap_address)); if (res) memset(ap_address, 0, ETH_ALEN); - p += sprintf(p, "ap_address=%2.2X", ap_address[0]); - for (i = 1; i < ETH_ALEN; i++) - p += sprintf(p, ":%2.2X", ap_address[i]); - p += sprintf(p, "\n"); + add_text("ap_address=" MACSTRSEP "\n", MAC2STR(ap_address)); res = mp_query(wnd, OID_802_11_SSID, &essid, sizeof(essid)); if (!res) - p += sprintf(p, "essid=%.*s\n", essid.length, essid.essid); + add_text("essid=%.*s\n", essid.length, essid.essid); res = mp_query_int(wnd, OID_802_11_ENCRYPTION_STATUS, &encr_status); if (!res) { typeof(&wnd->encr_info.keys[0]) tx_key; - p += sprintf(p, "tx_key=%u\n", wnd->encr_info.tx_key_index); - p += sprintf(p, "key="); + add_text("tx_key=%u\n", wnd->encr_info.tx_key_index); + add_text("key="); tx_key = &wnd->encr_info.keys[wnd->encr_info.tx_key_index]; if (tx_key->length > 0) for (i = 0; i < tx_key->length; i++) - p += sprintf(p, "%2.2X", tx_key->key[i]); + add_text("%2.2X", tx_key->key[i]); else - p += sprintf(p, "off"); - p += sprintf(p, "\n"); - p += sprintf(p, "encr_mode=%d\n", encr_status); + add_text("off"); + add_text("\n"); + add_text("encr_mode=%d\n", encr_status); } res = mp_query_int(wnd, OID_802_11_AUTHENTICATION_MODE, &auth_mode); if (!res) - p += sprintf(p, "auth_mode=%d\n", auth_mode); + add_text("auth_mode=%d\n", auth_mode); res = mp_query_int(wnd, OID_802_11_INFRASTRUCTURE_MODE, &infra_mode); - p += sprintf(p, "mode=%s\n", (infra_mode == Ndis802_11IBSS) ? - "adhoc" : (infra_mode == Ndis802_11Infrastructure) ? - "managed" : "auto"); - if (p - page > count) { - WARNING("wrote %td bytes (limit is %u)", - p - page, count); - *eof = 1; - } + add_text("mode=%s\n", (infra_mode == Ndis802_11IBSS) ? "adhoc" : + (infra_mode == Ndis802_11Infrastructure) ? "managed" : "auto"); - return p - page; + return 0; } -static int procfs_read_ndis_hw(char *page, char **start, off_t off, - int count, int *eof, void *data) +PROC_DECLARE_RO(encr) + +static int proc_hw_read(struct seq_file *sf, void *v) { - char *p = page; - struct ndis_device *wnd = (struct ndis_device *)data; + struct ndis_device *wnd = (struct ndis_device *)sf->private; struct ndis_configuration config; enum ndis_power power_mode; NDIS_STATUS res; @@ -149,138 +232,116 @@ char *hw_status[] = {"ready", "initializing", "resetting", "closing", "not ready"}; - if (off != 0) { - *eof = 1; - return 0; - } - res = mp_query_int(wnd, OID_GEN_HARDWARE_STATUS, &n); if (res == NDIS_STATUS_SUCCESS && n >= 0 && n < ARRAY_SIZE(hw_status)) - p += sprintf(p, "status=%s\n", hw_status[n]); + add_text("status=%s\n", hw_status[n]); res = mp_query(wnd, OID_802_3_CURRENT_ADDRESS, mac, sizeof(mac)); if (!res) - p += sprintf(p, "mac: " MACSTRSEP "\n", MAC2STR(mac)); + add_text("mac: " MACSTRSEP "\n", MAC2STR(mac)); res = mp_query(wnd, OID_802_11_CONFIGURATION, &config, sizeof(config)); if (!res) { - p += sprintf(p, "beacon_period=%u msec\n", - config.beacon_period); - p += sprintf(p, "atim_window=%u msec\n", config.atim_window); - p += sprintf(p, "frequency=%u kHz\n", config.ds_config); - p += sprintf(p, "hop_pattern=%u\n", - config.fh_config.hop_pattern); - p += sprintf(p, "hop_set=%u\n", - config.fh_config.hop_set); - p += sprintf(p, "dwell_time=%u msec\n", - config.fh_config.dwell_time); + add_text("beacon_period=%u msec\n", config.beacon_period); + add_text("atim_window=%u msec\n", config.atim_window); + add_text("frequency=%u kHz\n", config.ds_config); + add_text("hop_pattern=%u\n", config.fh_config.hop_pattern); + add_text("hop_set=%u\n", config.fh_config.hop_set); + add_text("dwell_time=%u msec\n", config.fh_config.dwell_time); } res = mp_query(wnd, OID_802_11_TX_POWER_LEVEL, &tx_power, sizeof(tx_power)); if (!res) - p += sprintf(p, "tx_power=%u mW\n", tx_power); + add_text("tx_power=%u mW\n", tx_power); res = mp_query(wnd, OID_GEN_LINK_SPEED, &bit_rate, sizeof(bit_rate)); if (!res) - p += sprintf(p, "bit_rate=%u kBps\n", (u32)bit_rate / 10); + add_text("bit_rate=%u kBps\n", (u32)bit_rate / 10); res = mp_query(wnd, OID_802_11_RTS_THRESHOLD, &rts_threshold, sizeof(rts_threshold)); if (!res) - p += sprintf(p, "rts_threshold=%u bytes\n", rts_threshold); + add_text("rts_threshold=%u bytes\n", rts_threshold); res = mp_query(wnd, OID_802_11_FRAGMENTATION_THRESHOLD, &frag_threshold, sizeof(frag_threshold)); if (!res) - p += sprintf(p, "frag_threshold=%u bytes\n", frag_threshold); + add_text("frag_threshold=%u bytes\n", frag_threshold); res = mp_query_int(wnd, OID_802_11_POWER_MODE, &power_mode); if (!res) - p += sprintf(p, "power_mode=%s\n", - (power_mode == NDIS_POWER_OFF) ? "always_on" : - (power_mode == NDIS_POWER_MAX) ? - "max_savings" : "min_savings"); + add_text("power_mode=%s\n", + (power_mode == NDIS_POWER_OFF) ? "always_on" : + (power_mode == NDIS_POWER_MAX) ? "max_savings" : + "min_savings"); res = mp_query(wnd, OID_802_11_NUMBER_OF_ANTENNAS, &antenna, sizeof(antenna)); if (!res) - p += sprintf(p, "num_antennas=%u\n", antenna); + add_text("num_antennas=%u\n", antenna); res = mp_query(wnd, OID_802_11_TX_ANTENNA_SELECTED, &antenna, sizeof(antenna)); if (!res) - p += sprintf(p, "tx_antenna=%u\n", antenna); + add_text("tx_antenna=%u\n", antenna); res = mp_query(wnd, OID_802_11_RX_ANTENNA_SELECTED, &antenna, sizeof(antenna)); if (!res) - p += sprintf(p, "rx_antenna=%u\n", antenna); + add_text("rx_antenna=%u\n", antenna); - p += sprintf(p, "encryption_modes=%s%s%s%s%s%s%s\n", - test_bit(Ndis802_11Encryption1Enabled, &wnd->capa.encr) ? - "WEP" : "none", - - test_bit(Ndis802_11Encryption2Enabled, &wnd->capa.encr) ? - "; TKIP with WPA" : "", - test_bit(Ndis802_11AuthModeWPA2, &wnd->capa.auth) ? - ", WPA2" : "", - test_bit(Ndis802_11AuthModeWPA2PSK, &wnd->capa.auth) ? - ", WPA2PSK" : "", - - test_bit(Ndis802_11Encryption3Enabled, &wnd->capa.encr) ? - "; AES/CCMP with WPA" : "", - test_bit(Ndis802_11AuthModeWPA2, &wnd->capa.auth) ? - ", WPA2" : "", - test_bit(Ndis802_11AuthModeWPA2PSK, &wnd->capa.auth) ? - ", WPA2PSK" : ""); + add_text("encryption_modes=%s%s%s%s%s%s%s\n", + test_bit(Ndis802_11Encryption1Enabled, &wnd->capa.encr) ? + "WEP" : "none", + test_bit(Ndis802_11Encryption2Enabled, &wnd->capa.encr) ? + "; TKIP with WPA" : "", + test_bit(Ndis802_11AuthModeWPA2, &wnd->capa.auth) ? + ", WPA2" : "", + test_bit(Ndis802_11AuthModeWPA2PSK, &wnd->capa.auth) ? + ", WPA2PSK" : "", + test_bit(Ndis802_11Encryption3Enabled, &wnd->capa.encr) ? + "; AES/CCMP with WPA" : "", + test_bit(Ndis802_11AuthModeWPA2, &wnd->capa.auth) ? + ", WPA2" : "", + test_bit(Ndis802_11AuthModeWPA2PSK, &wnd->capa.auth) ? + ", WPA2PSK" : ""); res = mp_query_int(wnd, OID_GEN_CURRENT_PACKET_FILTER, &packet_filter); if (!res) { if (packet_filter != wnd->packet_filter) WARNING("wrong packet_filter? 0x%08x, 0x%08x\n", packet_filter, wnd->packet_filter); - p += sprintf(p, "packet_filter: 0x%08x\n", packet_filter); - } - if (p - page > count) { - WARNING("wrote %td bytes (limit is %u)", - p - page, count); - *eof = 1; + add_text("packet_filter: 0x%08x\n", packet_filter); } - return p - page; + return 0; } -static int procfs_read_ndis_settings(char *page, char **start, off_t off, - int count, int *eof, void *data) +PROC_DECLARE_RO(hw) + +static int proc_settings_read(struct seq_file *sf, void *v) { - char *p = page; - struct ndis_device *wnd = (struct ndis_device *)data; + struct ndis_device *wnd = (struct ndis_device *)sf->private; struct wrap_device_setting *setting; - if (off != 0) { - *eof = 1; - return 0; - } - - p += sprintf(p, "hangcheck_interval=%d\n", - hangcheck_interval == 0 ? - (wnd->hangcheck_interval / HZ) : -1); + add_text("hangcheck_interval=%d\n", (hangcheck_interval == 0) ? + (wnd->hangcheck_interval / HZ) : -1); list_for_each_entry(setting, &wnd->wd->settings, list) { - p += sprintf(p, "%s=%s\n", setting->name, setting->value); + add_text("%s=%s\n", setting->name, setting->value); } list_for_each_entry(setting, &wnd->wd->driver->settings, list) { - p += sprintf(p, "%s=%s\n", setting->name, setting->value); + add_text("%s=%s\n", setting->name, setting->value); } - return p - page; + return 0; } -static int procfs_write_ndis_settings(struct file *file, const char __user *buf, - unsigned long count, void *data) +static ssize_t proc_settings_write(struct file *file, const char __user *buf, + size_t count, loff_t *ppos) { - struct ndis_device *wnd = (struct ndis_device *)data; + struct ndis_device *wnd = PDE_DATA(file_inode(file)); char setting[MAX_PROC_STR_LEN], *p; unsigned int i; NDIS_STATUS res; @@ -380,15 +441,17 @@ return count; } +PROC_DECLARE_RW(settings) + int wrap_procfs_add_ndis_device(struct ndis_device *wnd) { - struct proc_dir_entry *procfs_entry; + int ret; if (wrap_procfs_entry == NULL) return -ENOMEM; if (wnd->procfs_iface) { - ERROR("%s already registered?", wnd->procfs_iface->name); + ERROR("%s already registered?", wnd->net_dev->name); return -EINVAL; } wnd->procfs_iface = proc_mkdir(wnd->net_dev->name, wrap_procfs_entry); @@ -396,58 +459,24 @@ ERROR("couldn't create proc directory"); return -ENOMEM; } - wnd->procfs_iface->uid = proc_uid; - wnd->procfs_iface->gid = proc_gid; + proc_set_user(wnd->procfs_iface, proc_kuid, proc_kgid); - procfs_entry = create_proc_entry("hw", S_IFREG | S_IRUSR | S_IRGRP, - wnd->procfs_iface); - if (procfs_entry == NULL) { - ERROR("couldn't create proc entry for 'hw'"); + ret = proc_make_entry_ro(hw, wnd->procfs_iface, wnd); + if (ret) goto err_hw; - } else { - procfs_entry->uid = proc_uid; - procfs_entry->gid = proc_gid; - procfs_entry->data = wnd; - procfs_entry->read_proc = procfs_read_ndis_hw; - } - procfs_entry = create_proc_entry("stats", S_IFREG | S_IRUSR | S_IRGRP, - wnd->procfs_iface); - if (procfs_entry == NULL) { - ERROR("couldn't create proc entry for 'stats'"); + ret = proc_make_entry_ro(stats, wnd->procfs_iface, wnd); + if (ret) goto err_stats; - } else { - procfs_entry->uid = proc_uid; - procfs_entry->gid = proc_gid; - procfs_entry->data = wnd; - procfs_entry->read_proc = procfs_read_ndis_stats; - } - procfs_entry = create_proc_entry("encr", S_IFREG | S_IRUSR | S_IRGRP, - wnd->procfs_iface); - if (procfs_entry == NULL) { - ERROR("couldn't create proc entry for 'encr'"); + ret = proc_make_entry_ro(encr, wnd->procfs_iface, wnd); + if (ret) goto err_encr; - } else { - procfs_entry->uid = proc_uid; - procfs_entry->gid = proc_gid; - procfs_entry->data = wnd; - procfs_entry->read_proc = procfs_read_ndis_encr; - } - procfs_entry = create_proc_entry("settings", S_IFREG | - S_IRUSR | S_IRGRP | - S_IWUSR | S_IWGRP, wnd->procfs_iface); - if (procfs_entry == NULL) { - ERROR("couldn't create proc entry for 'settings'"); + ret = proc_make_entry_rw(settings, wnd->procfs_iface, wnd); + if (ret) goto err_settings; - } else { - procfs_entry->uid = proc_uid; - procfs_entry->gid = proc_gid; - procfs_entry->data = wnd; - procfs_entry->read_proc = procfs_read_ndis_settings; - procfs_entry->write_proc = procfs_write_ndis_settings; - } + return 0; err_settings: @@ -457,7 +486,7 @@ err_stats: remove_proc_entry("hw", wnd->procfs_iface); err_hw: - remove_proc_entry(wnd->procfs_iface->name, wrap_procfs_entry); + proc_remove(wnd->procfs_iface); wnd->procfs_iface = NULL; return -ENOMEM; } @@ -473,32 +502,26 @@ remove_proc_entry("encr", procfs_iface); remove_proc_entry("settings", procfs_iface); if (wrap_procfs_entry) - remove_proc_entry(procfs_iface->name, wrap_procfs_entry); + proc_remove(procfs_iface); } -static int procfs_read_debug(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int proc_debug_read(struct seq_file *sf, void *v) { - char *p = page; #if ALLOC_DEBUG enum alloc_type type; #endif - if (off != 0) { - *eof = 1; - return 0; - } - p += sprintf(p, "%d\n", debug); + add_text("%d\n", debug); #if ALLOC_DEBUG for (type = 0; type < ALLOC_TYPE_MAX; type++) - p += sprintf(p, "total size of allocations in %s: %d\n", - alloc_type_name[type], alloc_size(type)); + add_text("total size of allocations in %s: %d\n", + alloc_type_name[type], alloc_size(type)); #endif - return p - page; + return 0; } -static int procfs_write_debug(struct file *file, const char __user *buf, - unsigned long count, void *data) +static ssize_t proc_debug_write(struct file *file, const char __user *buf, + size_t count, loff_t *ppos) { int i; char setting[MAX_PROC_STR_LEN], *p; @@ -524,30 +547,36 @@ return count; } +PROC_DECLARE_RW(debug) + int wrap_procfs_init(void) { - struct proc_dir_entry *procfs_entry; + int ret; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) + struct user_namespace *ns = current_user_ns(); + proc_kuid = make_kuid(ns, proc_uid); + if (!uid_valid(proc_kuid)) { + ERROR("invalid UID\n"); + return -EINVAL; + } + proc_kgid = make_kgid(ns, proc_gid); + if (!gid_valid(proc_kgid)) { + ERROR("invalid GID\n"); + return -EINVAL; + } +#endif wrap_procfs_entry = proc_mkdir(DRIVER_NAME, proc_net_root); if (wrap_procfs_entry == NULL) { ERROR("couldn't create procfs directory"); return -ENOMEM; } - wrap_procfs_entry->uid = proc_uid; - wrap_procfs_entry->gid = proc_gid; + proc_set_user(wrap_procfs_entry, proc_kuid, proc_kgid); - procfs_entry = create_proc_entry("debug", S_IFREG | S_IRUSR | S_IRGRP, - wrap_procfs_entry); - if (procfs_entry == NULL) { - ERROR("couldn't create proc entry for 'debug'"); - return -ENOMEM; - } else { - procfs_entry->uid = proc_uid; - procfs_entry->gid = proc_gid; - procfs_entry->read_proc = procfs_read_debug; - procfs_entry->write_proc = procfs_write_debug; - } - return 0; + ret = proc_make_entry_rw(debug, wrap_procfs_entry, NULL); + + return ret; } void wrap_procfs_remove(void) @@ -555,5 +584,5 @@ if (wrap_procfs_entry == NULL) return; remove_proc_entry("debug", wrap_procfs_entry); - remove_proc_entry(DRIVER_NAME, proc_net_root); + proc_remove(wrap_procfs_entry); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/workqueue.c new/ndiswrapper-1.59/driver/workqueue.c --- old/ndiswrapper-1.58/driver/workqueue.c 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/workqueue.c 2013-11-28 20:42:36.000000000 +0100 @@ -189,7 +189,7 @@ struct workq_thread_data thread_data; spin_lock_init(&workq->threads[i].lock); INIT_LIST_HEAD(&workq->threads[i].work_list); - INIT_COMPLETION(started); + reinit_completion(&started); workq->threads[i].completion = &started; thread_data.workq = workq; thread_data.index = i; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/wrapndis.c new/ndiswrapper-1.59/driver/wrapndis.c --- old/ndiswrapper-1.58/driver/wrapndis.c 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/wrapndis.c 2013-11-28 20:42:36.000000000 +0100 @@ -1760,7 +1760,7 @@ static int notifier_event(struct notifier_block *notifier, unsigned long event, void *ptr) { - struct net_device *net_dev = ptr; + struct net_device *net_dev = netdev_notifier_info_to_dev(ptr); ENTER2("0x%lx", event); if (net_dev->ethtool_ops == &ndis_ethtool_ops @@ -1769,9 +1769,8 @@ /* called with rtnl lock held, so no need to lock */ if (likely(wnd->procfs_iface)) { - printk(KERN_INFO "%s: changing interface name from " - "'%s' to '%s'\n", DRIVER_NAME, - wnd->procfs_iface->name, net_dev->name); + printk(KERN_INFO "%s: interface renamed to '%s'\n", + DRIVER_NAME, net_dev->name); wrap_procfs_remove_ndis_device(wnd); wrap_procfs_add_ndis_device(wnd); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/driver/wrapper.c new/ndiswrapper-1.59/driver/wrapper.c --- old/ndiswrapper-1.58/driver/wrapper.c 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/driver/wrapper.c 2013-11-28 20:42:36.000000000 +0100 @@ -72,7 +72,7 @@ static int __init wrapper_init(void) { #ifdef TAINT_OOT_MODULE - add_taint(TAINT_OOT_MODULE); + add_taint(TAINT_OOT_MODULE, LOCKDEP_NOW_UNRELIABLE); #endif printk(KERN_INFO "%s version %s loaded (smp=%s, preempt=%s)\n", DRIVER_NAME, DRIVER_VERSION, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/ndiswrapper.spec new/ndiswrapper-1.59/ndiswrapper.spec --- old/ndiswrapper-1.58/ndiswrapper.spec 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/ndiswrapper.spec 2013-11-28 20:42:36.000000000 +0100 @@ -1,5 +1,5 @@ # Define ndiswrapper_version only if it is not already defined. -%{!?ndiswrapper_version: %define ndiswrapper_version 1.58} +%{!?ndiswrapper_version: %define ndiswrapper_version 1.59} %{!?ndiswrapper_release: %define ndiswrapper_release 1} # Define kernel version if not already defined diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/utils/Makefile new/ndiswrapper-1.59/utils/Makefile --- old/ndiswrapper-1.58/utils/Makefile 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/utils/Makefile 2013-11-28 20:42:36.000000000 +0100 @@ -2,16 +2,18 @@ usrsbindir = /usr/sbin DRIVER_DIR ?= ../driver +HEADERS = $(DRIVER_DIR)/loader.h $(DRIVER_DIR)/ndiswrapper.h CC = gcc +HOSTCC = $(CC) CFLAGS = -g -Wall -I$(DRIVER_DIR) DISTFILES=Makefile ndiswrapper loadndisdriver.c ndiswrapper-buginfo all: loadndisdriver -loadndisdriver: loadndisdriver.c - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< +loadndisdriver: loadndisdriver.c $(HEADERS) + $(HOSTCC) $(CFLAGS) $(LDFLAGS) -o $@ $< clean: rm -f *~ *.o loadndisdriver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ndiswrapper-1.58/utils/ndiswrapper new/ndiswrapper-1.59/utils/ndiswrapper --- old/ndiswrapper-1.58/utils/ndiswrapper 2013-02-19 19:00:37.000000000 +0100 +++ new/ndiswrapper-1.59/utils/ndiswrapper 2013-11-28 20:42:36.000000000 +0100 @@ -35,6 +35,7 @@ my $src_dir; my $driver_name; my @source_disks_files; +my $modconf; my $re_dev_id = "([[:xdigit:]]{4})"; my $re_sub_dev_conf = "$re_dev_id:$re_dev_id:$re_dev_id:$re_dev_id" . @@ -48,64 +49,6 @@ "MapRegisters|256" => "64", "AdhocGMode|1" => "0"); -if (@ARGV < 1) { - usage(); - exit(1); -} - -my $modconf; -if (`uname -r` =~ /(\d+)\.(\d+)\.(\d+)/) { - if ($2 > 4) { - if (-d "/etc/modprobe.d") { - $modconf = "/etc/modprobe.d/ndiswrapper.conf"; - } else { - $modconf = "/etc/modprobe.conf"; - } - } else { - if (-d "/etc/modutils") { - $modconf = "/etc/modutils/ndiswrapper"; - } else { - $modconf = "/etc/modules.conf"; - } - } -} - -my $res; -my $dbg_file; - -$dbg_file = "/dev/null"; - -# "-D" is for development/debugging only -if ($ARGV[0] eq "-D") { - $dbg_file = "/tmp/ndiswrapper.dbg"; - $confdir = "/tmp/ndiswrapper"; - shift; -} - -open(DBG, "> $dbg_file") or die "couldn't open $dbg_file: $!"; - -if ($ARGV[0] eq "-i" and @ARGV == 2) { - $res = install($ARGV[1]); -} elsif (($ARGV[0] eq "-a" or $ARGV[0] eq "-d") and @ARGV == 3) { - $res = device_driver_alias($ARGV[1], $ARGV[2]); -} elsif (($ARGV[0] eq "-e" or $ARGV[0] eq "-r") and @ARGV == 2) { - $res = remove_driver($ARGV[1]); -} elsif ($ARGV[0] eq "-l" and @ARGV == 1) { - $res = list_drivers(); -} elsif ($ARGV[0] eq "-m" and @ARGV == 1) { - $res = add_module_alias(); -} elsif ($ARGV[0] eq "-v" and @ARGV == 1) { - $res = check_version(); -} elsif ($ARGV[0] eq "-ma" and @ARGV == 1) { - $res = generate_module_device_map(0); -} elsif ($ARGV[0] eq "-mi" and @ARGV == 1) { - $res = generate_module_device_map(1); -} else { - usage(); -} -close(DBG); -exit($res); - sub usage() { print "install/manage Windows drivers for ndiswrapper\n\n" . "usage: ndiswrapper OPTION\n" . @@ -1022,6 +965,63 @@ return $ret; } +if (@ARGV < 1) { + usage(); + exit(1); +} + +if (`uname -r` =~ /(\d+)\.(\d+)\.(\d+)/) { + if ($2 > 4) { + if (-d "/etc/modprobe.d") { + $modconf = "/etc/modprobe.d/ndiswrapper.conf"; + } else { + $modconf = "/etc/modprobe.conf"; + } + } else { + if (-d "/etc/modutils") { + $modconf = "/etc/modutils/ndiswrapper"; + } else { + $modconf = "/etc/modules.conf"; + } + } +} + +my $res; +my $dbg_file; + +$dbg_file = "/dev/null"; + +# "-D" is for development/debugging only +if ($ARGV[0] eq "-D") { + $dbg_file = "/tmp/ndiswrapper.dbg"; + $confdir = "/tmp/ndiswrapper"; + shift; +} + +open(DBG, "> $dbg_file") or die "couldn't open $dbg_file: $!"; + +if ($ARGV[0] eq "-i" and @ARGV == 2) { + $res = install($ARGV[1]); +} elsif (($ARGV[0] eq "-a" or $ARGV[0] eq "-d") and @ARGV == 3) { + $res = device_driver_alias($ARGV[1], $ARGV[2]); +} elsif (($ARGV[0] eq "-e" or $ARGV[0] eq "-r") and @ARGV == 2) { + $res = remove_driver($ARGV[1]); +} elsif ($ARGV[0] eq "-l" and @ARGV == 1) { + $res = list_drivers(); +} elsif ($ARGV[0] eq "-m" and @ARGV == 1) { + $res = add_module_alias(); +} elsif ($ARGV[0] eq "-v" and @ARGV == 1) { + $res = check_version(); +} elsif ($ARGV[0] eq "-ma" and @ARGV == 1) { + $res = generate_module_device_map(0); +} elsif ($ARGV[0] eq "-mi" and @ARGV == 1) { + $res = generate_module_device_map(1); +} else { + usage(); +} +close(DBG); +exit($res); + ## Local Variables: ## ## cperl-indent-level: 4 ## ## End: ## -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
