diff options
-rw-r--r-- | net/core/dev.c | 4 | ||||
-rw-r--r-- | net/core/filter.c | 6 | ||||
-rw-r--r-- | net/core/netpoll.c | 2 | ||||
-rw-r--r-- | net/core/pktgen.c | 68 |
4 files changed, 38 insertions, 42 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 5bf13b132dd7..a7be106d0fdb 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1215,7 +1215,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features) | |||
1215 | { | 1215 | { |
1216 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); | 1216 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); |
1217 | struct packet_type *ptype; | 1217 | struct packet_type *ptype; |
1218 | int type = skb->protocol; | 1218 | __be16 type = skb->protocol; |
1219 | int err; | 1219 | int err; |
1220 | 1220 | ||
1221 | BUG_ON(skb_shinfo(skb)->frag_list); | 1221 | BUG_ON(skb_shinfo(skb)->frag_list); |
@@ -1766,7 +1766,7 @@ int netif_receive_skb(struct sk_buff *skb) | |||
1766 | struct packet_type *ptype, *pt_prev; | 1766 | struct packet_type *ptype, *pt_prev; |
1767 | struct net_device *orig_dev; | 1767 | struct net_device *orig_dev; |
1768 | int ret = NET_RX_DROP; | 1768 | int ret = NET_RX_DROP; |
1769 | unsigned short type; | 1769 | __be16 type; |
1770 | 1770 | ||
1771 | /* if we've gotten here through NAPI, check netpoll */ | 1771 | /* if we've gotten here through NAPI, check netpoll */ |
1772 | if (skb->dev->poll && netpoll_rx(skb)) | 1772 | if (skb->dev->poll && netpoll_rx(skb)) |
diff --git a/net/core/filter.c b/net/core/filter.c index 6732782a5a40..0df843b667f4 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -178,7 +178,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int | |||
178 | load_w: | 178 | load_w: |
179 | ptr = load_pointer(skb, k, 4, &tmp); | 179 | ptr = load_pointer(skb, k, 4, &tmp); |
180 | if (ptr != NULL) { | 180 | if (ptr != NULL) { |
181 | A = ntohl(get_unaligned((u32 *)ptr)); | 181 | A = ntohl(get_unaligned((__be32 *)ptr)); |
182 | continue; | 182 | continue; |
183 | } | 183 | } |
184 | break; | 184 | break; |
@@ -187,7 +187,7 @@ load_w: | |||
187 | load_h: | 187 | load_h: |
188 | ptr = load_pointer(skb, k, 2, &tmp); | 188 | ptr = load_pointer(skb, k, 2, &tmp); |
189 | if (ptr != NULL) { | 189 | if (ptr != NULL) { |
190 | A = ntohs(get_unaligned((u16 *)ptr)); | 190 | A = ntohs(get_unaligned((__be16 *)ptr)); |
191 | continue; | 191 | continue; |
192 | } | 192 | } |
193 | break; | 193 | break; |
@@ -261,7 +261,7 @@ load_b: | |||
261 | */ | 261 | */ |
262 | switch (k-SKF_AD_OFF) { | 262 | switch (k-SKF_AD_OFF) { |
263 | case SKF_AD_PROTOCOL: | 263 | case SKF_AD_PROTOCOL: |
264 | A = htons(skb->protocol); | 264 | A = ntohs(skb->protocol); |
265 | continue; | 265 | continue; |
266 | case SKF_AD_PKTTYPE: | 266 | case SKF_AD_PKTTYPE: |
267 | A = skb->pkt_type; | 267 | A = skb->pkt_type; |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 0746c81c57b0..523141ee920c 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -330,7 +330,7 @@ static void arp_reply(struct sk_buff *skb) | |||
330 | struct arphdr *arp; | 330 | struct arphdr *arp; |
331 | unsigned char *arp_ptr; | 331 | unsigned char *arp_ptr; |
332 | int size, type = ARPOP_REPLY, ptype = ETH_P_ARP; | 332 | int size, type = ARPOP_REPLY, ptype = ETH_P_ARP; |
333 | u32 sip, tip; | 333 | __be32 sip, tip; |
334 | struct sk_buff *send_skb; | 334 | struct sk_buff *send_skb; |
335 | struct netpoll *np = NULL; | 335 | struct netpoll *np = NULL; |
336 | 336 | ||
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 733d86d0a4fb..1897a3a385d8 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -207,7 +207,7 @@ static struct proc_dir_entry *pg_proc_dir = NULL; | |||
207 | #define SVLAN_TAG_SIZE(x) ((x)->svlan_id == 0xffff ? 0 : 4) | 207 | #define SVLAN_TAG_SIZE(x) ((x)->svlan_id == 0xffff ? 0 : 4) |
208 | 208 | ||
209 | struct flow_state { | 209 | struct flow_state { |
210 | __u32 cur_daddr; | 210 | __be32 cur_daddr; |
211 | int count; | 211 | int count; |
212 | }; | 212 | }; |
213 | 213 | ||
@@ -282,10 +282,10 @@ struct pktgen_dev { | |||
282 | /* If we're doing ranges, random or incremental, then this | 282 | /* If we're doing ranges, random or incremental, then this |
283 | * defines the min/max for those ranges. | 283 | * defines the min/max for those ranges. |
284 | */ | 284 | */ |
285 | __u32 saddr_min; /* inclusive, source IP address */ | 285 | __be32 saddr_min; /* inclusive, source IP address */ |
286 | __u32 saddr_max; /* exclusive, source IP address */ | 286 | __be32 saddr_max; /* exclusive, source IP address */ |
287 | __u32 daddr_min; /* inclusive, dest IP address */ | 287 | __be32 daddr_min; /* inclusive, dest IP address */ |
288 | __u32 daddr_max; /* exclusive, dest IP address */ | 288 | __be32 daddr_max; /* exclusive, dest IP address */ |
289 | 289 | ||
290 | __u16 udp_src_min; /* inclusive, source UDP port */ | 290 | __u16 udp_src_min; /* inclusive, source UDP port */ |
291 | __u16 udp_src_max; /* exclusive, source UDP port */ | 291 | __u16 udp_src_max; /* exclusive, source UDP port */ |
@@ -317,8 +317,8 @@ struct pktgen_dev { | |||
317 | 317 | ||
318 | __u32 cur_dst_mac_offset; | 318 | __u32 cur_dst_mac_offset; |
319 | __u32 cur_src_mac_offset; | 319 | __u32 cur_src_mac_offset; |
320 | __u32 cur_saddr; | 320 | __be32 cur_saddr; |
321 | __u32 cur_daddr; | 321 | __be32 cur_daddr; |
322 | __u16 cur_udp_dst; | 322 | __u16 cur_udp_dst; |
323 | __u16 cur_udp_src; | 323 | __u16 cur_udp_src; |
324 | __u32 cur_pkt_size; | 324 | __u32 cur_pkt_size; |
@@ -350,10 +350,10 @@ struct pktgen_dev { | |||
350 | }; | 350 | }; |
351 | 351 | ||
352 | struct pktgen_hdr { | 352 | struct pktgen_hdr { |
353 | __u32 pgh_magic; | 353 | __be32 pgh_magic; |
354 | __u32 seq_num; | 354 | __be32 seq_num; |
355 | __u32 tv_sec; | 355 | __be32 tv_sec; |
356 | __u32 tv_usec; | 356 | __be32 tv_usec; |
357 | }; | 357 | }; |
358 | 358 | ||
359 | struct pktgen_thread { | 359 | struct pktgen_thread { |
@@ -2160,7 +2160,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
2160 | for(i = 0; i < pkt_dev->nr_labels; i++) | 2160 | for(i = 0; i < pkt_dev->nr_labels; i++) |
2161 | if (pkt_dev->labels[i] & MPLS_STACK_BOTTOM) | 2161 | if (pkt_dev->labels[i] & MPLS_STACK_BOTTOM) |
2162 | pkt_dev->labels[i] = MPLS_STACK_BOTTOM | | 2162 | pkt_dev->labels[i] = MPLS_STACK_BOTTOM | |
2163 | (pktgen_random() & | 2163 | ((__force __be32)pktgen_random() & |
2164 | htonl(0x000fffff)); | 2164 | htonl(0x000fffff)); |
2165 | } | 2165 | } |
2166 | 2166 | ||
@@ -2220,29 +2220,25 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
2220 | if (pkt_dev->cflows && pkt_dev->flows[flow].count != 0) { | 2220 | if (pkt_dev->cflows && pkt_dev->flows[flow].count != 0) { |
2221 | pkt_dev->cur_daddr = pkt_dev->flows[flow].cur_daddr; | 2221 | pkt_dev->cur_daddr = pkt_dev->flows[flow].cur_daddr; |
2222 | } else { | 2222 | } else { |
2223 | 2223 | imn = ntohl(pkt_dev->daddr_min); | |
2224 | if ((imn = ntohl(pkt_dev->daddr_min)) < (imx = | 2224 | imx = ntohl(pkt_dev->daddr_max); |
2225 | ntohl(pkt_dev-> | 2225 | if (imn < imx) { |
2226 | daddr_max))) | ||
2227 | { | ||
2228 | __u32 t; | 2226 | __u32 t; |
2227 | __be32 s; | ||
2229 | if (pkt_dev->flags & F_IPDST_RND) { | 2228 | if (pkt_dev->flags & F_IPDST_RND) { |
2230 | 2229 | ||
2231 | t = ((pktgen_random() % (imx - imn)) + | 2230 | t = pktgen_random() % (imx - imn) + imn; |
2232 | imn); | 2231 | s = htonl(t); |
2233 | t = htonl(t); | ||
2234 | 2232 | ||
2235 | while (LOOPBACK(t) || MULTICAST(t) | 2233 | while (LOOPBACK(s) || MULTICAST(s) |
2236 | || BADCLASS(t) || ZERONET(t) | 2234 | || BADCLASS(s) || ZERONET(s) |
2237 | || LOCAL_MCAST(t)) { | 2235 | || LOCAL_MCAST(s)) { |
2238 | t = ((pktgen_random() % | 2236 | t = (pktgen_random() % |
2239 | (imx - imn)) + imn); | 2237 | (imx - imn)) + imn; |
2240 | t = htonl(t); | 2238 | s = htonl(t); |
2241 | } | 2239 | } |
2242 | pkt_dev->cur_daddr = t; | 2240 | pkt_dev->cur_daddr = s; |
2243 | } | 2241 | } else { |
2244 | |||
2245 | else { | ||
2246 | t = ntohl(pkt_dev->cur_daddr); | 2242 | t = ntohl(pkt_dev->cur_daddr); |
2247 | t++; | 2243 | t++; |
2248 | if (t > imx) { | 2244 | if (t > imx) { |
@@ -2270,7 +2266,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
2270 | 2266 | ||
2271 | for (i = 0; i < 4; i++) { | 2267 | for (i = 0; i < 4; i++) { |
2272 | pkt_dev->cur_in6_daddr.s6_addr32[i] = | 2268 | pkt_dev->cur_in6_daddr.s6_addr32[i] = |
2273 | ((pktgen_random() | | 2269 | (((__force __be32)pktgen_random() | |
2274 | pkt_dev->min_in6_daddr.s6_addr32[i]) & | 2270 | pkt_dev->min_in6_daddr.s6_addr32[i]) & |
2275 | pkt_dev->max_in6_daddr.s6_addr32[i]); | 2271 | pkt_dev->max_in6_daddr.s6_addr32[i]); |
2276 | } | 2272 | } |
@@ -2377,7 +2373,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2377 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); | 2373 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); |
2378 | 2374 | ||
2379 | memcpy(eth, pkt_dev->hh, 12); | 2375 | memcpy(eth, pkt_dev->hh, 12); |
2380 | *(u16 *) & eth[12] = protocol; | 2376 | *(__be16 *) & eth[12] = protocol; |
2381 | 2377 | ||
2382 | /* Eth + IPh + UDPh + mpls */ | 2378 | /* Eth + IPh + UDPh + mpls */ |
2383 | datalen = pkt_dev->cur_pkt_size - 14 - 20 - 8 - | 2379 | datalen = pkt_dev->cur_pkt_size - 14 - 20 - 8 - |
@@ -2497,7 +2493,7 @@ static unsigned int scan_ip6(const char *s, char ip[16]) | |||
2497 | char suffix[16]; | 2493 | char suffix[16]; |
2498 | unsigned int prefixlen = 0; | 2494 | unsigned int prefixlen = 0; |
2499 | unsigned int suffixlen = 0; | 2495 | unsigned int suffixlen = 0; |
2500 | __u32 tmp; | 2496 | __be32 tmp; |
2501 | 2497 | ||
2502 | for (i = 0; i < 16; i++) | 2498 | for (i = 0; i < 16; i++) |
2503 | ip[i] = 0; | 2499 | ip[i] = 0; |
@@ -2713,7 +2709,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2713 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); | 2709 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); |
2714 | 2710 | ||
2715 | memcpy(eth, pkt_dev->hh, 12); | 2711 | memcpy(eth, pkt_dev->hh, 12); |
2716 | *(u16 *) & eth[12] = protocol; | 2712 | *(__be16 *) & eth[12] = protocol; |
2717 | 2713 | ||
2718 | /* Eth + IPh + UDPh + mpls */ | 2714 | /* Eth + IPh + UDPh + mpls */ |
2719 | datalen = pkt_dev->cur_pkt_size - 14 - | 2715 | datalen = pkt_dev->cur_pkt_size - 14 - |
@@ -2732,11 +2728,11 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2732 | udph->len = htons(datalen + sizeof(struct udphdr)); | 2728 | udph->len = htons(datalen + sizeof(struct udphdr)); |
2733 | udph->check = 0; /* No checksum */ | 2729 | udph->check = 0; /* No checksum */ |
2734 | 2730 | ||
2735 | *(u32 *) iph = __constant_htonl(0x60000000); /* Version + flow */ | 2731 | *(__be32 *) iph = __constant_htonl(0x60000000); /* Version + flow */ |
2736 | 2732 | ||
2737 | if (pkt_dev->traffic_class) { | 2733 | if (pkt_dev->traffic_class) { |
2738 | /* Version + traffic class + flow (0) */ | 2734 | /* Version + traffic class + flow (0) */ |
2739 | *(u32 *)iph |= htonl(0x60000000 | (pkt_dev->traffic_class << 20)); | 2735 | *(__be32 *)iph |= htonl(0x60000000 | (pkt_dev->traffic_class << 20)); |
2740 | } | 2736 | } |
2741 | 2737 | ||
2742 | iph->hop_limit = 32; | 2738 | iph->hop_limit = 32; |