diff options
Diffstat (limited to 'arch/um/os-Linux/drivers/ethertap_kern.c')
-rw-r--r-- | arch/um/os-Linux/drivers/ethertap_kern.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/arch/um/os-Linux/drivers/ethertap_kern.c b/arch/um/os-Linux/drivers/ethertap_kern.c index 12689141414d..542bcc58354c 100644 --- a/arch/um/os-Linux/drivers/ethertap_kern.c +++ b/arch/um/os-Linux/drivers/ethertap_kern.c | |||
@@ -1,16 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and | 2 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and |
3 | * James Leu (jleu@mindspring.net). | 3 | * James Leu (jleu@mindspring.net). |
4 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
4 | * Copyright (C) 2001 by various other people who didn't put their name here. | 5 | * Copyright (C) 2001 by various other people who didn't put their name here. |
5 | * Licensed under the GPL. | 6 | * Licensed under the GPL. |
6 | */ | 7 | */ |
7 | 8 | ||
8 | #include "linux/init.h" | 9 | #include "linux/init.h" |
9 | #include "linux/netdevice.h" | 10 | #include <linux/netdevice.h> |
10 | #include "linux/etherdevice.h" | ||
11 | #include "net_kern.h" | ||
12 | #include "net_user.h" | ||
13 | #include "etap.h" | 11 | #include "etap.h" |
12 | #include "net_kern.h" | ||
14 | 13 | ||
15 | struct ethertap_init { | 14 | struct ethertap_init { |
16 | char *dev_name; | 15 | char *dev_name; |
@@ -42,27 +41,30 @@ static int etap_read(int fd, struct sk_buff **skb, struct uml_net_private *lp) | |||
42 | int len; | 41 | int len; |
43 | 42 | ||
44 | *skb = ether_adjust_skb(*skb, ETH_HEADER_ETHERTAP); | 43 | *skb = ether_adjust_skb(*skb, ETH_HEADER_ETHERTAP); |
45 | if(*skb == NULL) return(-ENOMEM); | 44 | if (*skb == NULL) |
45 | return -ENOMEM; | ||
46 | len = net_recvfrom(fd, skb_mac_header(*skb), | 46 | len = net_recvfrom(fd, skb_mac_header(*skb), |
47 | (*skb)->dev->mtu + 2 * ETH_HEADER_ETHERTAP); | 47 | (*skb)->dev->mtu + 2 * ETH_HEADER_ETHERTAP); |
48 | if(len <= 0) return(len); | 48 | if (len <= 0) |
49 | return len; | ||
49 | skb_pull(*skb, 2); | 50 | skb_pull(*skb, 2); |
50 | len -= 2; | 51 | len -= 2; |
51 | return(len); | 52 | return len; |
52 | } | 53 | } |
53 | 54 | ||
54 | static int etap_write(int fd, struct sk_buff **skb, struct uml_net_private *lp) | 55 | static int etap_write(int fd, struct sk_buff **skb, struct uml_net_private *lp) |
55 | { | 56 | { |
56 | if(skb_headroom(*skb) < 2){ | 57 | if (skb_headroom(*skb) < 2) { |
57 | struct sk_buff *skb2; | 58 | struct sk_buff *skb2; |
58 | 59 | ||
59 | skb2 = skb_realloc_headroom(*skb, 2); | 60 | skb2 = skb_realloc_headroom(*skb, 2); |
60 | dev_kfree_skb(*skb); | 61 | dev_kfree_skb(*skb); |
61 | if (skb2 == NULL) return(-ENOMEM); | 62 | if (skb2 == NULL) |
63 | return -ENOMEM; | ||
62 | *skb = skb2; | 64 | *skb = skb2; |
63 | } | 65 | } |
64 | skb_push(*skb, 2); | 66 | skb_push(*skb, 2); |
65 | return(net_send(fd, (*skb)->data, (*skb)->len)); | 67 | return net_send(fd, (*skb)->data, (*skb)->len); |
66 | } | 68 | } |
67 | 69 | ||
68 | const struct net_kern_info ethertap_kern_info = { | 70 | const struct net_kern_info ethertap_kern_info = { |
@@ -79,15 +81,15 @@ int ethertap_setup(char *str, char **mac_out, void *data) | |||
79 | *init = ((struct ethertap_init) | 81 | *init = ((struct ethertap_init) |
80 | { .dev_name = NULL, | 82 | { .dev_name = NULL, |
81 | .gate_addr = NULL }); | 83 | .gate_addr = NULL }); |
82 | if(tap_setup_common(str, "ethertap", &init->dev_name, mac_out, | 84 | if (tap_setup_common(str, "ethertap", &init->dev_name, mac_out, |
83 | &init->gate_addr)) | 85 | &init->gate_addr)) |
84 | return(0); | 86 | return 0; |
85 | if(init->dev_name == NULL){ | 87 | if (init->dev_name == NULL) { |
86 | printk("ethertap_setup : Missing tap device name\n"); | 88 | printk(KERN_ERR "ethertap_setup : Missing tap device name\n"); |
87 | return(0); | 89 | return 0; |
88 | } | 90 | } |
89 | 91 | ||
90 | return(1); | 92 | return 1; |
91 | } | 93 | } |
92 | 94 | ||
93 | static struct transport ethertap_transport = { | 95 | static struct transport ethertap_transport = { |