patch-2.0.31 linux/net/ipv4/ipmr.c

Next file: linux/net/ipv4/packet.c
Previous file: linux/net/ipv4/ipip.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.30/linux/net/ipv4/ipmr.c linux/net/ipv4/ipmr.c
@@ -193,6 +193,8 @@
 	init_timer(&c->mfc_timer);
 	c->mfc_timer.data=(long)c;
 	c->mfc_timer.function=ipmr_cache_timer;
+	c->mfc_packets=0;
+	c->mfc_bytes=0;
 	return c;
 }
  
@@ -591,6 +593,7 @@
 	struct sioc_sg_req sr;
 	struct sioc_vif_req vr;
 	struct vif_device *vif;
+	struct mfc_cache *cl;
 	
 	switch(cmd)
 	{
@@ -617,6 +620,19 @@
 			if(err)
 				return err;
 			memcpy_fromfs(&sr,(void *)arg,sizeof(sr));
+			cl=ipmr_cache_find(sr.src.s_addr,sr.grp.s_addr);
+			if(cl==NULL)
+			{
+				sr.pktcnt=0;
+				sr.bytecnt=0;
+				sr.wrong_if=0;
+			}
+			else
+			{
+				sr.pktcnt=cl->mfc_packets;
+				sr.bytecnt=cl->mfc_bytes;
+				sr.wrong_if=0;
+			}
 			memcpy_tofs((void *)arg,&sr,sizeof(sr));
 			return 0;
 		default:
@@ -753,6 +769,8 @@
 	
 	vif_table[vif].pkt_in++;
 	vif_table[vif].bytes_in+=skb->len;
+	cache->mfc_packets++;
+	cache->mfc_bytes+=skb->len;
 	
 	/*
 	 *	Forward the frame
@@ -785,9 +803,7 @@
 	if(psend==-1)
 		kfree_skb(skb, FREE_WRITE);
 	else
-	{
 		ipmr_queue_xmit(skb, &vif_table[psend], skb->dev, is_frag);
-	}
 }
 
 /*
@@ -907,7 +923,7 @@
  
 void ip_mr_init(void)
 {
-	printk(KERN_INFO "Linux IP multicast router 0.06.\n");
+	printk(KERN_INFO "Linux IP multicast router 0.07.\n");
 	register_netdevice_notifier(&ip_mr_notifier);
 #ifdef CONFIG_PROC_FS	
 	proc_net_register(&(struct proc_dir_entry) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov