提交 19e36da6 编写于 作者: J Julian Wiedmann 提交者: David S. Miller

s390/qeth: robustify qeth_get_ip_version()

Instead of assuming that skb->data points to the Ethernet header, use
the right helper and struct to access the Ethertype field.
Signed-off-by: NJulian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 00c163f1
...@@ -847,14 +847,16 @@ static inline int qeth_get_micros(void) ...@@ -847,14 +847,16 @@ static inline int qeth_get_micros(void)
static inline int qeth_get_ip_version(struct sk_buff *skb) static inline int qeth_get_ip_version(struct sk_buff *skb)
{ {
__be16 *p = &((struct ethhdr *)skb->data)->h_proto; struct vlan_ethhdr *veth = vlan_eth_hdr(skb);
__be16 prot = veth->h_vlan_proto;
if (be16_to_cpu(*p) == ETH_P_8021Q) if (prot == htons(ETH_P_8021Q))
p += 2; prot = veth->h_vlan_encapsulated_proto;
switch (be16_to_cpu(*p)) {
case ETH_P_IPV6: switch (prot) {
case htons(ETH_P_IPV6):
return 6; return 6;
case ETH_P_IP: case htons(ETH_P_IP):
return 4; return 4;
default: default:
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册