checksum.c (59c58f96b270f5edd4ad10954c3a96556cb3a728) checksum.c (0dcf0c0aeefd2bc1023c9fe7ab0f1b6bc993c360)
1/*
2 * IP checksumming functions.
3 * (c) 2008 Gerd Hoffmann <kraxel@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; under version 2 or later of the License.
8 *

--- 92 unchanged lines hidden (view full) ---

101 }
102
103 ip = (struct ip_header *)(data + mac_hdr_len);
104
105 if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
106 return; /* not IPv4 */
107 }
108
1/*
2 * IP checksumming functions.
3 * (c) 2008 Gerd Hoffmann <kraxel@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; under version 2 or later of the License.
8 *

--- 92 unchanged lines hidden (view full) ---

101 }
102
103 ip = (struct ip_header *)(data + mac_hdr_len);
104
105 if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
106 return; /* not IPv4 */
107 }
108
109 if (IP4_IS_FRAGMENT(ip)) {
110 return; /* a fragmented IP packet */
111 }
112
109 ip_len = lduw_be_p(&ip->ip_len);
110
111 /* Last, check that we have enough data for the all IP frame */
112 if (length < ip_len) {
113 return;
114 }
115
116 ip_len -= IP_HDR_GET_LEN(ip);

--- 76 unchanged lines hidden ---
113 ip_len = lduw_be_p(&ip->ip_len);
114
115 /* Last, check that we have enough data for the all IP frame */
116 if (length < ip_len) {
117 return;
118 }
119
120 ip_len -= IP_HDR_GET_LEN(ip);

--- 76 unchanged lines hidden ---