Changeset 4611
- Timestamp:
- 11/11/08 07:29:25 (2 months ago)
- Files:
-
- trunk/src/charon/config/child_cfg.c (modified) (6 diffs)
- trunk/src/charon/config/child_cfg.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/charon/config/child_cfg.c
r4548 r4611 119 119 */ 120 120 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; 121 131 }; 122 132 … … 340 350 * Implementation of child_cfg_t.equal_traffic_selectors. 341 351 */ 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;352 bool 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; 347 357 bool result; 348 358 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) 352 363 { 353 364 return FALSE; 354 365 } 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); 361 375 return result; 362 376 } … … 445 459 { 446 460 return this->use_ipcomp; 461 } 462 463 /** 464 * Implementation of child_cfg_t.set_mipv6_options. 465 */ 466 static 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 */ 476 static 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 */ 484 static bool install_policy(private_child_cfg_t *this) 485 { 486 return this->install_policy; 447 487 } 448 488 … … 488 528 this->public.add_traffic_selector = (void (*)(child_cfg_t*,bool,traffic_selector_t*))add_traffic_selector; 489 529 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; 491 531 this->public.add_proposal = (void (*) (child_cfg_t*,proposal_t*))add_proposal; 492 532 this->public.get_proposals = (linked_list_t* (*) (child_cfg_t*,bool))get_proposals; … … 499 539 this->public.get_lifetime = (u_int32_t (*) (child_cfg_t *,bool))get_lifetime; 500 540 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; 501 542 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; 502 545 this->public.get_ref = (child_cfg_t* (*) (child_cfg_t*))get_ref; 503 546 this->public.destroy = (void (*) (child_cfg_t*))destroy; … … 513 556 this->close_action = close_action; 514 557 this->use_ipcomp = ipcomp; 558 this->proxy_mode = FALSE; 559 this->install_policy = TRUE; 515 560 this->refcount = 1; 516 561 this->proposals = linked_list_create(); trunk/src/charon/config/child_cfg.h
r4548 r4611 155 155 156 156 /** 157 * Checks the[single] traffic selectors for equality157 * Checks [single] traffic selectors for equality 158 158 * 159 159 * @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 161 162 * @return TRUE if TS are equal, FALSE otherwise 162 163 */ 163 164 bool (*equal_traffic_selectors)(child_cfg_t *this, bool local, 164 traffic_selector_t *ts);165 linked_list_t *ts_list, host_t *host); 165 166 166 167 /** … … 230 231 */ 231 232 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); 232 258 233 259 /** … … 272 298 u_int32_t rekeytime, u_int32_t jitter, 273 299 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); 276 301 277 302 #endif /* CHILD_CFG_H_ @} */
