X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fipv6%2Froute.c;h=2017c69dc9f3b0a6a07b345d99ad31ce0c2e9641;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=541f2434b234feba91222e5fcacf13eb1a317bd6;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 541f2434b..2017c69dc 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -584,7 +584,24 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu) /* Protected by rt6_lock. */ static struct dst_entry *ndisc_dst_gc_list; static int ipv6_get_mtu(struct net_device *dev); -static inline unsigned int ipv6_advmss(unsigned int mtu); + +static inline unsigned int ipv6_advmss(unsigned int mtu) +{ + mtu -= sizeof(struct ipv6hdr) + sizeof(struct tcphdr); + + if (mtu < ip6_rt_min_advmss) + mtu = ip6_rt_min_advmss; + + /* + * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and + * corresponding MSS is IPV6_MAXPLEN - tcp_header_size. + * IPV6_MAXPLEN is also valid and means: "any MSS, + * rely only on pmtu discovery" + */ + if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr)) + mtu = IPV6_MAXPLEN; + return mtu; +} struct dst_entry *ndisc_dst_alloc(struct net_device *dev, struct neighbour *neigh, @@ -605,15 +622,20 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev, rt->rt6i_dev = dev; rt->rt6i_idev = in6_dev_get(dev); rt->rt6i_nexthop = neigh; - rt->rt6i_expires = 0; - rt->rt6i_flags = RTF_LOCAL; - rt->rt6i_metric = 0; atomic_set(&rt->u.dst.__refcnt, 1); rt->u.dst.metrics[RTAX_HOPLIMIT-1] = 255; rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev); rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst)); rt->u.dst.output = output; +#if 0 /* there's no chance to use these for ndisc */ + rt->u.dst.flags = ipv6_addr_type(addr) & IPV6_ADDR_UNICAST + ? DST_HOST + : 0; + ipv6_addr_copy(&rt->rt6i_dst.addr, addr); + rt->rt6i_dst.plen = 128; +#endif + write_lock_bh(&rt6_lock); rt->u.dst.next = ndisc_dst_gc_list; ndisc_dst_gc_list = &rt->u.dst; @@ -687,24 +709,6 @@ static int ipv6_get_mtu(struct net_device *dev) return mtu; } -static inline unsigned int ipv6_advmss(unsigned int mtu) -{ - mtu -= sizeof(struct ipv6hdr) + sizeof(struct tcphdr); - - if (mtu < ip6_rt_min_advmss) - mtu = ip6_rt_min_advmss; - - /* - * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and - * corresponding MSS is IPV6_MAXPLEN - tcp_header_size. - * IPV6_MAXPLEN is also valid and means: "any MSS, - * rely only on pmtu discovery" - */ - if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr)) - mtu = IPV6_MAXPLEN; - return mtu; -} - static int ipv6_get_hoplimit(struct net_device *dev) { int hoplimit = ipv6_devconf.hop_limit; @@ -1287,7 +1291,7 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg) int ip6_pkt_discard(struct sk_buff *skb) { - IP6_INC_STATS(OutNoRoutes); + IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES); icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev); kfree_skb(skb); return 0; @@ -1920,10 +1924,10 @@ static int flush_delay; static int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp, - void __user *buffer, size_t *lenp) + void __user *buffer, size_t *lenp, loff_t *ppos) { if (write) { - proc_dointvec(ctl, write, filp, buffer, lenp); + proc_dointvec(ctl, write, filp, buffer, lenp, ppos); if (flush_delay < 0) flush_delay = 0; fib6_run_gc((unsigned long)flush_delay);