[SKBUFF] introduce tr_hdr(skb)

The token ring code in the kernel is bitrotting (no surprise :) ),
it uses skb->data all around... I have an assortment of token ring
cards but no MAU, can anybody send me one, please? I promise to
make ssh work over LLC over Token Ring networks! Duh... :o)
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@conectiva.com.br>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent a4165571
......@@ -48,6 +48,15 @@ struct trh_hdr {
__u16 rseg[8]; /* routing registers */
};
#ifdef __KERNEL__
#include <linux/skbuff.h>
static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
{
return (struct trh_hdr *)skb->mac.raw;
}
#endif
/* This is an Token-Ring LLC structure */
struct trllc {
__u8 dsap; /* destination SAP */
......
......@@ -255,7 +255,7 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
if (skb->protocol == ntohs(ETH_P_802_2))
memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
else if (skb->protocol == ntohs(ETH_P_TR_802_2))
memcpy(sa, ((struct trh_hdr *)skb->mac.raw)->saddr, ETH_ALEN);
memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN);
}
/**
......@@ -270,7 +270,7 @@ static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
if (skb->protocol == ntohs(ETH_P_802_2))
memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
else if (skb->protocol == ntohs(ETH_P_TR_802_2))
memcpy(da, ((struct trh_hdr *)skb->mac.raw)->daddr, ETH_ALEN);
memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN);
}
/**
......
......@@ -40,7 +40,8 @@ int llc_mac_hdr_init(struct sk_buff *skb, unsigned char *sa, unsigned char *da)
struct net_device *dev = skb->dev;
struct trh_hdr *trh;
trh = (struct trh_hdr *)skb_push(skb, sizeof(*trh));
skb->mac.raw = skb_push(skb, sizeof(*trh));
trh = tr_hdr(skb);
trh->ac = AC;
trh->fc = LLC_FRAME;
if (sa)
......@@ -51,7 +52,6 @@ int llc_mac_hdr_init(struct sk_buff *skb, unsigned char *sa, unsigned char *da)
memcpy(trh->daddr, da, dev->addr_len);
tr_source_route(skb, trh, dev);
}
skb->mac.raw = skb->data;
break;
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment