aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ipv4.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-21 01:47:35 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:10 -0400
commiteddc9ec53be2ecdbf4efe0efd4a83052594f0ac0 (patch)
tree4a38ab4dbd9d61fdf5a5ea6ed61463e0b9e33ba7 /net/dccp/ipv4.c
parente023dd643798c4f06c16466af90b4d250e4b8bd7 (diff)
[SK_BUFF]: Introduce ip_hdr(), remove skb->nh.iph
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r--net/dccp/ipv4.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 4a83978aa660..b85437dae0e7 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -363,8 +363,8 @@ EXPORT_SYMBOL_GPL(dccp_v4_send_check);
363 363
364static inline u64 dccp_v4_init_sequence(const struct sk_buff *skb) 364static inline u64 dccp_v4_init_sequence(const struct sk_buff *skb)
365{ 365{
366 return secure_dccp_sequence_number(skb->nh.iph->daddr, 366 return secure_dccp_sequence_number(ip_hdr(skb)->daddr,
367 skb->nh.iph->saddr, 367 ip_hdr(skb)->saddr,
368 dccp_hdr(skb)->dccph_dport, 368 dccp_hdr(skb)->dccph_dport,
369 dccp_hdr(skb)->dccph_sport); 369 dccp_hdr(skb)->dccph_sport);
370} 370}
@@ -405,7 +405,7 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
405 newinet->opt = ireq->opt; 405 newinet->opt = ireq->opt;
406 ireq->opt = NULL; 406 ireq->opt = NULL;
407 newinet->mc_index = inet_iif(skb); 407 newinet->mc_index = inet_iif(skb);
408 newinet->mc_ttl = skb->nh.iph->ttl; 408 newinet->mc_ttl = ip_hdr(skb)->ttl;
409 newinet->id = jiffies; 409 newinet->id = jiffies;
410 410
411 dccp_sync_mss(newsk, dst_mtu(dst)); 411 dccp_sync_mss(newsk, dst_mtu(dst));
@@ -428,7 +428,7 @@ EXPORT_SYMBOL_GPL(dccp_v4_request_recv_sock);
428static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) 428static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
429{ 429{
430 const struct dccp_hdr *dh = dccp_hdr(skb); 430 const struct dccp_hdr *dh = dccp_hdr(skb);
431 const struct iphdr *iph = skb->nh.iph; 431 const struct iphdr *iph = ip_hdr(skb);
432 struct sock *nsk; 432 struct sock *nsk;
433 struct request_sock **prev; 433 struct request_sock **prev;
434 /* Find possible connection requests. */ 434 /* Find possible connection requests. */
@@ -460,8 +460,8 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
460 struct rtable *rt; 460 struct rtable *rt;
461 struct flowi fl = { .oif = ((struct rtable *)skb->dst)->rt_iif, 461 struct flowi fl = { .oif = ((struct rtable *)skb->dst)->rt_iif,
462 .nl_u = { .ip4_u = 462 .nl_u = { .ip4_u =
463 { .daddr = skb->nh.iph->saddr, 463 { .daddr = ip_hdr(skb)->saddr,
464 .saddr = skb->nh.iph->daddr, 464 .saddr = ip_hdr(skb)->daddr,
465 .tos = RT_CONN_FLAGS(sk) } }, 465 .tos = RT_CONN_FLAGS(sk) } },
466 .proto = sk->sk_protocol, 466 .proto = sk->sk_protocol,
467 .uli_u = { .ports = 467 .uli_u = { .ports =
@@ -513,6 +513,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
513{ 513{
514 int err; 514 int err;
515 struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh; 515 struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh;
516 const struct iphdr *rxiph;
516 const int dccp_hdr_reset_len = sizeof(struct dccp_hdr) + 517 const int dccp_hdr_reset_len = sizeof(struct dccp_hdr) +
517 sizeof(struct dccp_hdr_ext) + 518 sizeof(struct dccp_hdr_ext) +
518 sizeof(struct dccp_hdr_reset); 519 sizeof(struct dccp_hdr_reset);
@@ -559,13 +560,13 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
559 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq); 560 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq);
560 561
561 dccp_csum_outgoing(skb); 562 dccp_csum_outgoing(skb);
562 dh->dccph_checksum = dccp_v4_csum_finish(skb, rxskb->nh.iph->saddr, 563 rxiph = ip_hdr(rxskb);
563 rxskb->nh.iph->daddr); 564 dh->dccph_checksum = dccp_v4_csum_finish(skb, rxiph->saddr,
565 rxiph->daddr);
564 566
565 bh_lock_sock(dccp_v4_ctl_socket->sk); 567 bh_lock_sock(dccp_v4_ctl_socket->sk);
566 err = ip_build_and_send_pkt(skb, dccp_v4_ctl_socket->sk, 568 err = ip_build_and_send_pkt(skb, dccp_v4_ctl_socket->sk,
567 rxskb->nh.iph->daddr, 569 rxiph->daddr, rxiph->saddr, NULL);
568 rxskb->nh.iph->saddr, NULL);
569 bh_unlock_sock(dccp_v4_ctl_socket->sk); 570 bh_unlock_sock(dccp_v4_ctl_socket->sk);
570 571
571 if (net_xmit_eval(err) == 0) { 572 if (net_xmit_eval(err) == 0) {
@@ -640,8 +641,8 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
640 goto drop_and_free; 641 goto drop_and_free;
641 642
642 ireq = inet_rsk(req); 643 ireq = inet_rsk(req);
643 ireq->loc_addr = skb->nh.iph->daddr; 644 ireq->loc_addr = ip_hdr(skb)->daddr;
644 ireq->rmt_addr = skb->nh.iph->saddr; 645 ireq->rmt_addr = ip_hdr(skb)->saddr;
645 ireq->opt = NULL; 646 ireq->opt = NULL;
646 647
647 /* 648 /*
@@ -809,6 +810,7 @@ EXPORT_SYMBOL_GPL(dccp_invalid_packet);
809static int dccp_v4_rcv(struct sk_buff *skb) 810static int dccp_v4_rcv(struct sk_buff *skb)
810{ 811{
811 const struct dccp_hdr *dh; 812 const struct dccp_hdr *dh;
813 const struct iphdr *iph;
812 struct sock *sk; 814 struct sock *sk;
813 int min_cov; 815 int min_cov;
814 816
@@ -817,8 +819,9 @@ static int dccp_v4_rcv(struct sk_buff *skb)
817 if (dccp_invalid_packet(skb)) 819 if (dccp_invalid_packet(skb))
818 goto discard_it; 820 goto discard_it;
819 821
822 iph = ip_hdr(skb);
820 /* Step 1: If header checksum is incorrect, drop packet and return */ 823 /* Step 1: If header checksum is incorrect, drop packet and return */
821 if (dccp_v4_csum_finish(skb, skb->nh.iph->saddr, skb->nh.iph->daddr)) { 824 if (dccp_v4_csum_finish(skb, iph->saddr, iph->daddr)) {
822 DCCP_WARN("dropped packet with invalid checksum\n"); 825 DCCP_WARN("dropped packet with invalid checksum\n");
823 goto discard_it; 826 goto discard_it;
824 } 827 }
@@ -832,8 +835,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
832 "src=%u.%u.%u.%u@%-5d " 835 "src=%u.%u.%u.%u@%-5d "
833 "dst=%u.%u.%u.%u@%-5d seq=%llu", 836 "dst=%u.%u.%u.%u@%-5d seq=%llu",
834 dccp_packet_name(dh->dccph_type), 837 dccp_packet_name(dh->dccph_type),
835 NIPQUAD(skb->nh.iph->saddr), ntohs(dh->dccph_sport), 838 NIPQUAD(iph->saddr), ntohs(dh->dccph_sport),
836 NIPQUAD(skb->nh.iph->daddr), ntohs(dh->dccph_dport), 839 NIPQUAD(iph->daddr), ntohs(dh->dccph_dport),
837 (unsigned long long) DCCP_SKB_CB(skb)->dccpd_seq); 840 (unsigned long long) DCCP_SKB_CB(skb)->dccpd_seq);
838 841
839 if (dccp_packet_without_ack(skb)) { 842 if (dccp_packet_without_ack(skb)) {
@@ -848,10 +851,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
848 /* Step 2: 851 /* Step 2:
849 * Look up flow ID in table and get corresponding socket */ 852 * Look up flow ID in table and get corresponding socket */
850 sk = __inet_lookup(&dccp_hashinfo, 853 sk = __inet_lookup(&dccp_hashinfo,
851 skb->nh.iph->saddr, dh->dccph_sport, 854 iph->saddr, dh->dccph_sport,
852 skb->nh.iph->daddr, dh->dccph_dport, 855 iph->daddr, dh->dccph_dport, inet_iif(skb));
853 inet_iif(skb));
854
855 /* 856 /*
856 * Step 2: 857 * Step 2:
857 * If no socket ... 858 * If no socket ...