diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2003-05-15 09:28:08 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2003-05-15 09:28:08 -0700 |
| commit | 16daa7304e49fcb9462c15b1652bcd359b0d5156 (patch) | |
| tree | 8a27f3cee8f48e83f7a2a979a8b59586c68bf372 | |
| parent | 0ee2716378258ea8d3a4b5278e0f1a49d29547ca (diff) | |
[NET]: Hoplimit is a metric not a route attribute.
| -rw-r--r-- | include/linux/ipv6_route.h | 9 | ||||
| -rw-r--r-- | include/linux/rtnetlink.h | 7 | ||||
| -rw-r--r-- | include/net/dn_fib.h | 1 | ||||
| -rw-r--r-- | include/net/ip6_fib.h | 1 | ||||
| -rw-r--r-- | include/net/ip_fib.h | 1 | ||||
| -rw-r--r-- | net/ipv6/icmp.c | 4 | ||||
| -rw-r--r-- | net/ipv6/ip6_output.c | 4 | ||||
| -rw-r--r-- | net/ipv6/ndisc.c | 2 | ||||
| -rw-r--r-- | net/ipv6/raw.c | 2 | ||||
| -rw-r--r-- | net/ipv6/route.c | 23 | ||||
| -rw-r--r-- | net/ipv6/udp.c | 2 | ||||
| -rw-r--r-- | net/ipv6/xfrm6_policy.c | 1 |
12 files changed, 23 insertions, 34 deletions
diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h index a4861d0535af..eacfa6c80f0e 100644 --- a/include/linux/ipv6_route.h +++ b/include/linux/ipv6_route.h @@ -13,15 +13,6 @@ #ifndef _LINUX_IPV6_ROUTE_H #define _LINUX_IPV6_ROUTE_H -enum -{ - RTA_IPV6_UNSPEC, - RTA_IPV6_HOPLIMIT, -}; - -#define RTA_IPV6_MAX RTA_IPV6_HOPLIMIT - - #define RTF_DEFAULT 0x00010000 /* default - learned via ND */ #define RTF_ALLONLINK 0x00020000 /* fallback, no routers on link */ #define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 0466f6cdbd7f..1b0998fd604f 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -201,10 +201,9 @@ enum rtattr_type_t RTA_FLOW, RTA_CACHEINFO, RTA_SESSION, - RTA_HOPLIMIT, }; -#define RTA_MAX RTA_HOPLIMIT +#define RTA_MAX RTA_SESSION #define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) @@ -283,9 +282,11 @@ enum #define RTAX_ADVMSS RTAX_ADVMSS RTAX_REORDERING, #define RTAX_REORDERING RTAX_REORDERING + RTAX_HOPLIMIT, +#define RTAX_HOPLIMIT RTAX_HOPLIMIT }; -#define RTAX_MAX RTAX_REORDERING +#define RTAX_MAX RTAX_HOPLIMIT struct rta_session { diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index 322411b26c14..1396f2544118 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h @@ -19,7 +19,6 @@ struct dn_kern_rta u32 *rta_flow; struct rta_cacheinfo *rta_ci; struct rta_session *rta_sess; - u8 *rta_hoplimit; }; struct dn_fib_res { diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index d5c3dd447e25..b6927a2982b8 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -67,7 +67,6 @@ struct rt6_info u32 rt6i_flags; u32 rt6i_metric; - u8 rt6i_hoplimit; atomic_t rt6i_ref; struct rt6key rt6i_dst; diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index ff26dee6b42d..f14edafeabbd 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -38,7 +38,6 @@ struct kern_rta u32 *rta_flow; struct rta_cacheinfo *rta_ci; struct rta_session *rta_sess; - u8 *rta_hoplimit; }; struct fib_nh diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index c76ae27175ab..b00184b4574d 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -362,7 +362,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, else hlimit = np->hop_limit; if (hlimit < 0) - hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit; + hlimit = dst_metric(dst, RTAX_HOPLIMIT); } plen = skb->nh.raw - skb->data; @@ -443,7 +443,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb) else hlimit = np->hop_limit; if (hlimit < 0) - hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit; + hlimit = dst_metric(dst, RTAX_HOPLIMIT); } idev = in6_dev_get(skb->dev); diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index c52e57c5fbfc..104291e5a60b 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -249,7 +249,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, if (np) hlimit = np->hop_limit; if (hlimit < 0) - hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit; + hlimit = dst_metric(dst, RTAX_HOPLIMIT); hdr->payload_len = htons(seg_len); hdr->nexthdr = proto; @@ -609,7 +609,7 @@ int ip6_build_xmit(struct sock *sk, inet_getfrag_t getfrag, const void *data, else hlimit = np->hop_limit; if (hlimit < 0) - hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit; + hlimit = dst_metric(dst, RTAX_HOPLIMIT); } jumbolen = 0; diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 14969405f3c3..6e7a4ce74e4d 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -397,7 +397,7 @@ static inline void ndisc_rt_init(struct rt6_info *rt, struct net_device *dev, rt->rt6i_expires = 0; rt->rt6i_flags = RTF_LOCAL; rt->rt6i_metric = 0; - rt->rt6i_hoplimit = 255; + rt->u.dst.metrics[RTAX_HOPLIMIT-1] = 255; rt->u.dst.output = ndisc_output; } diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 700e3ab9da75..46ea3c341fd4 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -677,7 +677,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg else hlimit = np->hop_limit; if (hlimit < 0) - hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit; + hlimit = dst_metric(dst, RTAX_HOPLIMIT); } if (msg->msg_flags&MSG_CONFIRM) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 47323942fe99..b98862ce61a7 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -108,6 +108,7 @@ struct rt6_info ip6_null_entry = { .dev = &loopback_dev, .obsolete = -1, .error = -ENETUNREACH, + .metrics[RTAX_HOPLIMIT-1] = 255, .input = ip6_pkt_discard, .output = ip6_pkt_discard, .ops = &ip6_dst_ops, @@ -116,7 +117,6 @@ struct rt6_info ip6_null_entry = { }, .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), .rt6i_metric = ~(u32) 0, - .rt6i_hoplimit = 255, .rt6i_ref = ATOMIC_INIT(1), }; @@ -769,13 +769,6 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) } } - if (ipv6_addr_is_multicast(&rt->rt6i_dst.addr)) - rt->rt6i_hoplimit = IPV6_DEFAULT_MCASTHOPS; - else if (rta && rta[RTA_HOPLIMIT-1]) - memcpy(&rt->rt6i_hoplimit, RTA_DATA(rta[RTA_HOPLIMIT-1]), 1); - else - rt->rt6i_hoplimit = ipv6_get_hoplimit(dev); - rt->rt6i_flags = rtmsg->rtmsg_flags; install_route: @@ -796,6 +789,16 @@ install_route: attr = RTA_NEXT(attr, attrlen); } } + + if (rt->u.dst.metrics[RTAX_HOPLIMIT-1] == 0) { + if (ipv6_addr_is_multicast(&rt->rt6i_dst.addr)) + rt->u.dst.metrics[RTAX_HOPLIMIT-1] = + IPV6_DEFAULT_MCASTHOPS; + else + rt->u.dst.metrics[RTAX_HOPLIMIT-1] = + ipv6_get_hoplimit(dev); + } + if (!rt->u.dst.metrics[RTAX_MTU-1]) rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev); if (!rt->u.dst.metrics[RTAX_ADVMSS-1]) @@ -964,7 +967,6 @@ source_ok: nrt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, dst_pmtu(&nrt->u.dst) - 60, ip6_rt_min_advmss); if (nrt->u.dst.metrics[RTAX_ADVMSS-1] > 65535-20) nrt->u.dst.metrics[RTAX_ADVMSS-1] = 65535; - nrt->rt6i_hoplimit = ipv6_get_hoplimit(neigh->dev); if (rt6_ins(nrt, NULL, NULL)) goto out; @@ -1080,7 +1082,6 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) if (rt->u.dst.dev) dev_hold(rt->u.dst.dev); rt->u.dst.lastuse = jiffies; - rt->rt6i_hoplimit = ort->rt6i_hoplimit; rt->rt6i_expires = 0; ipv6_addr_copy(&rt->rt6i_gateway, &ort->rt6i_gateway); @@ -1226,7 +1227,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev) rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, dst_pmtu(&rt->u.dst) - 60, ip6_rt_min_advmss); if (rt->u.dst.metrics[RTAX_ADVMSS-1] > 65535-20) rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535; - rt->rt6i_hoplimit = ipv6_get_hoplimit(rt->rt6i_dev); + rt->u.dst.metrics[RTAX_HOPLIMIT-1] = ipv6_get_hoplimit(rt->rt6i_dev); rt->u.dst.obsolete = -1; rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 001d1eb49eeb..af2585be7724 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -968,7 +968,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg else hlimit = np->hop_limit; if (hlimit < 0) - hlimit = ((struct rt6_info*)dst)->rt6i_hoplimit; + hlimit = dst_metric(dst, RTAX_HOPLIMIT); } if (msg->msg_flags&MSG_CONFIRM) diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index ae8d8b7778aa..e0581717c697 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c @@ -153,7 +153,6 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL); x->u.rt6.rt6i_metric = rt0->rt6i_metric; x->u.rt6.rt6i_node = rt0->rt6i_node; - x->u.rt6.rt6i_hoplimit = rt0->rt6i_hoplimit; x->u.rt6.rt6i_gateway = rt0->rt6i_gateway; memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway)); header_len -= x->u.dst.xfrm->props.header_len; |
