diff -Naur -X exclude-files ac_cur/arch/um/drivers/daemon.h ac/arch/um/drivers/daemon.h --- ac_cur/arch/um/drivers/daemon.h Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/daemon.h Sun Jun 3 18:20:54 2001 @@ -4,6 +4,7 @@ */ #define ETH_ADDR_LEN 6 +#define DAEMON_HEADER (14) struct daemon_data { char *sock_type; diff -Naur -X exclude-files ac_cur/arch/um/drivers/daemon_kern.c ac/arch/um/drivers/daemon_kern.c --- ac_cur/arch/um/drivers/daemon_kern.c Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/daemon_kern.c Sun Jun 3 18:20:54 2001 @@ -60,18 +60,13 @@ return(daemon_user_set_mac(pri, hwaddr->sa_data, ETH_ALEN)); } -static int daemon_read(int fd, struct sk_buff *skb, +static int daemon_read(int fd, struct sk_buff **skb, struct uml_net_private *lp) { - if((skb != NULL) && (skb_tailroom(skb) < 14)){ - struct sk_buff *skb2; - - skb2 = skb_copy_expand(skb, 0, 14, GFP_ATOMIC); - dev_kfree_skb(skb); - skb = skb2; - } - if(skb != NULL) skb_put(skb, 14); - return(daemon_user_read(fd, skb->mac.raw, skb->dev->mtu + 14, + *skb = ether_adjust_skb(*skb, DAEMON_HEADER); + if(*skb == NULL) return(-ENOMEM); + return(daemon_user_read(fd, (*skb)->mac.raw, + (*skb)->dev->mtu + DAEMON_HEADER, (struct daemon_data *) &lp->user)); } diff -Naur -X exclude-files ac_cur/arch/um/drivers/daemon_user.c ac/arch/um/drivers/daemon_user.c --- ac_cur/arch/um/drivers/daemon_user.c Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/daemon_user.c Sun Jun 3 18:20:54 2001 @@ -184,7 +184,7 @@ open: daemon_open, close: daemon_close, set_mtu: daemon_set_mtu, - max_packet: MAX_PACKET - 14 + max_packet: MAX_PACKET - DAEMON_HEADER }; /* diff -Naur -X exclude-files ac_cur/arch/um/drivers/etap.h ac/arch/um/drivers/etap.h --- ac_cur/arch/um/drivers/etap.h Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/etap.h Sun Jun 3 18:20:54 2001 @@ -3,6 +3,8 @@ * Licensed under the GPL */ +#define ETHERTAP_HEADER (16) + struct ethertap_data { char *dev_name; char *gate_addr; diff -Naur -X exclude-files ac_cur/arch/um/drivers/ethertap_kern.c ac/arch/um/drivers/ethertap_kern.c --- ac_cur/arch/um/drivers/ethertap_kern.c Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/ethertap_kern.c Sun Jun 3 18:20:54 2001 @@ -76,14 +76,17 @@ return 0; } -static int etap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp) +static int etap_read(int fd, struct sk_buff **skb, struct uml_net_private *lp) { int len; - len = etap_user_read(fd, skb->mac.raw, skb->dev->mtu, + *skb = ether_adjust_skb(*skb, ETHERTAP_HEADER); + if(*skb == NULL) return(-ENOMEM); + len = etap_user_read(fd, (*skb)->mac.raw, + (*skb)->dev->mtu + 2 * ETHERTAP_HEADER, (struct ethertap_data *) &lp->user); if(len <= 0) return(len); - skb_pull(skb, 2); + skb_pull(*skb, 2); len -= 2; return(len); } diff -Naur -X exclude-files ac_cur/arch/um/drivers/ethertap_user.c ac/arch/um/drivers/ethertap_user.c --- ac_cur/arch/um/drivers/ethertap_user.c Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/ethertap_user.c Sun Jun 3 18:20:54 2001 @@ -155,7 +155,7 @@ open: etap_open, close: etap_close, set_mtu: etap_set_mtu, - max_packet: MAX_PACKET + max_packet: MAX_PACKET - ETHERTAP_HEADER }; /* diff -Naur -X exclude-files ac_cur/arch/um/drivers/net_kern.c ac/arch/um/drivers/net_kern.c --- ac_cur/arch/um/drivers/net_kern.c Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/net_kern.c Sun Jun 3 18:20:54 2001 @@ -88,7 +88,7 @@ skb->dev = dev; skb_put(skb, dev->mtu); skb->mac.raw = skb->data; - pkt_len = (*lp->read)(lp->fd, skb, lp); + pkt_len = (*lp->read)(lp->fd, &skb, lp); reactivate_fd(lp->fd); if (pkt_len > 0) { @@ -394,6 +394,19 @@ struct net_device *dev = d; memcpy(dev->dev_addr, addr, ETH_ALEN); +} + +struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra) +{ + if((skb != NULL) && (skb_tailroom(skb) < extra)){ + struct sk_buff *skb2; + + skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC); + dev_kfree_skb(skb); + skb = skb2; + } + if(skb != NULL) skb_put(skb, extra); + return(skb); } /* diff -Naur -X exclude-files ac_cur/arch/um/drivers/net_kern.h ac/arch/um/drivers/net_kern.h --- ac_cur/arch/um/drivers/net_kern.h Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/net_kern.h Sun Jun 3 18:20:54 2001 @@ -19,7 +19,7 @@ int (*set_mac)(struct sockaddr *hwaddr, void *); int (*open)(void *); void (*close)(int, void *); - int (*read)(int, struct sk_buff *skb, struct uml_net_private *); + int (*read)(int, struct sk_buff **skb, struct uml_net_private *); int (*write)(int, struct sk_buff *skb, struct uml_net_private *); int (*set_mtu)(int mtu, void *); int user[1]; @@ -29,7 +29,7 @@ struct net_device *(*init)(int, int); unsigned short (*protocol)(struct sk_buff *); int (*set_mac)(struct sockaddr *hwaddr, void *); - int (*read)(int, struct sk_buff *skb, struct uml_net_private *); + int (*read)(int, struct sk_buff **skb, struct uml_net_private *); int (*write)(int, struct sk_buff *skb, struct uml_net_private *); }; @@ -37,6 +37,7 @@ extern unsigned short ether_protocol(struct sk_buff *); extern int ether_set_mac(struct sockaddr *hwaddr, void *); extern int setup_etheraddr(char *str, unsigned char *addr); +extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra); #endif diff -Naur -X exclude-files ac_cur/arch/um/drivers/slip_kern.c ac/arch/um/drivers/slip_kern.c --- ac_cur/arch/um/drivers/slip_kern.c Sun Jun 3 18:19:20 2001 +++ ac/arch/um/drivers/slip_kern.c Sun Jun 3 18:20:54 2001 @@ -55,10 +55,10 @@ return(htons(ETH_P_IP)); } -static int slip_read(int fd, struct sk_buff *skb, +static int slip_read(int fd, struct sk_buff **skb, struct uml_net_private *lp) { - return(slip_user_read(fd, skb->mac.raw, skb->dev->mtu, + return(slip_user_read(fd, (*skb)->mac.raw, (*skb)->dev->mtu, (struct slip_data *) &lp->user)); }