diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2013-08-25 15:37:26 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2013-08-25 15:37:26 +0200 |
commit | 6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (patch) | |
tree | 009fc492961e13860d2a4bc2de8caf2bbe2975e7 /src/libstrongswan/fetcher | |
parent | c83921a2b566aa9d55d8ccc7258f04fca6292ee6 (diff) | |
download | vyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.tar.gz vyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.zip |
Imported Upstream version 5.1.0
Diffstat (limited to 'src/libstrongswan/fetcher')
-rw-r--r-- | src/libstrongswan/fetcher/fetcher.h | 6 | ||||
-rw-r--r-- | src/libstrongswan/fetcher/fetcher_manager.c | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/libstrongswan/fetcher/fetcher.h b/src/libstrongswan/fetcher/fetcher.h index 58451aef2..890258c3c 100644 --- a/src/libstrongswan/fetcher/fetcher.h +++ b/src/libstrongswan/fetcher/fetcher.h @@ -90,6 +90,12 @@ enum fetcher_option_t { FETCH_CALLBACK, /** + * Source IP address to bind for a fetch. + * Additional argument is a host_t*, which may be NULL. + */ + FETCH_SOURCEIP, + + /** * end of fetching options */ FETCH_END, diff --git a/src/libstrongswan/fetcher/fetcher_manager.c b/src/libstrongswan/fetcher/fetcher_manager.c index a638eef2f..21cd1aff4 100644 --- a/src/libstrongswan/fetcher/fetcher_manager.c +++ b/src/libstrongswan/fetcher/fetcher_manager.c @@ -73,6 +73,7 @@ METHOD(fetcher_manager_t, fetch, status_t, fetcher_option_t opt; fetcher_t *fetcher; bool good = TRUE; + host_t *host; va_list args; /* check URL support of fetcher */ @@ -111,6 +112,14 @@ METHOD(fetcher_manager_t, fetch, status_t, case FETCH_CALLBACK: good = fetcher->set_option(fetcher, opt, va_arg(args, fetcher_callback_t)); + continue; + case FETCH_SOURCEIP: + host = va_arg(args, host_t*); + if (host && !host->is_anyaddr(host)) + { + good = fetcher->set_option(fetcher, opt, host); + } + continue; case FETCH_END: break; } @@ -204,4 +213,3 @@ fetcher_manager_t *fetcher_manager_create() return &this->public; } - |