diff -urp vmnet-only-old/bridge.c vmnet-only/bridge.c --- vmnet-only-old/bridge.c 2007-07-19 17:25:07.000000000 +0200 +++ vmnet-only/bridge.c 2007-07-19 16:25:00.000000000 +0200 @@ -1083,12 +1083,14 @@ static INLINE_SINGLE_CALLER void VNetBridgeComputeHeaderPos(struct sk_buff *skb) // IN: buffer to examine { /* Maybe some kernel gets it right... */ - if (skb->h.raw != skb->nh.raw) { + //if (skb->h.raw != skb->nh.raw) { + if (skb_transport_header(skb) != skb_network_header(skb)) { return; } switch (be16_to_cpu(skb->protocol)) { case ETH_P_IP: - skb->h.raw = skb->nh.raw + (skb->nh.raw[0] & 0x0F) * 4; + //skb->h.raw = skb->nh.raw + (skb->nh.raw[0] & 0x0F) * 4; + skb_set_transport_header(skb, skb_network_offset(skb) + (skb_network_header(skb)[0] & 0x0F) * 4); return; default: LOG(3, (KERN_DEBUG "Unknown EII protocol %04X: csum at %d\n", @@ -1143,21 +1145,28 @@ VNetBridgeGSOSegment(struct sk_buff *skb uint16 ipID; uint32 seqNo; - if (((struct ethhdr *)skb->mac.raw)->h_proto != htons(ETH_P_IP)) { +// if (((struct ethhdr *)skb->mac.raw)->h_proto != htons(ETH_P_IP)) { + if (((struct ethhdr *)skb_mac_header(skb))->h_proto != htons(ETH_P_IP)) { return ERR_PTR(-EPFNOSUPPORT); } - if (skb->nh.iph->protocol != IPPROTO_TCP) { +// if (skb->nh.iph->protocol != IPPROTO_TCP) { + if (ip_hdr(skb)->protocol != IPPROTO_TCP) { return ERR_PTR(-EPROTONOSUPPORT); } - macHdrLen = skb->nh.raw - skb->mac.raw; - ipHdrLen = skb->nh.iph->ihl << 2; - tcpHdrLen = skb->h.th->doff << 2; + //macHdrLen = skb->nh.raw - skb->mac.raw; + //ipHdrLen = skb->nh.iph->ihl << 2; + //tcpHdrLen = skb->h.th->doff << 2; + macHdrLen = skb_network_header(skb) - skb_mac_header(skb); + ipHdrLen = ip_hdr(skb)->ihl << 2; + tcpHdrLen = tcp_hdr(skb)->doff << 2; allHdrLen = macHdrLen + ipHdrLen + tcpHdrLen; - ipID = ntohs(skb->nh.iph->id); - seqNo = ntohl(skb->h.th->seq); + //ipID = ntohs(skb->nh.iph->id); + //seqNo = ntohl(skb->h.th->seq); + ipID = ntohs(ip_hdr(skb)->id); + seqNo = ntohl(tcp_hdr(skb)->seq); /* Host TCP stack populated this (MSS) for the host NIC driver */ bytesPerPacket = skb_shinfo(skb)->tso_size; @@ -1194,9 +1203,12 @@ VNetBridgeGSOSegment(struct sk_buff *skb memcpy(skb_put(newSkb, allHdrLen), skb->data, allHdrLen); /* Fix up pointers to different layers */ - newSkb->mac.raw = newSkb->data; - newSkb->nh.raw = newSkb->data + macHdrLen; - newSkb->h.raw = newSkb->nh.raw + ipHdrLen; + //newSkb->mac.raw = newSkb->data; + //newSkb->nh.raw = newSkb->data + macHdrLen; + //newSkb->h.raw = newSkb->nh.raw + ipHdrLen; + skb_set_mac_header(newSkb, 0); + skb_set_network_header(newSkb, macHdrLen); + skb_set_transport_header(newSkb, skb_network_offset(newSkb) + ipHdrLen); /* Payload copy */ skb_copy_bits(skb, curByteOffset, newSkb->tail, payloadSize); @@ -1206,25 +1218,38 @@ VNetBridgeGSOSegment(struct sk_buff *skb bytesLeft -= payloadSize; /* Fix up IP hdr */ - newSkb->nh.iph->tot_len = htons(payloadSize + tcpHdrLen + ipHdrLen); - newSkb->nh.iph->id = htons(ipID); - newSkb->nh.iph->check = 0; + //newSkb->nh.iph->tot_len = htons(payloadSize + tcpHdrLen + ipHdrLen); + //newSkb->nh.iph->id = htons(ipID); + //newSkb->nh.iph->check = 0; + ip_hdr(newSkb)->tot_len = htons(payloadSize + tcpHdrLen + ipHdrLen); + ip_hdr(newSkb)->id = htons(ipID); + ip_hdr(newSkb)->check = 0; /* Recompute new IP checksum */ - newSkb->nh.iph->check = - ip_fast_csum((uint8 *)newSkb->nh.iph, newSkb->nh.iph->ihl); + //newSkb->nh.iph->check = + // ip_fast_csum((uint8 *)newSkb->nh.iph, newSkb->nh.iph->ihl); + ip_hdr(newSkb)->check = + ip_fast_csum((uint8 *)ip_hdr(newSkb), ip_hdr(newSkb)->ihl); + /* Fix up TCP hdr */ - newSkb->h.th->seq = htonl(seqNo); + //newSkb->h.th->seq = htonl(seqNo); + tcp_hdr(newSkb)->seq = htonl(seqNo); /* Clear FIN/PSH if not last packet */ if (bytesLeft > 0) { - newSkb->h.th->fin = 0; - newSkb->h.th->psh = 0; + //newSkb->h.th->fin = 0; + //newSkb->h.th->psh = 0; + tcp_hdr(newSkb)->fin = 0; + tcp_hdr(newSkb)->psh = 0; } /* Recompute partial TCP checksum */ - newSkb->h.th->check = - ~csum_tcpudp_magic(newSkb->nh.iph->saddr, - newSkb->nh.iph->daddr, + //newSkb->h.th->check = + // ~csum_tcpudp_magic(newSkb->nh.iph->saddr, + // newSkb->nh.iph->daddr, + tcp_hdr(newSkb)->check = + ~csum_tcpudp_magic(ip_hdr(newSkb)->saddr, + ip_hdr(newSkb)->daddr, payloadSize+tcpHdrLen, IPPROTO_TCP, 0); + /* Offset of field */ newSkb->csum = offsetof(struct tcphdr, check); @@ -1370,7 +1395,8 @@ VNetBridgeReceiveFromDev(struct sk_buff # endif if (bridge->smac) { - if (VNetCallSMACFunc(bridge->smac, &skb, skb->mac.raw, + //if (VNetCallSMACFunc(bridge->smac, &skb, skb->mac.raw, + if (VNetCallSMACFunc(bridge->smac, &skb, skb_mac_header(skb), SMAC_CheckPacketFromHost) != PacketStatusForwardPacket) { LOG(4, (KERN_NOTICE "bridge-%s: packet dropped .\n", @@ -1392,7 +1418,8 @@ VNetBridgeReceiveFromDev(struct sk_buff #endif #endif - skb_push(skb, skb->data - skb->mac.raw); + //skb_push(skb, skb->data - skb->mac.raw); + skb_push(skb, skb->data - skb_mac_header(skb)); LOG(3, (KERN_DEBUG "bridge-%s: receive %d\n", bridge->name, (int) skb->len)); diff -urp vmnet-only-old/filter.c vmnet-only/filter.c --- vmnet-only-old/filter.c 2007-07-19 17:25:07.000000000 +0200 +++ vmnet-only/filter.c 2007-07-19 16:20:56.000000000 +0200 @@ -229,15 +229,18 @@ VNetFilterHookFn(unsigned int hooknum, /* When the host receives, hooknum is NF_IP_LOCAL_IN. */ transmit = (hooknum == NF_IP_POST_ROUTING); - ip = skb->nh.iph; + //ip = skb->nh.iph; + ip = ip_hdr(skb); packetHeader = (uint8 *)ip; if (transmit) { /* skb all set up for us. */ - packet = skb->h.raw; + //packet = skb->h.raw; + packet = skb_transport_header(skb); } else { /* skb hasn't had a chance to be processed by TCP yet. */ - packet = skb->nh.raw + (ip->ihl << 2); + //packet = skb->nh.raw + (ip->ihl << 2); + packet = skb_network_header(skb) + (ip->ihl << 2); } HostFilterPrint(("PacketFilter: IP ver %d ihl %d tos %d len %d id %d\n" @@ -252,20 +255,24 @@ VNetFilterHookFn(unsigned int hooknum, * a populated L2 address length. */ if (skb->dev && skb->dev->hard_header_len) { - packetLength = skb->len - skb->dev->hard_header_len - (ip->ihl << 2); + //packetLength = skb->len - skb->dev->hard_header_len - (ip->ihl << 2); + packetLength = skb->len - (skb_network_header(skb) - skb_mac_header(skb)) - (ip->ihl << 2); } else { /* * In certain cases, skb->mac.raw has been observed to be NULL. Don't * know why, but in such cases, this calculation will lead to a negative * packetLength, and the packet to be dropped. */ - packetLength = skb->len - (skb->nh.raw - skb->mac.raw) - (ip->ihl << 2); + //packetLength = skb->len - (skb->nh.raw - skb->mac.raw) - (ip->ihl << 2); + packetLength = skb->len - (skb_network_header(skb) - skb_mac_header(skb)) - (ip->ihl << 2); } if (packetLength < 0) { HostFilterPrint(("PacketFilter: ill formed packet for IPv4\n")); - HostFilterPrint(("skb: len %d h.raw %p nh.raw %p mac.raw %p, packetLength %d\n", - skb->len, skb->h.raw, skb->nh.raw, skb->mac.raw, packetLength)); + //HostFilterPrint(("skb: len %d h.raw %p nh.raw %p mac.raw %p, packetLength %d\n", + // skb->len, skb->h.raw, skb->nh.raw, skb->mac.raw, packetLength)); + HostFilterPrint(("skb: len %d transport_header %p network_header %p mac.raw %p, packetLength %d\n", + skb->len, skb_transport_header(skb), skb->network_header(skb), skb_mac_header(skb), packetLength)); verdict = NF_DROP; DropPacket(VNET_FILTER_ACTION_DRP_SHORT, packetHeader, packet, 0); goto out_unlock; diff -urp vmnet-only-old/smac_compat.c vmnet-only/smac_compat.c --- vmnet-only-old/smac_compat.c 2007-07-19 17:25:07.000000000 +0200 +++ vmnet-only/smac_compat.c 2007-07-19 16:22:22.000000000 +0200 @@ -457,8 +457,10 @@ SMACL_PrintSkb(struct sk_buff *skb, LOG(4, (KERN_DEBUG "users %d, tail %p, end %p\n", atomic_read(&skb->users), skb->tail, skb->end)); #if 0 -#define C skb->mac.raw - if(skb->mac.raw) { +//#define C skb->mac.raw +// if(skb->mac.raw) { +#define C skb_mac_header(skb) + if(skb_mac_header(skb)) { LOG(4, (KERN_DEBUG "dest %02x:%02x:%02x:%02x:%02x:%02x" " source %02x:%02x:%02x:%02x:%02x:%02x\n", C[0],C[1],C[2],C[3],C[4],C[5] , diff -urp vmnet-only-old/userif.c vmnet-only/userif.c --- vmnet-only-old/userif.c 2007-07-19 17:25:07.000000000 +0200 +++ vmnet-only/userif.c 2007-07-19 16:07:34.000000000 +0200 @@ -627,13 +627,15 @@ VNetCopyDatagramToUser(const struct sk_b */ if (skb->pkt_type == PACKET_OUTGOING && /* Packet must be outgoing */ skb->ip_summed == VM_CHECKSUM_PARTIAL && /* Without checksum */ - skb->h.raw != skb->nh.raw && /* We must know where header is */ + //skb->h.raw != skb->nh.raw && /* We must know where header is */ + skb_transport_header(skb) != skb_network_header(skb) && /* We must know where header is */ skb->len == count) { /* No truncation may occur */ size_t skl; int csum; u_int16_t csum16; - skl = skb->h.raw - skb->data; + //skl = skb->h.raw - skb->data; + skl = skb_transport_offset(skb); if (VNetCopyDatagram(skb, buf, skl)) { return -EFAULT; } diff -urp vmnet-only-old/vnetInt.h vmnet-only/vnetInt.h --- vmnet-only-old/vnetInt.h 2007-07-19 17:25:07.000000000 +0200 +++ vmnet-only/vnetInt.h 2007-07-19 17:04:06.000000000 +0200 @@ -25,8 +25,8 @@ #define DEV_QUEUE_XMIT(skb, dev, pri) ( \ (skb)->dev = (dev), \ (skb)->priority = (pri), \ - (skb)->mac.raw = (skb)->data, \ - (skb)->nh.raw = (skb)->data + sizeof (struct ethhdr), \ + skb_set_mac_header(skb,0), \ + skb_set_network_header(skb,sizeof (struct ethhdr)), \ dev_queue_xmit(skb) \ ) #ifdef KERNEL_2_3_15