From: James Yonan In-Reply-To: <1112834211.15356.17.camel@...370...> Message-ID: References: <1112834211.15356.17.camel@...370...> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-780335898-1112855990=:22303" Subject: [Openvpn-devel] Re: resolv-retry w/ multiple remote arguments Sender: openvpn-devel-admin@lists.sourceforge.net Errors-To: openvpn-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Id: List-Post: List-Help: List-Subscribe: , List-Archive: Date: Wed Apr 6 23:40:44 2005 To: Charles Duffy Cc: openvpn-devel@lists.sourceforge.net This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@...24... for more info. --8323328-780335898-1112855990=:22303 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 6 Apr 2005, Charles Duffy wrote: > I'm trying to put together a patch to implement my desired behaviour wrt > resolv-retry and multiple remote hosts. > > So far, I've made the following changes: > > Setting the default resolv-retry count: > * Create a new constant, RESOLV_RETRY_UNSET > * Initialize resolve_retry_seconds to RESOLV_RETRY_UNSET rather > than RESOLV_RETRY_INFINITE > * In options_postprocess(), set resolve_retry_seconds > appropriately based on the number of remote hosts provided > > Retrying on DNS failures with resolv-retry 0 and multiple hosts: > * Modify resolve_remote() to accept a boolean argument > multiple_remotes > * In the phase-specific handlers within that same function, treat > multiple_remotes as an alternative to resolve_retry_seconds when > determining whether GETADDR_FATAL and > GETADDR_MENTION_RESOLVE_RETRY should be set (in phase 1) and > whether to fail out with an assertion error (in phase 2). > > Thing is, this doesn't actually work: When I run it in a test case in > with the first remote specified by DNS and the second host specified by > IP, it tries to resolve the first host in phase 1; fails; tries again in > phase 2; and fails again (fatally, there, because GETADDR_FATAL is set). > > I presume that it's supposed to loop around to trying phase1 with the > next host if getaddr fails (on account of using all the available > retries on the current host) rather than proceeding to phase 2 -- but > what's the mechanism? Not really. phase1 and phase2 are meant to be called only once per restart. I would take a different approach (see attached patch). Rather than change the defaulting of resolve_retry_seconds, I would just change the interpretation of RESOLV_RETRY_INFINITE when the remote list > 1 to something that makes more sense, i.e. apply the infinite timeout to the list as a whole, but resolve each list member with GETADDR_TRY_ONCE. James --8323328-780335898-1112855990=:22303 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="openvpn-2.0_rc20RR.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="openvpn-2.0_rc20RR.patch" ZGlmZiAtdXIgb3BlbnZwbi0yLjBfcmMyMC9zb2NrZXQuYyBvcGVudnBuLTIu MF9yYzIwUlIvc29ja2V0LmMNCi0tLSBvcGVudnBuLTIuMF9yYzIwL3NvY2tl dC5jCTIwMDUtMDItMDUgMDE6NDI6MTMuMDAwMDAwMDAwIC0wNzAwDQorKysg b3BlbnZwbi0yLjBfcmMyMFJSL3NvY2tldC5jCTIwMDUtMDQtMDcgMDA6MDI6 NTYuMzg1NTc4MDQwIC0wNjAwDQpAQCAtOTQsNyArOTQsNyBAQA0KICAgaWYg KHN0YXR1cyAhPSBPSUFfSVApIC8qIHBhcnNlIGFzIElQIGFkZHJlc3MgZmFp bGVkPyAqLw0KICAgICB7DQogICAgICAgY29uc3QgaW50IGZhaWxfd2FpdF9p bnRlcnZhbCA9IDU7IC8qIHNlY29uZHMgKi8NCi0gICAgICBpbnQgcmVzb2x2 ZV9yZXRyaWVzID0gcmVzb2x2ZV9yZXRyeV9zZWNvbmRzIC8gZmFpbF93YWl0 X2ludGVydmFsOw0KKyAgICAgIGludCByZXNvbHZlX3JldHJpZXMgPSAoZmxh Z3MgJiBHRVRBRERSX1RSWV9PTkNFKSA/IDEgOiAocmVzb2x2ZV9yZXRyeV9z ZWNvbmRzIC8gZmFpbF93YWl0X2ludGVydmFsKTsNCiAgICAgICBzdHJ1Y3Qg aG9zdGVudCAqaDsNCiAgICAgICBjb25zdCBjaGFyICpmbXQ7DQogICAgICAg aW50IGxldmVsID0gMDsNCkBAIC03NjQsNyArNzY0LDE0IEBADQogCSAgICAg IGludCByZXRyeSA9ID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2V0YWRkciAodW5zaWduZWQgaW50IGZsYWdz LA0KIAkJICAgY29uc3QgY2hhciAqaG9zdG5hbWUsDQo= --8323328-780335898-1112855990=:22303--