aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/hdlc.c
diff options
context:
space:
mode:
authorKrzysztof Halasa <khc@pm.waw.pl>2007-03-02 18:52:22 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-03-02 23:37:37 -0500
commitb5284e5aa94be2f88dc92b29e97aff3da0c45f9f (patch)
treeaf96e87cf00cb7f001762e6a9ac6dff7579b1703 /drivers/net/wan/hdlc.c
parentc6387a8694506841389a6ac55175a8a984ae34e4 (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/hdlc.c')
-rw-r--r--drivers/net/wan/hdlc.c33
1 files changed, 23 insertions, 10 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
41static const char* version = "HDLC support module revision 1.20"; 41static 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
225static 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
225static void hdlc_setup(struct net_device *dev) 245static 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