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

Commit 1d5da757 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller
Browse files

ax25: Stop using magic neighbour cache operations.



Before the ax25 stack calls dev_queue_xmit it always calls
ax25_type_trans which sets skb->protocol to ETH_P_AX25.

Which means that by looking at the protocol type it is possible to
detect IP packets that have not been munged by the ax25 stack in
ndo_start_xmit and call a function to munge them.

Rename ax25_neigh_xmit to ax25_ip_xmit and tweak the return type and
value to be appropriate for an ndo_start_xmit function.

Update all of the ax25 devices to test the protocol type for ETH_P_IP
and return ax25_ip_xmit as the first thing they do.  This preserves
the existing semantics of IP packet processing, but the timing will be
a little different as the IP packets now pass through the qdisc layer
before reaching the ax25 ip packet processing.

Remove the now unnecessary ax25 neighbour table operations.

Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bcc90e3f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -247,6 +247,9 @@ static netdev_tx_t sp_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct sixpack *sp = netdev_priv(dev);

	if (skb->protocol == htons(ETH_P_IP))
		return ax25_ip_xmit(skb);

	spin_lock_bh(&sp->lock);
	/* We were not busy, so we are now... :-) */
	netif_stop_queue(dev);
@@ -302,7 +305,6 @@ static const struct net_device_ops sp_netdev_ops = {
	.ndo_stop		= sp_close,
	.ndo_start_xmit		= sp_xmit,
	.ndo_set_mac_address    = sp_set_mac_address,
	.ndo_neigh_construct	= ax25_neigh_construct,
};

static void sp_setup(struct net_device *dev)
@@ -316,7 +318,6 @@ static void sp_setup(struct net_device *dev)

	dev->addr_len		= AX25_ADDR_LEN;
	dev->type		= ARPHRD_AX25;
	dev->neigh_priv_len	= sizeof(struct ax25_neigh_priv);
	dev->tx_queue_len	= 10;

	/* Only activated in AX.25 mode */
+3 −2
Original line number Diff line number Diff line
@@ -772,6 +772,9 @@ static int baycom_send_packet(struct sk_buff *skb, struct net_device *dev)
{
	struct baycom_state *bc = netdev_priv(dev);

	if (skb->protocol == htons(ETH_P_IP))
		return ax25_ip_xmit(skb);

	if (skb->data[0] != 0) {
		do_kiss_params(bc, skb->data, skb->len);
		dev_kfree_skb(skb);
@@ -1109,7 +1112,6 @@ static const struct net_device_ops baycom_netdev_ops = {
	.ndo_do_ioctl	     = baycom_ioctl,
	.ndo_start_xmit      = baycom_send_packet,
	.ndo_set_mac_address = baycom_set_mac_address,
	.ndo_neigh_construct = ax25_neigh_construct,
};

/*
@@ -1147,7 +1149,6 @@ static void baycom_probe(struct net_device *dev)
	dev->header_ops = &ax25_header_ops;
	
	dev->type = ARPHRD_AX25;           /* AF_AX25 device */
	dev->neigh_priv_len = sizeof(struct ax25_neigh_priv);
	dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;
	dev->mtu = AX25_DEF_PACLEN;        /* eth_mtu is the default */
	dev->addr_len = AX25_ADDR_LEN;     /* sizeof an ax.25 address */
+3 −2
Original line number Diff line number Diff line
@@ -251,6 +251,9 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
	struct net_device *orig_dev;
	int size;

	if (skb->protocol == htons(ETH_P_IP))
		return ax25_ip_xmit(skb);

	/*
	 * Just to be *really* sure not to send anything if the interface
	 * is down, the ethernet device may have gone.
@@ -469,7 +472,6 @@ static const struct net_device_ops bpq_netdev_ops = {
	.ndo_start_xmit	     = bpq_xmit,
	.ndo_set_mac_address = bpq_set_mac_address,
	.ndo_do_ioctl	     = bpq_ioctl,
	.ndo_neigh_construct = ax25_neigh_construct,
};

static void bpq_setup(struct net_device *dev)
@@ -487,7 +489,6 @@ static void bpq_setup(struct net_device *dev)
#endif

	dev->type            = ARPHRD_AX25;
	dev->neigh_priv_len  = sizeof(struct ax25_neigh_priv);
	dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;
	dev->mtu             = AX25_DEF_PACLEN;
	dev->addr_len        = AX25_ADDR_LEN;
+3 −2
Original line number Diff line number Diff line
@@ -433,7 +433,6 @@ module_exit(dmascc_exit);
static void __init dev_setup(struct net_device *dev)
{
	dev->type = ARPHRD_AX25;
	dev->neigh_priv_len = sizeof(struct ax25_neigh_priv);
	dev->hard_header_len = AX25_MAX_HEADER_LEN;
	dev->mtu = 1500;
	dev->addr_len = AX25_ADDR_LEN;
@@ -448,7 +447,6 @@ static const struct net_device_ops scc_netdev_ops = {
	.ndo_start_xmit = scc_send_packet,
	.ndo_do_ioctl = scc_ioctl,
	.ndo_set_mac_address = scc_set_mac_address,
	.ndo_neigh_construct = ax25_neigh_construct,
};

static int __init setup_adapter(int card_base, int type, int n)
@@ -922,6 +920,9 @@ static int scc_send_packet(struct sk_buff *skb, struct net_device *dev)
	unsigned long flags;
	int i;

	if (skb->protocol == htons(ETH_P_IP))
		return ax25_ip_xmit(skb);

	/* Temporarily stop the scheduler feeding us packets */
	netif_stop_queue(dev);

+3 −2
Original line number Diff line number Diff line
@@ -404,6 +404,9 @@ static netdev_tx_t hdlcdrv_send_packet(struct sk_buff *skb,
{
	struct hdlcdrv_state *sm = netdev_priv(dev);

	if (skb->protocol == htons(ETH_P_IP))
		return ax25_ip_xmit(skb);

	if (skb->data[0] != 0) {
		do_kiss_params(sm, skb->data, skb->len);
		dev_kfree_skb(skb);
@@ -626,7 +629,6 @@ static const struct net_device_ops hdlcdrv_netdev = {
	.ndo_start_xmit = hdlcdrv_send_packet,
	.ndo_do_ioctl	= hdlcdrv_ioctl,
	.ndo_set_mac_address = hdlcdrv_set_mac_address,
	.ndo_neigh_construct = ax25_neigh_construct,
};

/*
@@ -677,7 +679,6 @@ static void hdlcdrv_setup(struct net_device *dev)
	dev->header_ops = &ax25_header_ops;
	
	dev->type = ARPHRD_AX25;           /* AF_AX25 device */
	dev->neigh_priv_len = sizeof(struct ax25_neigh_priv);
	dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;
	dev->mtu = AX25_DEF_PACLEN;        /* eth_mtu is the default */
	dev->addr_len = AX25_ADDR_LEN;     /* sizeof an ax.25 address */
Loading