Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5284e5a authored by Krzysztof Halasa's avatar Krzysztof Halasa Committed by David S. Miller
Browse files

[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: default avatarKrzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c6387a86
Loading
Loading
Loading
Loading
+23 −10
Original line number Diff line number Diff line
@@ -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(struct net_device *dev)
static void hdlc_setup_dev(struct net_device *dev)
{
	hdlc_device *hdlc = dev_to_hdlc(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->change_mtu = hdlc_change_mtu;
	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;
}

	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
static void hdlc_setup(struct net_device *dev)
{
	hdlc_device *hdlc = dev_to_hdlc(dev);

	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);
}


+0 −3
Original line number Diff line number Diff line
@@ -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;
	}
+0 −3
Original line number Diff line number Diff line
@@ -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:
+0 −2
Original line number Diff line number Diff line
@@ -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;
	}
+0 −3
Original line number Diff line number Diff line
@@ -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;
	}
Loading