diff options
author | David S. Miller <davem@davemloft.net> | 2011-05-08 20:24:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-09 00:24:07 -0400 |
commit | f5fca6086511294653a9e821f8e22f041415ba7b (patch) | |
tree | 1ab025012bf44402e7f816428461d8def54016c1 /net/ipv4/ip_output.c | |
parent | 77968b78242ee25e2a4d759f0fca8dd52df6d479 (diff) |
ipv4: Pass flow key down into ip_append_*().
This way rt->rt_dst accesses are unnecessary.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index dca637b9d8ae..cd89d22902a9 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -776,7 +776,9 @@ static inline int ip_ufo_append_data(struct sock *sk, | |||
776 | (length - transhdrlen)); | 776 | (length - transhdrlen)); |
777 | } | 777 | } |
778 | 778 | ||
779 | static int __ip_append_data(struct sock *sk, struct sk_buff_head *queue, | 779 | static int __ip_append_data(struct sock *sk, |
780 | struct flowi4 *fl4, | ||
781 | struct sk_buff_head *queue, | ||
780 | struct inet_cork *cork, | 782 | struct inet_cork *cork, |
781 | int getfrag(void *from, char *to, int offset, | 783 | int getfrag(void *from, char *to, int offset, |
782 | int len, int odd, struct sk_buff *skb), | 784 | int len, int odd, struct sk_buff *skb), |
@@ -808,7 +810,7 @@ static int __ip_append_data(struct sock *sk, struct sk_buff_head *queue, | |||
808 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; | 810 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; |
809 | 811 | ||
810 | if (cork->length + length > 0xFFFF - fragheaderlen) { | 812 | if (cork->length + length > 0xFFFF - fragheaderlen) { |
811 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport, | 813 | ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport, |
812 | mtu-exthdrlen); | 814 | mtu-exthdrlen); |
813 | return -EMSGSIZE; | 815 | return -EMSGSIZE; |
814 | } | 816 | } |
@@ -1083,7 +1085,7 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, | |||
1083 | * | 1085 | * |
1084 | * LATER: length must be adjusted by pad at tail, when it is required. | 1086 | * LATER: length must be adjusted by pad at tail, when it is required. |
1085 | */ | 1087 | */ |
1086 | int ip_append_data(struct sock *sk, | 1088 | int ip_append_data(struct sock *sk, struct flowi4 *fl4, |
1087 | int getfrag(void *from, char *to, int offset, int len, | 1089 | int getfrag(void *from, char *to, int offset, int len, |
1088 | int odd, struct sk_buff *skb), | 1090 | int odd, struct sk_buff *skb), |
1089 | void *from, int length, int transhdrlen, | 1091 | void *from, int length, int transhdrlen, |
@@ -1104,11 +1106,11 @@ int ip_append_data(struct sock *sk, | |||
1104 | transhdrlen = 0; | 1106 | transhdrlen = 0; |
1105 | } | 1107 | } |
1106 | 1108 | ||
1107 | return __ip_append_data(sk, &sk->sk_write_queue, &inet->cork.base, getfrag, | 1109 | return __ip_append_data(sk, fl4, &sk->sk_write_queue, &inet->cork.base, getfrag, |
1108 | from, length, transhdrlen, flags); | 1110 | from, length, transhdrlen, flags); |
1109 | } | 1111 | } |
1110 | 1112 | ||
1111 | ssize_t ip_append_page(struct sock *sk, struct page *page, | 1113 | ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, |
1112 | int offset, size_t size, int flags) | 1114 | int offset, size_t size, int flags) |
1113 | { | 1115 | { |
1114 | struct inet_sock *inet = inet_sk(sk); | 1116 | struct inet_sock *inet = inet_sk(sk); |
@@ -1146,7 +1148,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1146 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; | 1148 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; |
1147 | 1149 | ||
1148 | if (cork->length + size > 0xFFFF - fragheaderlen) { | 1150 | if (cork->length + size > 0xFFFF - fragheaderlen) { |
1149 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport, mtu); | 1151 | ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport, mtu); |
1150 | return -EMSGSIZE; | 1152 | return -EMSGSIZE; |
1151 | } | 1153 | } |
1152 | 1154 | ||
@@ -1427,7 +1429,7 @@ struct sk_buff *ip_make_skb(struct sock *sk, | |||
1427 | if (err) | 1429 | if (err) |
1428 | return ERR_PTR(err); | 1430 | return ERR_PTR(err); |
1429 | 1431 | ||
1430 | err = __ip_append_data(sk, &queue, &cork, getfrag, | 1432 | err = __ip_append_data(sk, fl4, &queue, &cork, getfrag, |
1431 | from, length, transhdrlen, flags); | 1433 | from, length, transhdrlen, flags); |
1432 | if (err) { | 1434 | if (err) { |
1433 | __ip_flush_pending_frames(sk, &queue, &cork); | 1435 | __ip_flush_pending_frames(sk, &queue, &cork); |
@@ -1503,7 +1505,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
1503 | sk->sk_priority = skb->priority; | 1505 | sk->sk_priority = skb->priority; |
1504 | sk->sk_protocol = ip_hdr(skb)->protocol; | 1506 | sk->sk_protocol = ip_hdr(skb)->protocol; |
1505 | sk->sk_bound_dev_if = arg->bound_dev_if; | 1507 | sk->sk_bound_dev_if = arg->bound_dev_if; |
1506 | ip_append_data(sk, ip_reply_glue_bits, arg->iov->iov_base, len, 0, | 1508 | ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base, len, 0, |
1507 | &ipc, &rt, MSG_DONTWAIT); | 1509 | &ipc, &rt, MSG_DONTWAIT); |
1508 | if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) { | 1510 | if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) { |
1509 | if (arg->csumoffset >= 0) | 1511 | if (arg->csumoffset >= 0) |