Commit a3c7a8fa authored by Linus Torvalds's avatar Linus Torvalds

Import 1.3.20

parent 961f4bfa
VERSION = 1
PATCHLEVEL = 3
SUBLEVEL = 19
SUBLEVEL = 20
ARCH = i386
......@@ -113,7 +113,7 @@ include arch/$(ARCH)/Makefile
$(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
Version: dummy
rm -f include/linux/version.h
@rm -f include/linux/compile.h
boot: vmlinux
@$(MAKE) -C arch/$(ARCH)/boot
......@@ -140,6 +140,7 @@ linuxsubdirs: dummy
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
$(TOPDIR)/include/linux/version.h: include/linux/version.h
$(TOPDIR)/include/linux/compile.h: include/linux/compile.h
newversion:
@if [ ! -f .version ]; then \
......@@ -148,8 +149,7 @@ newversion:
expr `cat .version` + 1 > .version; \
fi
include/linux/version.h: $(CONFIGURATION) Makefile newversion
@echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
@if [ -f .name ]; then \
echo \#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
else \
......@@ -166,10 +166,14 @@ include/linux/version.h: $(CONFIGURATION) Makefile newversion
echo \#define LINUX_COMPILE_DOMAIN ; \
fi >> .ver
@echo \#define LINUX_COMPILER \"`$(HOSTCC) -v 2>&1 | tail -1`\" >> .ver
@mv -f .ver $@
include/linux/version.h: ./Makefile
@echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
@echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
if [ ! -f $@ ]; then mv .ver $@; fi
@mv -f .ver $@
init/version.o: init/version.c include/linux/version.h
init/version.o: init/version.c include/linux/compile.h
$(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
init/main.o: init/main.c
......@@ -225,7 +229,7 @@ modules_install:
)
clean: archclean
rm -f kernel/ksyms.lst
rm -f kernel/ksyms.lst include/linux/compile.h
rm -f core `find . -name '*.[oas]' -print`
rm -f core `find . -type f -name 'core' -print`
rm -f vmlinux System.map
......@@ -253,11 +257,9 @@ backup: mrproper
sync
#depend dep: .hdepend
depend dep: archdep .hdepend
touch include/linux/version.h
depend dep: archdep .hdepend include/linux/version.h
awk -f scripts/depend.awk init/*.c > .tmpdepend
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
rm -f include/linux/version.h
mv .tmpdepend .depend
ifdef CONFIG_MODVERSIONS
@echo updating $(TOPDIR)/include/linux/modversions.h
......
......@@ -695,7 +695,6 @@ static void msg(int level, const char *fmt, ...)
{
char buf[256];
va_list args;
extern int vsprintf(char *, const char *, va_list);
if (!(sbpcd_debug&(1<<level))) return;
......
......@@ -127,13 +127,13 @@ L_OBJS += de600.o
else
M_OBJS += de600.o
endif
ifdef CONFIG_DE620
L_OBJS += de620.o
else
M_OBJS += de620.o
endif
ifdef CONFIG_AT1500
L_OBJS += lance.o
endif
......
......@@ -385,7 +385,7 @@ sl_bump(struct slip *sl)
skb->dev = sl->dev;
memcpy(skb_put(skb,count), sl->rbuff, count);
skb->mac.raw=skb->data;
if(sl->mode&(SL_MODE_AX25|SL_MODE_AX25VC))
if(sl->mode & SL_MODE_AX25)
skb->protocol=htons(ETH_P_AX25);
else
skb->protocol=htons(ETH_P_IP);
......@@ -537,7 +537,7 @@ sl_header(struct sk_buff *skb, struct device *dev, unsigned short type,
#ifdef CONFIG_INET
struct slip *sl = (struct slip*)(dev->priv);
if (((sl->mode & SL_MODE_AX25) || (sl->mode & SL_MODE_AX25VC)) && type != htons(ETH_P_AX25)) {
if (sl->mode & SL_MODE_AX25 && type != htons(ETH_P_AX25)) {
return ax25_encapsulate(skb, dev, type, daddr, saddr, len);
}
#endif
......@@ -555,7 +555,7 @@ sl_rebuild_header(void *buff, struct device *dev, unsigned long raddr,
#ifdef CONFIG_INET
struct slip *sl = (struct slip*)(dev->priv);
if ((sl->mode & SL_MODE_AX25) || (sl->mode & SL_MODE_AX25VC)) {
if (sl->mode & SL_MODE_AX25) {
return ax25_rebuild_header(buff, dev, raddr, skb);
}
#endif
......@@ -752,7 +752,7 @@ slip_open(struct tty_struct *tty)
sl->mode = SL_MODE_DEFAULT;
sl->dev->type = ARPHRD_SLIP + sl->mode;
#ifdef CONFIG_AX25
if (sl->dev->type == 260 || sl->dev->type == 272) { /* KISS */
if (sl->dev->type == 260) { /* KISS */
sl->dev->type = ARPHRD_AX25;
}
#endif
......@@ -1008,14 +1008,6 @@ sl_set_dev_mac_address(struct device *dev, void *addr)
memcpy(dev->dev_addr, addr, AX25_ADDR_LEN);
return 0;
}
int sl_get_ax25_mode(struct device *dev)
{
struct slip *sl = (struct slip*)(dev->priv);
return sl->mode & SL_MODE_AX25VC;
}
#endif /* CONFIG_AX25 */
......@@ -1072,13 +1064,13 @@ slip_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
}
#endif
#ifndef CONFIG_AX25
if ((tmp & SL_MODE_AX25) || (tmp & SL_MODE_AX25VC)) {
if (tmp & SL_MODE_AX25) {
return -EINVAL;
}
#else
if ((tmp & SL_MODE_AX25) || (tmp & SL_MODE_AX25VC)) {
if (tmp & SL_MODE_AX25) {
sl->dev->addr_len=AX25_ADDR_LEN; /* sizeof an AX.25 addr */
sl->dev->hard_header_len=73; /* We don't do digipeaters */
sl->dev->hard_header_len=AX25_KISS_HEADER_LEN + AX25_MAX_HEADER_LEN + 3;
} else {
sl->dev->addr_len=0; /* No mac addr in slip mode */
sl->dev->hard_header_len=0;
......@@ -1087,7 +1079,7 @@ slip_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
sl->mode = tmp;
sl->dev->type = ARPHRD_SLIP+sl->mode;
#ifdef CONFIG_AX25
if (sl->dev->type == 260 || sl->dev->type == 272) {
if (sl->dev->type == 260) {
sl->dev->type = ARPHRD_AX25;
}
#endif
......@@ -1221,7 +1213,7 @@ slip_init(struct device *dev)
dev->addr_len = 0;
dev->type = ARPHRD_SLIP + SL_MODE_DEFAULT;
#ifdef CONFIG_AX25
if (sl->dev->type == 260 || sl->dev->type == 272) {
if (sl->dev->type == 260) {
sl->dev->type = ARPHRD_AX25;
}
memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); /* Only activated in AX.25 mode */
......
......@@ -95,7 +95,6 @@ struct slip {
#define SL_MODE_CSLIP6 (SL_MODE_SLIP6|SL_MODE_CSLIP)
#define SL_MODE_AX25 4
#define SL_MODE_ADAPTIVE 8
#define SL_MODE_AX25VC 16
};
......
......@@ -36,6 +36,7 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_arp.h>
#include <linux/skbuff.h>
#include <net/ip.h>
......
......@@ -34,7 +34,7 @@ include ../../versions.mk
endif
ifdef CONFIG_SCSI
L_OBJS := hosts.o scsi.o scsi_ioctl.o constants.o scsicam.o scsi_proc.o
L_OBJS += hosts.o scsi.o scsi_ioctl.o constants.o scsicam.o scsi_proc.o
else
ifdef CONFIG_MODVERSIONS
# Create this before we build anything else.
......
......@@ -228,7 +228,7 @@ int fsync_dev(dev_t dev)
asmlinkage int sys_sync(void)
{
sync_dev(0);
fsync_dev(0);
return 0;
}
......@@ -440,6 +440,7 @@ struct buffer_head * get_hash_table(dev_t dev, int block, int size)
for (;;) {
if (!(bh=find_buffer(dev,block,size)))
return NULL;
bh->b_reuse=0;
bh->b_count++;
wait_on_buffer(bh);
if (bh->b_dev == dev && bh->b_blocknr == block && bh->b_size == size)
......@@ -1075,6 +1076,7 @@ static unsigned long try_to_load_aligned(unsigned long address,
arr[block++] = bh;
bh->b_count = 1;
bh->b_dirt = 0;
bh->b_reuse = 0;
bh->b_flushtime = 0;
bh->b_uptodate = 0;
bh->b_req = 0;
......
......@@ -23,6 +23,33 @@
*/
#define mem_write NULL
static int check_range(struct task_struct * tsk, unsigned long addr, int count)
{
struct vm_area_struct *vma;
int retval;
vma = find_vma(tsk, addr);
if (!vma)
return -EACCES;
if (vma->vm_start > addr)
return -EACCES;
if (!(vma->vm_flags & VM_READ))
return -EACCES;
while ((retval = vma->vm_end - addr) < count) {
struct vm_area_struct *next = vma->vm_next;
if (!next)
break;
if (vma->vm_end != next->vm_start)
break;
if (!(next->vm_flags & VM_READ))
break;
vma = next;
}
if (retval > count)
retval = count;
return retval;
}
static int mem_read(struct inode * inode, struct file * file,char * buf, int count)
{
pgd_t *page_dir;
......@@ -47,6 +74,9 @@ static int mem_read(struct inode * inode, struct file * file,char * buf, int cou
if (!tsk)
return -EACCES;
addr = file->f_pos;
count = check_range(tsk, addr, count);
if (count < 0)
return count;
tmp = buf;
while (count > 0) {
if (current->signal & ~current->blocked)
......
......@@ -24,6 +24,14 @@ struct full_sockaddr_ax25
ax25_address fsa_digipeater[AX25_MAX_DIGIS];
};
struct ax25_routes_struct
{
ax25_address port_addr;
ax25_address dest_addr;
unsigned char digi_count;
ax25_address digi_addr[AX25_MAX_DIGIS - 2];
};
#define AX25_WINDOW 1
#define AX25_T1 2
#define AX25_N2 3
......@@ -31,12 +39,35 @@ struct full_sockaddr_ax25
#define AX25_T2 5
#define AX25_BACKOFF 6
#define AX25_EXTSEQ 7
#define AX25_HDRINCL 8
#define SIOCAX25GETUID (SIOCPROTOPRIVATE)
#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1)
#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2)
#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3)
#define SIOCAX25DIGCTL (SIOCPROTOPRIVATE+4)
#define SIOCAX25GETPARMS (SIOCPROTOPRIVATE+5)
#define SIOCAX25SETPARMS (SIOCPROTOPRIVATE+6)
#define AX25_NOUID_DEFAULT 0
#define AX25_NOUID_BLOCK 1
#define AX25_VALUES_IPDEFMODE 0 /* 'D'=DG 'V'=VC */
#define AX25_VALUES_AXDEFMODE 1 /* 8=Normal 128=Extended Seq Nos */
#define AX25_VALUES_NETROM 2 /* Allow NET/ROM - 0=No 1=Yes */
#define AX25_VALUES_TEXT 3 /* Allow PID=Text - 0=No 1=Yes */
#define AX25_VALUES_BACKOFF 4 /* 'E'=Exponential 'L'=Linear */
#define AX25_VALUES_CONMODE 5 /* Allow connected modes - 0=No 1=Yes */
#define AX25_VALUES_WINDOW 6 /* Default window size for standard AX.25 */
#define AX25_VALUES_EWINDOW 7 /* Default window size for extended AX.25 */
#define AX25_VALUES_T1 8 /* Default T1 timeout value */
#define AX25_VALUES_T2 9 /* Default T2 timeout value */
#define AX25_VALUES_T3 10 /* Default T3 timeout value */
#define AX25_VALUES_N2 11 /* Default N2 value */
#define AX25_MAX_VALUES 20
struct ax25_parms_struct
{
ax25_address port_addr;
unsigned short values[AX25_MAX_VALUES];
};
......@@ -4,6 +4,7 @@
#define NETROM_T1 1
#define NETROM_T2 2
#define NETROM_N2 3
#define NETROM_HDRINCL 4
#define SIOCNRGETPARMS (SIOCPROTOPRIVATE+0)
#define SIOCNRSETPARMS (SIOCPROTOPRIVATE+1)
......
......@@ -101,14 +101,22 @@
#define AX25_STATE_4 4
#define PR_SLOWHZ 10 /* Run timing at 1/10 second - gives us better resolution for 56kbit links */
#define DEFAULT_T1 (10 * PR_SLOWHZ) /* Outstanding frames - 10 seconds */
#define DEFAULT_T2 (3 * PR_SLOWHZ) /* Response delay - 3 seconds */
#define DEFAULT_T3 (300 * PR_SLOWHZ) /* Idle supervision - 300 seconds */
#define DEFAULT_N2 10 /* Number of retries */
#define DEFAULT_WINDOW 2 /* Default window size */
#define MODULUS 8 /* Standard AX.25 modulus */
#define EMODULUS 128 /* Extended AX.25 modulus */
#define AX25_DEF_IPDEFMODE 'D'
#define AX25_DEF_AXDEFMODE 8
#define AX25_DEF_NETROM 1
#define AX25_DEF_TEXT 1
#define AX25_DEF_BACKOFF 'E'
#define AX25_DEF_CONMODE 1
#define AX25_DEF_WINDOW 2
#define AX25_DEF_EWINDOW 32
#define AX25_DEF_T1 10
#define AX25_DEF_T2 3
#define AX25_DEF_T3 300
#define AX25_DEF_N2 10
typedef struct ax25_uid_assoc {
struct ax25_uid_assoc *next;
uid_t uid;
......@@ -126,7 +134,7 @@ typedef struct ax25_cb {
struct ax25_cb *next;
ax25_address source_addr, dest_addr;
struct device *device;
unsigned char state, modulus;
unsigned char state, modulus, hdrincl;
unsigned short vs, vr, va;
unsigned char condition, backoff;
unsigned char n2, n2count;
......@@ -152,7 +160,6 @@ extern struct device *ax25rtr_get_dev(ax25_address *);
extern int ax25_encapsulate(struct sk_buff *, struct device *, unsigned short,
void *, void *, unsigned int);
extern int ax25_rebuild_header(unsigned char *, struct device *, unsigned long, struct sk_buff *);
extern int ax25_get_info(char *, char **, off_t, int, int);
extern ax25_uid_assoc *ax25_uid_list;
extern int ax25_uid_policy;
extern ax25_address *ax25_findbyuid(uid_t);
......@@ -171,17 +178,23 @@ extern void ax25_nr_error_recovery(ax25_cb *);
extern void ax25_establish_data_link(ax25_cb *);
extern void ax25_transmit_enquiry(ax25_cb *);
extern void ax25_enquiry_response(ax25_cb *);
extern void ax25_timeout_response(ax25_cb *);
extern void ax25_check_iframes_acked(ax25_cb *, unsigned short);
extern void ax25_check_need_response(ax25_cb *, int, int);
/* ax25_route.c */
extern void ax25_rt_rx_frame(ax25_address *, struct device *);
extern void ax25_rt_rx_frame(ax25_address *, struct device *, ax25_digi *);
extern int ax25_rt_get_info(char *, char **, off_t, int, int);
extern int ax25_cs_get_info(char *, char **, off_t, int, int);
extern int ax25_rt_autobind(ax25_cb *, ax25_address *);
extern void ax25_rt_device_down(struct device *);
extern int ax25_rt_ioctl(unsigned int, void *);
extern void ax25_ip_mode_set(ax25_address *, struct device *, char);
extern char ax25_ip_mode_get(ax25_address *, struct device *);
extern unsigned short ax25_dev_get_value(struct device *, int);
extern void ax25_dev_device_up(struct device *);
extern void ax25_dev_device_down(struct device *);
extern int ax25_dev_ioctl(unsigned int, void *);
/* ax25_subr.c */
extern void ax25_clear_queues(ax25_cb *);
......@@ -202,7 +215,4 @@ extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25
/* ax25_timer */
extern void ax25_set_timer(ax25_cb *);
/* slip.c */
extern int sl_get_ax25_mode(struct device *);
#endif
......@@ -46,11 +46,10 @@
typedef struct {
ax25_address user_addr, source_addr, dest_addr;
struct device *device;
unsigned char my_index, my_id;
unsigned char your_index, your_id;
unsigned char state, bpqext;
unsigned char my_index, my_id;
unsigned char your_index, your_id;
unsigned char state, condition, bpqext, hdrincl;
unsigned short vs, vr, va, vl;
unsigned char condition;
unsigned char n2, n2count;
unsigned short t1, t2, rtt;
unsigned short t1timer, t2timer, t4timer;
......
......@@ -9,6 +9,7 @@
#include <linux/config.h>
#include <linux/utsname.h>
#include <linux/version.h>
#include <linux/compile.h>
struct new_utsname system_utsname = {
UTS_SYSNAME, UTS_NODENAME, UTS_RELEASE, UTS_VERSION,
......
......@@ -14,10 +14,13 @@ O_TARGET := kernel.o
O_OBJS = sched.o dma.o fork.o exec_domain.o panic.o printk.o sys.o \
module.o exit.o signal.o itimer.o info.o time.o softirq.o \
resource.o
SYMTAB_OBJS = ksyms.o
O_OBJS += $(SYMTAB_OBJS)
ifdef CONFIG_MODVERSIONS
$(O_TARGET): $(SYMTAB_OBJS:.o=.ver)
endif
include $(TOPDIR)/Rules.make
......
This diff is collapsed.
......@@ -11,6 +11,6 @@ MOD_SUB_DIRS := ipv4
ALL_SUB_DIRS := 802 ax25 core ethernet ipv4 ipx unix appletalk netrom
SUB_DIRS := $(ALL_SUB_DIRS)
L_TARGET := network.a
L_OBJS := socket.o protocols.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
L_OBJS := socket.o protocols.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
include $(TOPDIR)/Rules.make
......@@ -38,6 +38,7 @@
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <linux/inet.h>
#include <linux/notifier.h>
#include <linux/netdevice.h>
......
......@@ -38,6 +38,8 @@
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <linux/route.h>
#include <linux/inet.h>
#include <linux/notifier.h>
#include <linux/netdevice.h>
......@@ -50,6 +52,7 @@
#include <net/sock.h>
#include <linux/atalk.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#ifdef CONFIG_ATALK
......@@ -211,7 +214,7 @@ static void atalk_destroy_socket(atalk_socket *sk)
/* Called from proc fs */
int atalk_get_info(char *buffer, char **start, off_t offset, int length)
int atalk_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
atalk_socket *s;
int len=0;
......@@ -813,7 +816,7 @@ static int atrtr_ioctl(unsigned int cmd, void *arg)
/* Called from proc fs - just make it print the ifaces neatly */
int atalk_if_get_info(char *buffer, char **start, off_t offset, int length)
int atalk_if_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
struct atalk_iface *iface;
int len=0;
......@@ -846,7 +849,7 @@ int atalk_if_get_info(char *buffer, char **start, off_t offset, int length)
/* Called from proc fs - just make it print the routes neatly */
int atalk_rt_get_info(char *buffer, char **start, off_t offset, int length)
int atalk_rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
struct atalk_route *rt;
int len=0;
......@@ -1873,6 +1876,7 @@ void atalk_proto_init(struct net_proto *pro)
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_AT_ROUTE, 11,"atalk_route",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
atalk_rt_get_info
});
proc_net_register(&(struct proc_dir_entry) {
......
......@@ -12,7 +12,7 @@ O_TARGET := ax25.o
O_OBJS := af_ax25.o
ifdef CONFIG_AX25
OBJS += ax25_in.o ax25_out.o ax25_route.o ax25_subr.o ax25_timer.o
O_OBJS += ax25_in.o ax25_out.o ax25_route.o ax25_subr.o ax25_timer.o
endif
include $(TOPDIR)/Rules.make
......
This diff is collapsed.
......@@ -64,6 +64,7 @@ static int ax25_rx_iframe(ax25_cb *, struct sk_buff *);
static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb)
{
struct sk_buff *skbn, *skbo;
int hdrlen;
if (ax25->fragno != 0) {
if (!(*skb->data & SEG_FIRST)) {
......@@ -86,6 +87,14 @@ static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb)
}
skb_reserve(skbn, AX25_MAX_HEADER_LEN);
skbn->h.raw = skbn->data;
skbo = skb_dequeue(&ax25->frag_queue);
hdrlen = skbo->data - skbo->h.raw;
skb_push(skbo, hdrlen);
memcpy(skb_put(skbn, skbo->len), skbo->data, skbo->len);
skb_pull(skbn, hdrlen);
kfree_skb(skbo, FREE_READ);
while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) {
memcpy(skb_put(skbn, skbo->len), skbo->data, skbo->len);
......@@ -122,13 +131,13 @@ static int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
{
int queued = 0;
skb->h.raw = skb->data;
switch (*skb->data) {
#ifdef CONFIG_NETROM
case AX25_P_NETROM:
skb_pull(skb, 1); /* Remove PID */
queued = nr_route_frame(skb, ax25);
if (ax25_dev_get_value(ax25->device, AX25_VALUES_NETROM)) {
skb_pull(skb, 1); /* Remove PID */
queued = nr_route_frame(skb, ax25);
}
break;
#endif
#ifdef CONFIG_INET
......@@ -141,7 +150,7 @@ static int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
break;
#endif
case AX25_P_TEXT:
if (ax25->sk != NULL) {
if (ax25->sk != NULL && ax25_dev_get_value(ax25->device, AX25_VALUES_TEXT)) {
if (sock_queue_rcv_skb(ax25->sk, skb) == 0) {
queued = 1;
} else {
......@@ -172,11 +181,13 @@ static int ax25_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype
switch (frametype) {
case SABM:
ax25->modulus = MODULUS;
ax25->window = ax25_dev_get_value(ax25->device, AX25_VALUES_WINDOW);
ax25_send_control(ax25, UA, pf, C_RESPONSE);
break;
case SABME:
ax25->modulus = EMODULUS;
ax25->window = ax25_dev_get_value(ax25->device, AX25_VALUES_EWINDOW);
ax25_send_control(ax25, UA, pf, C_RESPONSE);
break;
......@@ -217,6 +228,7 @@ static int ax25_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype
}
} else {
ax25->modulus = MODULUS;
ax25->window = ax25_dev_get_value(ax25->device, AX25_VALUES_WINDOW);
}
}
break;
......@@ -298,6 +310,7 @@ static int ax25_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype
switch (frametype) {
case SABM:
ax25->modulus = MODULUS;
ax25->window = ax25_dev_get_value(ax25->device, AX25_VALUES_WINDOW);
ax25_send_control(ax25, UA, pf, C_RESPONSE);
ax25->condition = 0x00;
ax25->t1timer = 0;
......@@ -309,6 +322,7 @@ static int ax25_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype
case SABME:
ax25->modulus = EMODULUS;
ax25->window = ax25_dev_get_value(ax25->device, AX25_VALUES_EWINDOW);
ax25_send_control(ax25, UA, pf, C_RESPONSE);
ax25->condition = 0x00;
ax25->t1timer = 0;
......@@ -455,6 +469,7 @@ static int ax25_state4_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype
switch (frametype) {
case SABM:
ax25->modulus = MODULUS;
ax25->window = ax25_dev_get_value(ax25->device, AX25_VALUES_WINDOW);
ax25_send_control(ax25, UA, pf, C_RESPONSE);
ax25->condition = 0x00;
ax25->t1timer = 0;
......@@ -468,6 +483,7 @@ static int ax25_state4_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype
case SABME:
ax25->modulus = EMODULUS;
ax25->window = ax25_dev_get_value(ax25->device, AX25_VALUES_EWINDOW);
ax25_send_control(ax25, UA, pf, C_RESPONSE);
ax25->condition = 0x00;
ax25->t1timer = 0;
......
......@@ -286,6 +286,16 @@ void ax25_enquiry_response(ax25_cb *ax25)
ax25->condition &= ~ACK_PENDING_CONDITION;
}
void ax25_timeout_response(ax25_cb *ax25)
{
if (ax25->condition & OWN_RX_BUSY_CONDITION)
ax25_send_control(ax25, RNR, POLLOFF, C_RESPONSE);
else
ax25_send_control(ax25, RR, POLLOFF, C_RESPONSE);
ax25->condition &= ~ACK_PENDING_CONDITION;
}
void ax25_check_iframes_acked(ax25_cb *ax25, unsigned short nr)
{
if (ax25->vs == nr) {
......
This diff is collapsed.
......@@ -130,7 +130,7 @@ static void ax25_timer(unsigned long param)
if (ax25->state == AX25_STATE_3 || ax25->state == AX25_STATE_4) {
if (ax25->condition & ACK_PENDING_CONDITION) {
ax25->condition &= ~ACK_PENDING_CONDITION;
ax25_enquiry_response(ax25);
ax25_timeout_response(ax25);
}
}
}
......@@ -167,7 +167,9 @@ static void ax25_timer(unsigned long param)
}
} else {
ax25->modulus = MODULUS;
ax25->window = ax25_dev_get_value(ax25->device, AX25_VALUES_WINDOW);
ax25->n2count = 0;
ax25_send_control(ax25, SABM, POLLON, C_COMMAND);
}
} else {
ax25->n2count++;
......
......@@ -9,8 +9,10 @@
O_TARGET := core.o
O_OBJS :=
ifdef CONFIG_NET
O_OBJS := sock.o dev.o dev_mcast.o skbuff.o datagram.o iovec.o
O_OBJS += sock.o dev.o dev_mcast.o iovec.o skbuff.o datagram.o
endif
include $(TOPDIR)/Rules.make
......
......@@ -1240,13 +1240,13 @@ static int arp_req_set(struct arpreq *req)
#ifdef CONFIG_AX25
case ARPHRD_AX25:
htype = ARPHRD_AX25;
hlen = 7;
hlen = AX25_ADDR_LEN;
break;
#endif
#ifdef CONFIG_NETROM
case ARPHRD_NETROM:
htype = ARPHRD_NETROM;
hlen = 7;
hlen = AX25_ADDR_LEN;
break;
#endif
case ARPHRD_IEEE802:
......
......@@ -30,6 +30,7 @@
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <net/ip.h>
#include <net/protocol.h>
#include <net/route.h>
......
......@@ -127,6 +127,7 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <net/snmp.h>
#include <net/ip.h>
......@@ -1695,7 +1696,6 @@ int ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
static void ip_loopback(struct device *old_dev, struct sk_buff *skb)
{
extern struct device loopback_dev;
struct device *dev=&loopback_dev;
int len=skb->len-old_dev->hard_header_len;
struct sk_buff *newskb=dev_alloc_skb(len+dev->hard_header_len+15);
......
......@@ -84,6 +84,7 @@
#include <linux/ip_fw.h>
#include <net/checksum.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
/*
* Implement IP packet firewall
......
......@@ -7,6 +7,8 @@
* Fixes:
* Alan Cox : Merged and made usable non modular (its so tiny its silly as
* a module taking up 2 pages).
* Alan Cox : Fixed bug with 1.3.18 and IPIP not working (now needs to set skb->h.iph)
* to keep ip_forward happy.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -56,6 +58,7 @@ int ipip_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
#ifdef TUNNEL_DEBUG
printk("ipip_rcv: got a packet!\n");
#endif
skb->h.iph=skb->data; /* Correct IP header pointer on to new header */
if(ip_forward(skb, dev, 0, daddr, 0))
kfree_skb(skb, FREE_READ);
MOD_DEC_USE_COUNT;
......
......@@ -66,6 +66,7 @@
#include <net/ax25.h>
#endif
#include <linux/proc_fs.h>
#include <linux/stat.h>
#if defined(CONFIG_INET_RARP) || defined(MODULE)
......
......@@ -60,6 +60,7 @@
#include <linux/ipx.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/route.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <asm/segment.h>
......@@ -71,6 +72,7 @@
#include <net/p8022.h>
#include <net/psnap.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#ifdef CONFIG_IPX
/* Configuration Variables */
......
......@@ -50,7 +50,7 @@
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <net/netrom.h>
#include <linux/proc_fs.h>
#include <net/ip.h>
#include <net/arp.h>
......@@ -115,8 +115,6 @@ static void nr_kill_by_device(struct device *dev)
s->dead = 1;
}
}
nr_rt_device_down(dev);
}
/*
......@@ -124,10 +122,13 @@ static void nr_kill_by_device(struct device *dev)
*/
static int nr_device_event(unsigned long event, void *ptr)
{
struct device *dev = (struct device *)ptr;
if (event != NETDEV_DOWN)
return NOTIFY_DONE;
nr_kill_by_device(ptr);
nr_kill_by_device(dev);
nr_rt_device_down(dev);
return NOTIFY_DONE;
}
......@@ -329,6 +330,10 @@ static int nr_setsockopt(struct socket *sock, int level, int optname,
sk->nr->n2 = opt;
return 0;
case NETROM_HDRINCL:
sk->nr->hdrincl = opt ? 1 : 0;
return 0;
default:
return -ENOPROTOOPT;
}
......@@ -351,7 +356,7 @@ static int nr_getsockopt(struct socket *sock, int level, int optname,
switch (optname) {
case NETROM_T1:
val = sk->nr->t1 / PR_SLOWHZ;
val = (sk->nr->t1 * 2) / PR_SLOWHZ;
break;
case NETROM_T2:
......@@ -362,6 +367,10 @@ static int nr_getsockopt(struct socket *sock, int level, int optname,
val = sk->nr->n2;
break;
case NETROM_HDRINCL:
val = sk->nr->hdrincl;
break;
default:
return -ENOPROTOOPT;
}
......@@ -497,6 +506,7 @@ static int nr_create(struct socket *sock, int protocol)
nr->bpqext = 1;
nr->fraglen = 0;
nr->hdrincl = 0;
nr->state = NR_STATE_0;
nr->device = NULL;
......@@ -580,6 +590,7 @@ static struct sock *nr_make_new(struct sock *osk)
nr->device = osk->nr->device;
nr->bpqext = osk->nr->bpqext;
nr->hdrincl = osk->nr->hdrincl;
nr->fraglen = 0;
nr->t1timer = 0;
......@@ -931,10 +942,9 @@ int nr_rx_frame(struct sk_buff *skb, struct device *dev)
*/
if (((frametype & 0x0F) != NR_CONNREQ && (sk = nr_find_socket(circuit_index, circuit_id, SOCK_SEQPACKET)) != NULL) ||
((frametype & 0x0F) == NR_CONNREQ && (sk = nr_find_peer(circuit_index, circuit_id, SOCK_SEQPACKET)) != NULL)) {
skb_pull(skb, NR_NETWORK_LEN);
skb->h.raw = skb->data + NR_TRANSPORT_LEN;
skb->h.raw = skb->data;
if ((frametype & 0x0F) == NR_CONNACK && skb->len == 7)
if ((frametype & 0x0F) == NR_CONNACK && skb->len == 22)
sk->nr->bpqext = 1;
else
sk->nr->bpqext = 0;
......@@ -1129,7 +1139,7 @@ static int nr_recvfrom(struct socket *sock, void *ubuf, int size, int noblock,
{
struct sock *sk = (struct sock *)sock->data;
struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)sip;
int copied = 0;
int copied;
struct sk_buff *skb;
int er;
......@@ -1142,7 +1152,10 @@ static int nr_recvfrom(struct socket *sock, void *ubuf, int size, int noblock,
if (addr_len != NULL)
*addr_len = sizeof(*sax);
/* This works for seqpacket too. The receiver has ordered the queue for us! We do one quick check first though */
/*
* This works for seqpacket too. The receiver has ordered the queue for
* us! We do one quick check first though
*/
if (sk->type == SOCK_SEQPACKET && sk->state != TCP_ESTABLISHED)
return -ENOTCONN;
......@@ -1150,8 +1163,12 @@ static int nr_recvfrom(struct socket *sock, void *ubuf, int size, int noblock,
if ((skb = skb_recv_datagram(sk, flags, noblock, &er)) == NULL)
return er;
copied = (size < skb->len - NR_TRANSPORT_LEN) ? size : skb->len - NR_TRANSPORT_LEN;
if (!sk->nr->hdrincl) {
skb_pull(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
skb->h.raw = skb->data;
}
copied = (size < skb->len) ? size : skb->len;
skb_copy_datagram(skb, 0, ubuf, copied);
if (sax != NULL) {
......@@ -1286,8 +1303,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return(0);
}
static int nr_get_info(char *buffer, char **start, off_t offset,
int length, int dummy)
static int nr_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
struct sock *s;
struct device *dev;
......
......@@ -211,7 +211,7 @@ int nr_init(struct device *dev)
dev->stop = nr_close;
dev->hard_header = nr_header;
dev->hard_header_len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + 2 + NR_NETWORK_LEN + NR_TRANSPORT_LEN;
dev->hard_header_len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + 3 + NR_NETWORK_LEN + NR_TRANSPORT_LEN;
dev->addr_len = AX25_ADDR_LEN;
dev->type = ARPHRD_NETROM;
dev->rebuild_header = nr_rebuild_header;
......
......@@ -68,11 +68,16 @@ static int nr_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
skbn->free = 1;
skbn->arp = 1;
skbn->sk = sk;
sk->rmem_alloc += skb->truesize;
sk->rmem_alloc += skbn->truesize;
skbn->h.raw = skbn->data;
skbo = skb_dequeue(&sk->nr->frag_queue);
memcpy(skb_put(skbn, skbo->len), skbo->data, skbo->len);
kfree_skb(skbo, FREE_READ);
while ((skbo = skb_dequeue(&sk->nr->frag_queue)) != NULL) {
skb_pull(skbo, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
memcpy(skb_put(skbn, skbo->len), skbo->data, skbo->len);
kfree_skb(skbo, FREE_READ);
}
......@@ -93,9 +98,9 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb, int frametype
case NR_CONNACK:
nr_calculate_rtt(sk);
sk->window = skb->data[5];
sk->nr->your_index = skb->data[2];
sk->nr->your_id = skb->data[3];
sk->window = skb->data[20];
sk->nr->your_index = skb->data[17];
sk->nr->your_id = skb->data[18];
sk->nr->t1timer = 0;
sk->nr->t2timer = 0;
sk->nr->t4timer = 0;
......@@ -170,8 +175,8 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype
unsigned short nr, ns;
int queued = 0;
nr = skb->data[3];
ns = skb->data[2];
nr = skb->data[18];
ns = skb->data[17];
switch (frametype) {
......@@ -276,7 +281,7 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype
do {
save_vr = sk->nr->vr;
while ((skbn = skb_dequeue(&sk->nr->reseq_queue)) != NULL) {
ns = skbn->data[2];
ns = skbn->data[17];
if (ns == sk->nr->vr) {
if (nr_queue_rx_frame(sk, skbn, frametype & NR_MORE_FLAG) == 0) {
sk->nr->vr = (sk->nr->vr + 1) % NR_MODULUS;
......@@ -328,7 +333,7 @@ int nr_process_rx_frame(struct sock *sk, struct sk_buff *skb)
del_timer(&sk->timer);
frametype = skb->data[4];
frametype = skb->data[19];
switch (sk->nr->state)
{
......
......@@ -15,6 +15,8 @@
*
* Fixes:
* Linus Torvalds : Assorted bug cures.
* Niibe Yutaka : async I/O support
* Carsten Paeth : PF_UNIX check, address fixes.
*/
#include <linux/config.h>
......@@ -237,14 +239,26 @@ static void def_callback1(struct sock *sk)
static void def_callback2(struct sock *sk, int len)
{
if(!sk->dead)
{
wake_up_interruptible(sk->sleep);
sock_wake_async(sk->socket, 1);
}
}
static void def_callback3(struct sock *sk)
{
if(!sk->dead)
{
wake_up_interruptible(sk->sleep);
sock_wake_async(sk->socket, 2);
}
}
static int unix_create(struct socket *sock, int protocol)
{
unix_socket *sk;
/* printk("Unix create\n");*/
if(protocol)
if(protocol && protocol != PF_UNIX)
return -EPROTONOSUPPORT;
sk=(unix_socket *)kmalloc(sizeof(*sk),GFP_KERNEL);
if(sk==NULL)
......@@ -289,7 +303,7 @@ static int unix_create(struct socket *sock, int protocol)
sk->shutdown=0;
sk->state_change=def_callback1;
sk->data_ready=def_callback2;
sk->write_space=def_callback1;
sk->write_space=def_callback3;
sk->error_report=def_callback1;
sk->mtu=4096;
sk->socket=sock;
......@@ -410,7 +424,6 @@ static int unix_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
struct sk_buff *skb;
int err;
unix_mkname(sun, addr_len);
if(sk->type==SOCK_STREAM && sk->protinfo.af_unix.other)
{
if(sock->state==SS_CONNECTING && sk->state==TCP_ESTABLISHED)
......@@ -428,9 +441,11 @@ static int unix_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
return -EISCONN;
}
if(sun->sun_family!=AF_UNIX)
if(addr_len < sizeof(sun->sun_family)+1 || sun->sun_family!=AF_UNIX)
return -EINVAL;
unix_mkname(sun, addr_len);
if(sk->type==SOCK_DGRAM && sk->protinfo.af_unix.other)
{
sk->protinfo.af_unix.other->protinfo.af_unix.locks--;
......@@ -440,6 +455,11 @@ static int unix_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
if(sock->type==SOCK_DGRAM)
{
other=unix_find_other(sun->sun_path, &err);
if(other==NULL)
return err;
other->protinfo.af_unix.locks++;
sk->protinfo.af_unix.other=other;
sock->state=SS_CONNECTED;
sk->state=TCP_ESTABLISHED;
return 0; /* Done */
......@@ -601,6 +621,7 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags)
tsk->protinfo.af_unix.locks++; /* Back lock */
sti();
tsk->state_change(tsk); /* Wake up any sleeping connect */
sock_wake_async(tsk->socket, 0);
return 0;
}
......@@ -619,10 +640,10 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
if(sk->protinfo.af_unix.name==NULL)
{
*sun->sun_path=0;
*uaddr_len=3;
*uaddr_len=sizeof(sun->sun_family)+1;
return 0; /* Not bound */
}
*uaddr_len=sizeof(short)+strlen(sk->protinfo.af_unix.name)+1;
*uaddr_len=sizeof(sun->sun_family)+strlen(sk->protinfo.af_unix.name)+1;
strcpy(sun->sun_path,sk->protinfo.af_unix.name); /* 108 byte limited */
return 0;
}
......@@ -688,6 +709,13 @@ static int unix_sendmsg(struct socket *sock, struct msghdr *msg, int len, int no
if(sun==NULL)
{
other=sk->protinfo.af_unix.other;
if(sock->type==SOCK_DGRAM && other->dead)
{
other->protinfo.af_unix.locks--;
sk->protinfo.af_unix.other=NULL;
sock->state=SS_UNCONNECTED;
return -ECONNRESET;
}
}
else
{
......@@ -761,7 +789,9 @@ static int unix_recvmsg(struct socket *sock, struct msghdr *msg, int size, int n
{
return -EAGAIN;
}
sk->socket->flags |= SO_WAITDATA;
interruptible_sleep_on(sk->sleep);
sk->socket->flags &= ~SO_WAITDATA;
if( current->signal & ~current->blocked)
{
sti();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment