diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-10 04:30:37 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-24 21:23:59 -0400 |
commit | c8cdaf998df221b01134a051aba38c570105061b (patch) | |
tree | 1335a3a0b377621f1c38adbdade34abd6b621c94 | |
parent | a9b05723ffa2e427b0257b81ea74363fcd7c304f (diff) |
[IPV4,IPV6]: Share cork.rt between IPv4 and IPv6.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
-rw-r--r-- | include/linux/ipv6.h | 1 | ||||
-rw-r--r-- | include/net/inet_sock.h | 2 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 14 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 12 |
4 files changed, 13 insertions, 16 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 4aaefc349a4b..2102d8b67c01 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -315,7 +315,6 @@ struct ipv6_pinfo { | |||
315 | struct sk_buff *pktoptions; | 315 | struct sk_buff *pktoptions; |
316 | struct { | 316 | struct { |
317 | struct ipv6_txoptions *opt; | 317 | struct ipv6_txoptions *opt; |
318 | struct rt6_info *rt; | ||
319 | int hop_limit; | 318 | int hop_limit; |
320 | int tclass; | 319 | int tclass; |
321 | } cork; | 320 | } cork; |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index b6db16d2766a..a42cd63d241a 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -136,7 +136,7 @@ struct inet_sock { | |||
136 | unsigned int flags; | 136 | unsigned int flags; |
137 | unsigned int fragsize; | 137 | unsigned int fragsize; |
138 | struct ip_options *opt; | 138 | struct ip_options *opt; |
139 | struct rtable *rt; | 139 | struct dst_entry *dst; |
140 | int length; /* Total length of all frames */ | 140 | int length; /* Total length of all frames */ |
141 | __be32 addr; | 141 | __be32 addr; |
142 | struct flowi fl; | 142 | struct flowi fl; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 349fae58c1a3..913266cd9902 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -825,7 +825,7 @@ int ip_append_data(struct sock *sk, | |||
825 | inet->cork.fragsize = mtu = inet->pmtudisc == IP_PMTUDISC_PROBE ? | 825 | inet->cork.fragsize = mtu = inet->pmtudisc == IP_PMTUDISC_PROBE ? |
826 | rt->u.dst.dev->mtu : | 826 | rt->u.dst.dev->mtu : |
827 | dst_mtu(rt->u.dst.path); | 827 | dst_mtu(rt->u.dst.path); |
828 | inet->cork.rt = rt; | 828 | inet->cork.dst = &rt->u.dst; |
829 | inet->cork.length = 0; | 829 | inet->cork.length = 0; |
830 | sk->sk_sndmsg_page = NULL; | 830 | sk->sk_sndmsg_page = NULL; |
831 | sk->sk_sndmsg_off = 0; | 831 | sk->sk_sndmsg_off = 0; |
@@ -834,7 +834,7 @@ int ip_append_data(struct sock *sk, | |||
834 | transhdrlen += exthdrlen; | 834 | transhdrlen += exthdrlen; |
835 | } | 835 | } |
836 | } else { | 836 | } else { |
837 | rt = inet->cork.rt; | 837 | rt = (struct rtable *)inet->cork.dst; |
838 | if (inet->cork.flags & IPCORK_OPT) | 838 | if (inet->cork.flags & IPCORK_OPT) |
839 | opt = inet->cork.opt; | 839 | opt = inet->cork.opt; |
840 | 840 | ||
@@ -1083,7 +1083,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1083 | if (skb_queue_empty(&sk->sk_write_queue)) | 1083 | if (skb_queue_empty(&sk->sk_write_queue)) |
1084 | return -EINVAL; | 1084 | return -EINVAL; |
1085 | 1085 | ||
1086 | rt = inet->cork.rt; | 1086 | rt = (struct rtable *)inet->cork.dst; |
1087 | if (inet->cork.flags & IPCORK_OPT) | 1087 | if (inet->cork.flags & IPCORK_OPT) |
1088 | opt = inet->cork.opt; | 1088 | opt = inet->cork.opt; |
1089 | 1089 | ||
@@ -1208,10 +1208,8 @@ static void ip_cork_release(struct inet_sock *inet) | |||
1208 | inet->cork.flags &= ~IPCORK_OPT; | 1208 | inet->cork.flags &= ~IPCORK_OPT; |
1209 | kfree(inet->cork.opt); | 1209 | kfree(inet->cork.opt); |
1210 | inet->cork.opt = NULL; | 1210 | inet->cork.opt = NULL; |
1211 | if (inet->cork.rt) { | 1211 | dst_release(inet->cork.dst); |
1212 | ip_rt_put(inet->cork.rt); | 1212 | inet->cork.dst = NULL; |
1213 | inet->cork.rt = NULL; | ||
1214 | } | ||
1215 | } | 1213 | } |
1216 | 1214 | ||
1217 | /* | 1215 | /* |
@@ -1224,7 +1222,7 @@ int ip_push_pending_frames(struct sock *sk) | |||
1224 | struct sk_buff **tail_skb; | 1222 | struct sk_buff **tail_skb; |
1225 | struct inet_sock *inet = inet_sk(sk); | 1223 | struct inet_sock *inet = inet_sk(sk); |
1226 | struct ip_options *opt = NULL; | 1224 | struct ip_options *opt = NULL; |
1227 | struct rtable *rt = inet->cork.rt; | 1225 | struct rtable *rt = (struct rtable *)inet->cork.dst; |
1228 | struct iphdr *iph; | 1226 | struct iphdr *iph; |
1229 | __be16 df = 0; | 1227 | __be16 df = 0; |
1230 | __u8 ttl; | 1228 | __u8 ttl; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 98762fde2b65..ed6482667a25 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1115,7 +1115,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1115 | /* need source address above miyazawa*/ | 1115 | /* need source address above miyazawa*/ |
1116 | } | 1116 | } |
1117 | dst_hold(&rt->u.dst); | 1117 | dst_hold(&rt->u.dst); |
1118 | np->cork.rt = rt; | 1118 | inet->cork.dst = &rt->u.dst; |
1119 | inet->cork.fl = *fl; | 1119 | inet->cork.fl = *fl; |
1120 | np->cork.hop_limit = hlimit; | 1120 | np->cork.hop_limit = hlimit; |
1121 | np->cork.tclass = tclass; | 1121 | np->cork.tclass = tclass; |
@@ -1136,7 +1136,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1136 | length += exthdrlen; | 1136 | length += exthdrlen; |
1137 | transhdrlen += exthdrlen; | 1137 | transhdrlen += exthdrlen; |
1138 | } else { | 1138 | } else { |
1139 | rt = np->cork.rt; | 1139 | rt = (struct rt6_info *)inet->cork.dst; |
1140 | fl = &inet->cork.fl; | 1140 | fl = &inet->cork.fl; |
1141 | if (inet->cork.flags & IPCORK_OPT) | 1141 | if (inet->cork.flags & IPCORK_OPT) |
1142 | opt = np->cork.opt; | 1142 | opt = np->cork.opt; |
@@ -1381,9 +1381,9 @@ static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np) | |||
1381 | inet->cork.flags &= ~IPCORK_OPT; | 1381 | inet->cork.flags &= ~IPCORK_OPT; |
1382 | kfree(np->cork.opt); | 1382 | kfree(np->cork.opt); |
1383 | np->cork.opt = NULL; | 1383 | np->cork.opt = NULL; |
1384 | if (np->cork.rt) { | 1384 | if (inet->cork.dst) { |
1385 | dst_release(&np->cork.rt->u.dst); | 1385 | dst_release(inet->cork.dst); |
1386 | np->cork.rt = NULL; | 1386 | inet->cork.dst = NULL; |
1387 | inet->cork.flags &= ~IPCORK_ALLFRAG; | 1387 | inet->cork.flags &= ~IPCORK_ALLFRAG; |
1388 | } | 1388 | } |
1389 | memset(&inet->cork.fl, 0, sizeof(inet->cork.fl)); | 1389 | memset(&inet->cork.fl, 0, sizeof(inet->cork.fl)); |
@@ -1398,7 +1398,7 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1398 | struct ipv6_pinfo *np = inet6_sk(sk); | 1398 | struct ipv6_pinfo *np = inet6_sk(sk); |
1399 | struct ipv6hdr *hdr; | 1399 | struct ipv6hdr *hdr; |
1400 | struct ipv6_txoptions *opt = np->cork.opt; | 1400 | struct ipv6_txoptions *opt = np->cork.opt; |
1401 | struct rt6_info *rt = np->cork.rt; | 1401 | struct rt6_info *rt = (struct rt6_info *)inet->cork.dst; |
1402 | struct flowi *fl = &inet->cork.fl; | 1402 | struct flowi *fl = &inet->cork.fl; |
1403 | unsigned char proto = fl->proto; | 1403 | unsigned char proto = fl->proto; |
1404 | int err = 0; | 1404 | int err = 0; |