Changeset 4611

Show
Ignore:
Timestamp:
11/11/08 07:29:25 (2 months ago)
Author:
andreas
Message:

added the MIPv6 options use_proxy_mode and install_policy

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/charon/config/child_cfg.c

    r4548 r4611  
    119119     */ 
    120120    bool use_ipcomp; 
     121 
     122    /** 
     123     * set up IPsec transport SA in MIPv6 proxy mode 
     124     */ 
     125    bool proxy_mode; 
     126 
     127    /** 
     128     * enable installation and removal of kernel IPsec policies 
     129     */ 
     130    bool install_policy; 
    121131}; 
    122132 
     
    340350 * Implementation of child_cfg_t.equal_traffic_selectors. 
    341351 */ 
    342 bool equal_traffic_selectors(private_child_cfg_t *this, bool local, traffic_selector_t *ts) 
    343 
    344     linked_list_t *list; 
    345     enumerator_t *enumerator
    346     traffic_selector_t *other_ts; 
     352bool equal_traffic_selectors(private_child_cfg_t *this, bool local, 
     353                             linked_list_t *ts_list, host_t *host) 
     354
     355    linked_list_t *this_list
     356    traffic_selector_t *this_ts, *ts; 
    347357    bool result; 
    348358 
    349     list = (local) ? this->my_ts : this->other_ts; 
    350  
    351     if (list->get_count(list) != 1) 
     359    this_list = (local) ? this->my_ts : this->other_ts; 
     360 
     361    /* currently equality is established for single traffic selectors only */ 
     362    if (this_list->get_count(this_list) != 1 || ts_list->get_count(ts_list) != 1) 
    352363    { 
    353364        return FALSE; 
    354365    } 
    355     enumerator = list->create_enumerator(list); 
    356     enumerator->enumerate(enumerator, &other_ts); 
    357          
    358     result = ts->equals(ts, other_ts); 
    359  
    360     enumerator->destroy(enumerator); 
     366 
     367    this_list->get_first(this_list, (void**)&this_ts); 
     368    this_ts = this_ts->clone(this_ts); 
     369    this_ts->set_address(this_ts, host); 
     370    ts_list->get_first(ts_list, (void**)&ts); 
     371 
     372    result = ts->equals(ts, this_ts); 
     373 
     374    this_ts->destroy(this_ts); 
    361375    return result; 
    362376} 
     
    445459{ 
    446460    return this->use_ipcomp; 
     461} 
     462 
     463/** 
     464 * Implementation of child_cfg_t.set_mipv6_options. 
     465 */ 
     466static void set_mipv6_options(private_child_cfg_t *this, bool proxy_mode, 
     467                                                         bool install_policy) 
     468{ 
     469    this->proxy_mode = proxy_mode; 
     470    this->install_policy = install_policy; 
     471} 
     472 
     473/** 
     474 * Implementation of child_cfg_t.use_proxy_mode. 
     475 */ 
     476static bool use_proxy_mode(private_child_cfg_t *this) 
     477{ 
     478    return this->proxy_mode; 
     479} 
     480 
     481/** 
     482 * Implementation of child_cfg_t.install_policy. 
     483 */ 
     484static bool install_policy(private_child_cfg_t *this) 
     485{ 
     486    return this->install_policy; 
    447487} 
    448488 
     
    488528    this->public.add_traffic_selector = (void (*)(child_cfg_t*,bool,traffic_selector_t*))add_traffic_selector; 
    489529    this->public.get_traffic_selectors = (linked_list_t*(*)(child_cfg_t*,bool,linked_list_t*,host_t*))get_traffic_selectors; 
    490     this->public.equal_traffic_selectors = (bool (*)(child_cfg_t*,bool,traffic_selector_t*))equal_traffic_selectors; 
     530    this->public.equal_traffic_selectors = (bool (*)(child_cfg_t*,bool,linked_list_t*,host_t*))equal_traffic_selectors; 
    491531    this->public.add_proposal = (void (*) (child_cfg_t*,proposal_t*))add_proposal; 
    492532    this->public.get_proposals = (linked_list_t* (*) (child_cfg_t*,bool))get_proposals; 
     
    499539    this->public.get_lifetime = (u_int32_t (*) (child_cfg_t *,bool))get_lifetime; 
    500540    this->public.get_dh_group = (diffie_hellman_group_t(*)(child_cfg_t*)) get_dh_group; 
     541    this->public.set_mipv6_options = (void (*) (child_cfg_t*,bool,bool))set_mipv6_options; 
    501542    this->public.use_ipcomp = (bool (*) (child_cfg_t *))use_ipcomp; 
     543    this->public.use_proxy_mode = (bool (*) (child_cfg_t *))use_proxy_mode; 
     544    this->public.install_policy = (bool (*) (child_cfg_t *))install_policy; 
    502545    this->public.get_ref = (child_cfg_t* (*) (child_cfg_t*))get_ref; 
    503546    this->public.destroy = (void (*) (child_cfg_t*))destroy; 
     
    513556    this->close_action = close_action; 
    514557    this->use_ipcomp = ipcomp;  
     558    this->proxy_mode = FALSE; 
     559    this->install_policy = TRUE;  
    515560    this->refcount = 1; 
    516561    this->proposals = linked_list_create(); 
  • trunk/src/charon/config/child_cfg.h

    r4548 r4611  
    155155 
    156156    /** 
    157      * Checks the [single] traffic selectors for equality  
     157     * Checks [single] traffic selectors for equality  
    158158     * 
    159159     * @param local         TRUE for TS on local side, FALSE for remote 
    160      * @param ts            single traffic selector to compare with 
     160     * @param ts            list with single traffic selector to compare with 
     161     * @param host          address to use for narrowing "dynamic" TS', or NULL 
    161162     * @return              TRUE if TS are equal, FALSE otherwise 
    162163     */  
    163164    bool (*equal_traffic_selectors)(child_cfg_t *this, bool local, 
    164                                    traffic_selector_t *ts); 
     165                                   linked_list_t *ts_list, host_t *host); 
    165166 
    166167    /** 
     
    230231     */ 
    231232    bool (*use_ipcomp)(child_cfg_t *this); 
     233 
     234    /** 
     235     * Sets two options needed for Mobile IPv6 interoperability 
     236     *  
     237     * @proxy_mode          use IPsec transport proxy mode (default FALSE) 
     238     * @install_policy      install IPsec kernel policies (default TRUE) 
     239     */ 
     240    void (*set_mipv6_options)(child_cfg_t *this, bool proxy_mod, 
     241                                                 bool install_policy); 
     242 
     243    /** 
     244     * Check whether IPsec transport SA should be set up in proxy mode 
     245     *  
     246     * @return              TRUE, if proxy mode should be used 
     247     *                      FALSE, otherwise 
     248     */ 
     249    bool (*use_proxy_mode)(child_cfg_t *this); 
     250     
     251    /** 
     252     * Check whether IPsec policies should be installed in the kernel 
     253     *  
     254     * @return              TRUE, if IPsec kernel policies should be installed 
     255     *                      FALSE, otherwise 
     256     */ 
     257    bool (*install_policy)(child_cfg_t *this); 
    232258     
    233259    /** 
     
    272298                              u_int32_t rekeytime, u_int32_t jitter, 
    273299                              char *updown, bool hostaccess, ipsec_mode_t mode, 
    274                               action_t dpd_action, action_t close_action, 
    275                               bool ipcomp); 
     300                              action_t dpd_action, action_t close_action, bool ipcomp); 
    276301 
    277302#endif /* CHILD_CFG_H_ @} */