ia64/xen-unstable

changeset 1164:240abd842f1a

bitkeeper revision 1.782 (40508b99QPPOLTn2qbkS5lxuckFyKA)

vif.h, network.c, domain.c:
Purge VFR rules when a domain dies.
author kaf24@scramble.cl.cam.ac.uk
date Thu Mar 11 15:54:01 2004 +0000 (2004-03-11)
parents 2f4d22be2eb7
children c4aa70095bed d9faebfb1422
files xen/common/domain.c xen/common/network.c xen/include/xeno/vif.h
line diff
     1.1 --- a/xen/common/domain.c	Thu Mar 11 10:07:19 2004 +0000
     1.2 +++ b/xen/common/domain.c	Thu Mar 11 15:54:01 2004 +0000
     1.3 @@ -153,6 +153,8 @@ void __kill_domain(struct task_struct *p
     1.4  
     1.5      destroy_event_channels(p);
     1.6  
     1.7 +    delete_all_domain_vfr_rules(p);
     1.8 +
     1.9      /*
    1.10       * Note this means that find_domain_by_id may fail, even when the caller
    1.11       * holds a reference to the domain being queried. Take care!
     2.1 --- a/xen/common/network.c	Thu Mar 11 10:07:19 2004 +0000
     2.2 +++ b/xen/common/network.c	Thu Mar 11 15:54:01 2004 +0000
     2.3 @@ -298,9 +298,8 @@ int delete_net_rule(net_rule_t *rule)
     2.4  
     2.5      write_lock(&net_rule_lock);
     2.6  
     2.7 -    for ( pent = &net_rule_list; pent != NULL; pent = &ent->next )
     2.8 +    for ( pent = &net_rule_list; (ent = *pent) != NULL; pent = &ent->next )
     2.9      {
    2.10 -        ent = *pent;
    2.11          if ( memcmp(rule, &ent->r, sizeof(net_rule_t)) == 0 )
    2.12          {
    2.13              *pent = ent->next;
    2.14 @@ -312,6 +311,27 @@ int delete_net_rule(net_rule_t *rule)
    2.15      write_unlock(&net_rule_lock);
    2.16      return 0;
    2.17  }
    2.18 +
    2.19 +void delete_all_domain_vfr_rules(struct task_struct *p)
    2.20 +{
    2.21 +    net_rule_ent_t **pent, *ent;
    2.22 +
    2.23 +    write_lock(&net_rule_lock);
    2.24 +
    2.25 +    for ( pent = &net_rule_list; (ent = *pent) != NULL; )
    2.26 +    {
    2.27 +        if ( (ent->r.src_dom == p->domain) || (ent->r.dst_dom == p->domain) )
    2.28 +        {
    2.29 +            *pent = ent->next;
    2.30 +            kmem_cache_free(net_rule_cache, ent);
    2.31 +            continue;
    2.32 +        }
    2.33 +
    2.34 +        pent = &ent->next;
    2.35 +    }
    2.36 +
    2.37 +    write_unlock(&net_rule_lock);
    2.38 +}
    2.39   
    2.40  static char *idx_to_name(unsigned int idx)
    2.41  {
     3.1 --- a/xen/include/xeno/vif.h	Thu Mar 11 10:07:19 2004 +0000
     3.2 +++ b/xen/include/xeno/vif.h	Thu Mar 11 15:54:01 2004 +0000
     3.3 @@ -99,6 +99,7 @@ void destroy_net_vif(net_vif_t *vif);
     3.4  void unlink_net_vif(net_vif_t *vif);
     3.5  net_vif_t *net_get_target_vif(u8 *data, unsigned int len, net_vif_t *src_vif);
     3.6  net_vif_t *find_net_vif(domid_t dom, unsigned int idx);
     3.7 +void delete_all_domain_vfr_rules(struct task_struct *p);
     3.8  
     3.9  /*
    3.10   * Return values from net_get_target_vif: