static struct mfc_cache *ipmr_cache_find2(struct net *net, __be32 origin, __be32 mcastgrp, struct net_device *pstDev) { int mr_ifindex = -1; int line = MFC_HASH(mcastgrp, origin); struct mfc_cache *c = NULL; if (!pstDev) { return NULL; } mr_ifindex = ipmr_find_vif(pstDev); for (c = net->ipv4.mfc_cache_array[line]; c; c = c->next) { if (c->mfc_origin==origin && c->mfc_mcastgrp==mcastgrp && mr_ifindex == c->mfc_parent) break; } if (NULL == c) { line = MFC_HASH(mcastgrp, htonl(0x00000000)); for (c = net->ipv4.mfc_cache_array[line]; c; c = c->next) { if (c->mfc_mcastgrp == mcastgrp && mr_ifindex == c->mfc_parent) break; } } return c; }
static struct mfc_cache *ipmr_cache_find(struct net *net, __be32 origin, __be32 mcastgrp, unsigned int ifindex) { int line = MFC_HASH(mcastgrp, origin); struct mfc_cache *c; for (c = net->ipv4.mfc_cache_array[line]; c; c = c->next) { if ((c->mfc_origin == origin) && (c->mfc_mcastgrp == mcastgrp) && (c->mfc_parent == ifindex)) break; } /* for ASM multicast source does not matter so need to check for an entry with NULL origin */ if(c == NULL) { line = MFC_HASH(mcastgrp, 0x0); for (c = net->ipv4.mfc_cache_array[line]; c; c = c->next) { if ((c->mfc_origin == 0x0) && (c->mfc_mcastgrp == mcastgrp) && (c->mfc_parent == ifindex)) break; } } return c; }
static struct mfc_cache *ipmr_cache_find(__u32 origin, __u32 mcastgrp,unsigned int ifindex) { int line=MFC_HASH(mcastgrp,origin,ifindex); struct mfc_cache *c; for (c=mfc_cache_array[line]; c; c = c->next) { if (c->mfc_origin==origin && c->mfc_mcastgrp==mcastgrp) break; } if(c == NULL) { line = MFC_HASH(mcastgrp,htonl(0x00000000), ifindex); for (c=mfc_cache_array[line]; c; c = c->next) { if ( c->mfc_mcastgrp==mcastgrp) break; } } return c; }
static struct mfc_cache *ipmr_cache_find(__u32 origin, __u32 mcastgrp) { int line=MFC_HASH(mcastgrp,origin); struct mfc_cache *c; for (c=mfc_cache_array[line]; c; c = c->next) { if (c->mfc_origin==origin && c->mfc_mcastgrp==mcastgrp) break; } return c; }
static void ipmr_cache_delete(struct mfc_cache *cache) { struct sk_buff *skb; int line; struct mfc_cache **cp; /* * Find the right cache line */ line=MFC_HASH(cache->mfc_mcastgrp,cache->mfc_origin); cp=&(mfc_cache_array[line]); if(cache->mfc_flags&MFC_QUEUED) del_timer(&cache->mfc_timer); /* * Unlink the buffer */ while(*cp!=NULL) { if(*cp==cache) { *cp=cache->next; break; } cp=&((*cp)->next); } /* * Free the buffer. If it is a pending resolution * clean up the other resources. */ if(cache->mfc_flags&MFC_QUEUED) { cache_resolve_queue_len--; while((skb=skb_dequeue(&cache->mfc_unresolved))) { #ifdef CONFIG_RTNETLINK if (skb->nh.iph->version == 0) { struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); nlh->nlmsg_type = NLMSG_ERROR; nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); skb_trim(skb, nlh->nlmsg_len); ((struct nlmsgerr*)NLMSG_DATA(nlh))->error = -ETIMEDOUT; netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT); } else #endif kfree_skb(skb); } } kfree_s(cache,sizeof(cache)); }
struct mfc_cache *ipmr_cache_find(__u32 origin, __u32 mcastgrp) { int line=MFC_HASH(mcastgrp,origin); struct mfc_cache *cache; cache=mfc_cache_array[line]; while(cache!=NULL) { if(cache->mfc_origin==origin && cache->mfc_mcastgrp==mcastgrp) return cache; cache=cache->next; } return NULL; }
static void ipmr_cache_insert(struct mfc_cache *c) { int line=MFC_HASH(c->mfc_mcastgrp,c->mfc_origin); c->next=mfc_cache_array[line]; mfc_cache_array[line]=c; }