ip6mr.c (9c1852b459f04f6309e40d1d167512b0a5598529) ip6mr.c (fd61c6ba313de6758aeeab58fe03bd9fbbc8cea9)
1/*
2 * Linux IPv6 multicast routing support for BSD pim6sd
3 * Based on net/ipv4/ipmr.c.
4 *
5 * (c) 2004 Mickael Hoerdt, <hoerdt@clarinet.u-strasbg.fr>
6 * LSIIT Laboratory, Strasbourg, France
7 * (c) 2004 Jean-Philippe Andriot, <jean-philippe.andriot@6WIND.com>
8 * 6WIND, Paris, France

--- 2229 unchanged lines hidden (view full) ---

2238{
2239 struct rta_mfc_stats mfcs;
2240 struct nlattr *mp_attr;
2241 struct rtnexthop *nhp;
2242 unsigned long lastuse;
2243 int ct;
2244
2245 /* If cache is unresolved, don't try to parse IIF and OIF */
1/*
2 * Linux IPv6 multicast routing support for BSD pim6sd
3 * Based on net/ipv4/ipmr.c.
4 *
5 * (c) 2004 Mickael Hoerdt, <hoerdt@clarinet.u-strasbg.fr>
6 * LSIIT Laboratory, Strasbourg, France
7 * (c) 2004 Jean-Philippe Andriot, <jean-philippe.andriot@6WIND.com>
8 * 6WIND, Paris, France

--- 2229 unchanged lines hidden (view full) ---

2238{
2239 struct rta_mfc_stats mfcs;
2240 struct nlattr *mp_attr;
2241 struct rtnexthop *nhp;
2242 unsigned long lastuse;
2243 int ct;
2244
2245 /* If cache is unresolved, don't try to parse IIF and OIF */
2246 if (c->mf6c_parent >= MAXMIFS)
2246 if (c->mf6c_parent >= MAXMIFS) {
2247 rtm->rtm_flags |= RTNH_F_UNRESOLVED;
2247 return -ENOENT;
2248 return -ENOENT;
2249 }
2248
2249 if (MIF_EXISTS(mrt, c->mf6c_parent) &&
2250 nla_put_u32(skb, RTA_IIF, mrt->vif6_table[c->mf6c_parent].dev->ifindex) < 0)
2251 return -EMSGSIZE;
2252 mp_attr = nla_nest_start(skb, RTA_MULTIPATH);
2253 if (!mp_attr)
2254 return -EMSGSIZE;
2255

--- 25 unchanged lines hidden (view full) ---

2281 RTA_PAD))
2282 return -EMSGSIZE;
2283
2284 rtm->rtm_type = RTN_MULTICAST;
2285 return 1;
2286}
2287
2288int ip6mr_get_route(struct net *net, struct sk_buff *skb, struct rtmsg *rtm,
2250
2251 if (MIF_EXISTS(mrt, c->mf6c_parent) &&
2252 nla_put_u32(skb, RTA_IIF, mrt->vif6_table[c->mf6c_parent].dev->ifindex) < 0)
2253 return -EMSGSIZE;
2254 mp_attr = nla_nest_start(skb, RTA_MULTIPATH);
2255 if (!mp_attr)
2256 return -EMSGSIZE;
2257

--- 25 unchanged lines hidden (view full) ---

2283 RTA_PAD))
2284 return -EMSGSIZE;
2285
2286 rtm->rtm_type = RTN_MULTICAST;
2287 return 1;
2288}
2289
2290int ip6mr_get_route(struct net *net, struct sk_buff *skb, struct rtmsg *rtm,
2289 int nowait, u32 portid)
2291 u32 portid)
2290{
2291 int err;
2292 struct mr6_table *mrt;
2293 struct mfc6_cache *cache;
2294 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
2295
2296 mrt = ip6mr_get_table(net, RT6_TABLE_DFLT);
2297 if (!mrt)

--- 10 unchanged lines hidden (view full) ---

2308 }
2309
2310 if (!cache) {
2311 struct sk_buff *skb2;
2312 struct ipv6hdr *iph;
2313 struct net_device *dev;
2314 int vif;
2315
2292{
2293 int err;
2294 struct mr6_table *mrt;
2295 struct mfc6_cache *cache;
2296 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
2297
2298 mrt = ip6mr_get_table(net, RT6_TABLE_DFLT);
2299 if (!mrt)

--- 10 unchanged lines hidden (view full) ---

2310 }
2311
2312 if (!cache) {
2313 struct sk_buff *skb2;
2314 struct ipv6hdr *iph;
2315 struct net_device *dev;
2316 int vif;
2317
2316 if (nowait) {
2317 read_unlock(&mrt_lock);
2318 return -EAGAIN;
2319 }
2320
2321 dev = skb->dev;
2322 if (!dev || (vif = ip6mr_find_vif(mrt, dev)) < 0) {
2323 read_unlock(&mrt_lock);
2324 return -ENODEV;
2325 }
2326
2327 /* really correct? */
2328 skb2 = alloc_skb(sizeof(struct ipv6hdr), GFP_ATOMIC);

--- 21 unchanged lines hidden (view full) ---

2350 iph->daddr = rt->rt6i_dst.addr;
2351
2352 err = ip6mr_cache_unresolved(mrt, vif, skb2);
2353 read_unlock(&mrt_lock);
2354
2355 return err;
2356 }
2357
2318 dev = skb->dev;
2319 if (!dev || (vif = ip6mr_find_vif(mrt, dev)) < 0) {
2320 read_unlock(&mrt_lock);
2321 return -ENODEV;
2322 }
2323
2324 /* really correct? */
2325 skb2 = alloc_skb(sizeof(struct ipv6hdr), GFP_ATOMIC);

--- 21 unchanged lines hidden (view full) ---

2347 iph->daddr = rt->rt6i_dst.addr;
2348
2349 err = ip6mr_cache_unresolved(mrt, vif, skb2);
2350 read_unlock(&mrt_lock);
2351
2352 return err;
2353 }
2354
2358 if (!nowait && (rtm->rtm_flags&RTM_F_NOTIFY))
2355 if (rtm->rtm_flags & RTM_F_NOTIFY)
2359 cache->mfc_flags |= MFC_NOTIFY;
2360
2361 err = __ip6mr_fill_mroute(mrt, skb, cache, rtm);
2362 read_unlock(&mrt_lock);
2363 return err;
2364}
2365
2366static int ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb,

--- 153 unchanged lines hidden ---
2356 cache->mfc_flags |= MFC_NOTIFY;
2357
2358 err = __ip6mr_fill_mroute(mrt, skb, cache, rtm);
2359 read_unlock(&mrt_lock);
2360 return err;
2361}
2362
2363static int ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb,

--- 153 unchanged lines hidden ---