diff options
author | Krzysztof Halasa <khc@pm.waw.pl> | 2007-03-02 18:52:22 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-03-02 23:37:37 -0500 |
commit | b5284e5aa94be2f88dc92b29e97aff3da0c45f9f (patch) | |
tree | af96e87cf00cb7f001762e6a9ac6dff7579b1703 /drivers/net/wan | |
parent | c6387a8694506841389a6ac55175a8a984ae34e4 (diff) |
[HDLC] Fix dev->header_cache_update having a random value.
Switching HDLC devices from Ethernet-framing mode caused stale ethernet
function assignments within net_device.
Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/hdlc.c | 33 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_cisco.c | 3 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_fr.c | 3 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_ppp.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_raw.c | 3 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_x25.c | 2 |
6 files changed, 23 insertions, 23 deletions
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 9040d7cf651e..65ad2e24caf0 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/hdlc.h> | 38 | #include <linux/hdlc.h> |
39 | 39 | ||
40 | 40 | ||
41 | static const char* version = "HDLC support module revision 1.20"; | 41 | static const char* version = "HDLC support module revision 1.21"; |
42 | 42 | ||
43 | #undef DEBUG_LINK | 43 | #undef DEBUG_LINK |
44 | 44 | ||
@@ -222,19 +222,31 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
222 | return -EINVAL; | 222 | return -EINVAL; |
223 | } | 223 | } |
224 | 224 | ||
225 | static void hdlc_setup_dev(struct net_device *dev) | ||
226 | { | ||
227 | /* Re-init all variables changed by HDLC protocol drivers, | ||
228 | * including ether_setup() called from hdlc_raw_eth.c. | ||
229 | */ | ||
230 | dev->get_stats = hdlc_get_stats; | ||
231 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | ||
232 | dev->mtu = HDLC_MAX_MTU; | ||
233 | dev->type = ARPHRD_RAWHDLC; | ||
234 | dev->hard_header_len = 16; | ||
235 | dev->addr_len = 0; | ||
236 | dev->hard_header = NULL; | ||
237 | dev->rebuild_header = NULL; | ||
238 | dev->set_mac_address = NULL; | ||
239 | dev->hard_header_cache = NULL; | ||
240 | dev->header_cache_update = NULL; | ||
241 | dev->change_mtu = hdlc_change_mtu; | ||
242 | dev->hard_header_parse = NULL; | ||
243 | } | ||
244 | |||
225 | static void hdlc_setup(struct net_device *dev) | 245 | static void hdlc_setup(struct net_device *dev) |
226 | { | 246 | { |
227 | hdlc_device *hdlc = dev_to_hdlc(dev); | 247 | hdlc_device *hdlc = dev_to_hdlc(dev); |
228 | 248 | ||
229 | dev->get_stats = hdlc_get_stats; | 249 | hdlc_setup_dev(dev); |
230 | dev->change_mtu = hdlc_change_mtu; | ||
231 | dev->mtu = HDLC_MAX_MTU; | ||
232 | |||
233 | dev->type = ARPHRD_RAWHDLC; | ||
234 | dev->hard_header_len = 16; | ||
235 | |||
236 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | ||
237 | |||
238 | hdlc->carrier = 1; | 250 | hdlc->carrier = 1; |
239 | hdlc->open = 0; | 251 | hdlc->open = 0; |
240 | spin_lock_init(&hdlc->state_lock); | 252 | spin_lock_init(&hdlc->state_lock); |
@@ -294,6 +306,7 @@ void detach_hdlc_protocol(struct net_device *dev) | |||
294 | } | 306 | } |
295 | kfree(hdlc->state); | 307 | kfree(hdlc->state); |
296 | hdlc->state = NULL; | 308 | hdlc->state = NULL; |
309 | hdlc_setup_dev(dev); | ||
297 | } | 310 | } |
298 | 311 | ||
299 | 312 | ||
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index b0bc5ddcf1b1..c9664fd8a917 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -365,10 +365,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
365 | memcpy(&state(hdlc)->settings, &new_settings, size); | 365 | memcpy(&state(hdlc)->settings, &new_settings, size); |
366 | dev->hard_start_xmit = hdlc->xmit; | 366 | dev->hard_start_xmit = hdlc->xmit; |
367 | dev->hard_header = cisco_hard_header; | 367 | dev->hard_header = cisco_hard_header; |
368 | dev->hard_header_cache = NULL; | ||
369 | dev->type = ARPHRD_CISCO; | 368 | dev->type = ARPHRD_CISCO; |
370 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | ||
371 | dev->addr_len = 0; | ||
372 | netif_dormant_on(dev); | 369 | netif_dormant_on(dev); |
373 | return 0; | 370 | return 0; |
374 | } | 371 | } |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index b45ab680d2d6..c6c3c757d6f1 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -1289,10 +1289,7 @@ static int fr_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
1289 | memcpy(&state(hdlc)->settings, &new_settings, size); | 1289 | memcpy(&state(hdlc)->settings, &new_settings, size); |
1290 | 1290 | ||
1291 | dev->hard_start_xmit = hdlc->xmit; | 1291 | dev->hard_start_xmit = hdlc->xmit; |
1292 | dev->hard_header = NULL; | ||
1293 | dev->type = ARPHRD_FRAD; | 1292 | dev->type = ARPHRD_FRAD; |
1294 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | ||
1295 | dev->addr_len = 0; | ||
1296 | return 0; | 1293 | return 0; |
1297 | 1294 | ||
1298 | case IF_PROTO_FR_ADD_PVC: | 1295 | case IF_PROTO_FR_ADD_PVC: |
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c index e9f717070fde..4591437dd2f3 100644 --- a/drivers/net/wan/hdlc_ppp.c +++ b/drivers/net/wan/hdlc_ppp.c | |||
@@ -127,9 +127,7 @@ static int ppp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
127 | if (result) | 127 | if (result) |
128 | return result; | 128 | return result; |
129 | dev->hard_start_xmit = hdlc->xmit; | 129 | dev->hard_start_xmit = hdlc->xmit; |
130 | dev->hard_header = NULL; | ||
131 | dev->type = ARPHRD_PPP; | 130 | dev->type = ARPHRD_PPP; |
132 | dev->addr_len = 0; | ||
133 | netif_dormant_off(dev); | 131 | netif_dormant_off(dev); |
134 | return 0; | 132 | return 0; |
135 | } | 133 | } |
diff --git a/drivers/net/wan/hdlc_raw.c b/drivers/net/wan/hdlc_raw.c index fe3cae5c6b9d..e23bc6656267 100644 --- a/drivers/net/wan/hdlc_raw.c +++ b/drivers/net/wan/hdlc_raw.c | |||
@@ -88,10 +88,7 @@ static int raw_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
88 | return result; | 88 | return result; |
89 | memcpy(hdlc->state, &new_settings, size); | 89 | memcpy(hdlc->state, &new_settings, size); |
90 | dev->hard_start_xmit = hdlc->xmit; | 90 | dev->hard_start_xmit = hdlc->xmit; |
91 | dev->hard_header = NULL; | ||
92 | dev->type = ARPHRD_RAWHDLC; | 91 | dev->type = ARPHRD_RAWHDLC; |
93 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | ||
94 | dev->addr_len = 0; | ||
95 | netif_dormant_off(dev); | 92 | netif_dormant_off(dev); |
96 | return 0; | 93 | return 0; |
97 | } | 94 | } |
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c index e4bb9f8ad433..cd7b22f50edc 100644 --- a/drivers/net/wan/hdlc_x25.c +++ b/drivers/net/wan/hdlc_x25.c | |||
@@ -215,9 +215,7 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
215 | x25_rx, 0)) != 0) | 215 | x25_rx, 0)) != 0) |
216 | return result; | 216 | return result; |
217 | dev->hard_start_xmit = x25_xmit; | 217 | dev->hard_start_xmit = x25_xmit; |
218 | dev->hard_header = NULL; | ||
219 | dev->type = ARPHRD_X25; | 218 | dev->type = ARPHRD_X25; |
220 | dev->addr_len = 0; | ||
221 | netif_dormant_off(dev); | 219 | netif_dormant_off(dev); |
222 | return 0; | 220 | return 0; |
223 | } | 221 | } |