From: Jacob Gorm Hansen Subject: Re: VIF rules not purged on domain exit Date: Thu, 11 Mar 2004 16:16:44 +0100 Sender: xen-devel-admin@lists.sourceforge.net Message-ID: <1079018204.4285.22.camel@jacobg> References: <1079012039.4285.14.camel@jacobg> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-cwmyYGCa/F5gBpXSr0mV" Return-path: In-Reply-To: <1079012039.4285.14.camel@jacobg> Errors-To: xen-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Xen list List-Id: xen-devel@lists.xenproject.org --=-cwmyYGCa/F5gBpXSr0mV Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, 2004-03-11 at 14:33, Jacob Gorm Hansen wrote: > hi, > > I noticed that apparently networking rules are not purged from the rules > list when a domain exists, and newly added rules to not replace existing > ones. Is this on purpose? I've attached a trivial fix in case anyone is interested. Jacob --=-cwmyYGCa/F5gBpXSr0mV Content-Disposition: attachment; filename=del_net.diff Content-Type: text/x-patch; name=del_net.diff; charset=utf-8 Content-Transfer-Encoding: 7bit --- orig/xen/common/domain.c +++ mod/xen/common/domain.c @@ -128,6 +128,7 @@ void __kill_domain(struct task_struct *p) { extern void destroy_event_channels(struct task_struct *); + extern void delete_all_domain_rules(domid_t); int i; struct task_struct **pp; @@ -152,6 +153,7 @@ unlink_net_vif(p->net_vif_list[i]); destroy_event_channels(p); + delete_all_domain_rules(p->domain); /* * Note this means that find_domain_by_id may fail, even when the caller --- orig/xen/common/network.c +++ mod/xen/common/network.c @@ -312,6 +312,28 @@ write_unlock(&net_rule_lock); return 0; } + +void delete_all_domain_rules(domid_t dom_id) +{ + net_rule_ent_t **pent, *ent; + + write_lock(&net_rule_lock); + + for ( pent = &net_rule_list; pent != NULL && (ent=*pent); ) + { + + if ( ent->r.src_dom==dom_id || ent->r.dst_dom==dom_id ) + { + *pent = ent->next; + kmem_cache_free(net_rule_cache, ent); + continue; + } + + pent = &ent->next; + } + write_unlock(&net_rule_lock); +} + static char *idx_to_name(unsigned int idx) { --=-cwmyYGCa/F5gBpXSr0mV-- ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click