[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>
This commit is contained in:
parent
c6387a8694
commit
b5284e5aa9
|
@ -38,7 +38,7 @@
|
|||
#include <linux/hdlc.h>
|
||||
|
||||
|
||||
static const char* version = "HDLC support module revision 1.20";
|
||||
static const char* version = "HDLC support module revision 1.21";
|
||||
|
||||
#undef DEBUG_LINK
|
||||
|
||||
|
@ -222,19 +222,31 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void hdlc_setup_dev(struct net_device *dev)
|
||||
{
|
||||
/* Re-init all variables changed by HDLC protocol drivers,
|
||||
* including ether_setup() called from hdlc_raw_eth.c.
|
||||
*/
|
||||
dev->get_stats = hdlc_get_stats;
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
dev->mtu = HDLC_MAX_MTU;
|
||||
dev->type = ARPHRD_RAWHDLC;
|
||||
dev->hard_header_len = 16;
|
||||
dev->addr_len = 0;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->set_mac_address = NULL;
|
||||
dev->hard_header_cache = NULL;
|
||||
dev->header_cache_update = NULL;
|
||||
dev->change_mtu = hdlc_change_mtu;
|
||||
dev->hard_header_parse = NULL;
|
||||
}
|
||||
|
||||
static void hdlc_setup(struct net_device *dev)
|
||||
{
|
||||
hdlc_device *hdlc = dev_to_hdlc(dev);
|
||||
|
||||
dev->get_stats = hdlc_get_stats;
|
||||
dev->change_mtu = hdlc_change_mtu;
|
||||
dev->mtu = HDLC_MAX_MTU;
|
||||
|
||||
dev->type = ARPHRD_RAWHDLC;
|
||||
dev->hard_header_len = 16;
|
||||
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
|
||||
hdlc_setup_dev(dev);
|
||||
hdlc->carrier = 1;
|
||||
hdlc->open = 0;
|
||||
spin_lock_init(&hdlc->state_lock);
|
||||
|
@ -294,6 +306,7 @@ void detach_hdlc_protocol(struct net_device *dev)
|
|||
}
|
||||
kfree(hdlc->state);
|
||||
hdlc->state = NULL;
|
||||
hdlc_setup_dev(dev);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -365,10 +365,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
|
|||
memcpy(&state(hdlc)->settings, &new_settings, size);
|
||||
dev->hard_start_xmit = hdlc->xmit;
|
||||
dev->hard_header = cisco_hard_header;
|
||||
dev->hard_header_cache = NULL;
|
||||
dev->type = ARPHRD_CISCO;
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
dev->addr_len = 0;
|
||||
netif_dormant_on(dev);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1289,10 +1289,7 @@ static int fr_ioctl(struct net_device *dev, struct ifreq *ifr)
|
|||
memcpy(&state(hdlc)->settings, &new_settings, size);
|
||||
|
||||
dev->hard_start_xmit = hdlc->xmit;
|
||||
dev->hard_header = NULL;
|
||||
dev->type = ARPHRD_FRAD;
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
dev->addr_len = 0;
|
||||
return 0;
|
||||
|
||||
case IF_PROTO_FR_ADD_PVC:
|
||||
|
|
|
@ -127,9 +127,7 @@ static int ppp_ioctl(struct net_device *dev, struct ifreq *ifr)
|
|||
if (result)
|
||||
return result;
|
||||
dev->hard_start_xmit = hdlc->xmit;
|
||||
dev->hard_header = NULL;
|
||||
dev->type = ARPHRD_PPP;
|
||||
dev->addr_len = 0;
|
||||
netif_dormant_off(dev);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -88,10 +88,7 @@ static int raw_ioctl(struct net_device *dev, struct ifreq *ifr)
|
|||
return result;
|
||||
memcpy(hdlc->state, &new_settings, size);
|
||||
dev->hard_start_xmit = hdlc->xmit;
|
||||
dev->hard_header = NULL;
|
||||
dev->type = ARPHRD_RAWHDLC;
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
dev->addr_len = 0;
|
||||
netif_dormant_off(dev);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -215,9 +215,7 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr)
|
|||
x25_rx, 0)) != 0)
|
||||
return result;
|
||||
dev->hard_start_xmit = x25_xmit;
|
||||
dev->hard_header = NULL;
|
||||
dev->type = ARPHRD_X25;
|
||||
dev->addr_len = 0;
|
||||
netif_dormant_off(dev);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue