RE: 'per-process' DNS setup?
You can use req_query() function in your code (it has no output parser libs) That lib call needs header file resolv.h and there is an option named: _PATH_RESCONF (used by ndef) that can get the file name (instead of resolv.conf). Never seen an environment var that can be changed which affect resolver. Eddie -Original Message- From: guy keren [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 08, 2002 03:53 To: [EMAIL PROTECTED] Subject: 'per-process' DNS setup? i'm trying to 'fake' DNS settings for a _single_ process on a linux box (i.e. when this process will query for the address of a given host, it will get a reply i set a-priory, while other processes will get the proper repely). i noticed there are various environment variables that allow overriding various settings for the resolver library, but they don't seem to allow enough control to actually override such settings, without changing the settings for the whole box. i've been searching on google, and looking for info in the o'rreily DNS and bind book - to no avail. if anyone has an idea if such a feature is available - i'd be glad for any pointer. it sounds odd for such a feature not to be already available via the default libraries. thanks, -- guy For world domination - press 1, or dial 0, and please hold, for the creator. -- nob o. dy = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED] = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
RE: 'per-process' DNS setup?
One solution would be to run this process inside a chroot jail, and set the jailed /etc/resolv.conf file to whatever dns servers you want - or a specially crafted /etc/hosts file inside the jail. Lior -Original Message- From: guy keren [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 08, 2002 03:53 To: [EMAIL PROTECTED] Subject: 'per-process' DNS setup? i'm trying to 'fake' DNS settings for a _single_ process on a linux box (i.e. when this process will query for the address of a given host, it will get a reply i set a-priory, while other processes will get the proper repely). i noticed there are various environment variables that allow overriding various settings for the resolver library, but they don't seem to allow enough control to actually override such settings, without changing the settings for the whole box. i've been searching on google, and looking for info in the o'rreily DNS and bind book - to no avail. if anyone has an idea if such a feature is available - i'd be glad for any pointer. it sounds odd for such a feature not to be already available via the default libraries. thanks, -- guy For world domination - press 1, or dial 0, and please hold, for the creator. -- nob o. dy = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED] = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
'per-process' DNS setup?
i'm trying to 'fake' DNS settings for a _single_ process on a linux box (i.e. when this process will query for the address of a given host, it will get a reply i set a-priory, while other processes will get the proper repely). i noticed there are various environment variables that allow overriding various settings for the resolver library, but they don't seem to allow enough control to actually override such settings, without changing the settings for the whole box. i've been searching on google, and looking for info in the o'rreily DNS and bind book - to no avail. if anyone has an idea if such a feature is available - i'd be glad for any pointer. it sounds odd for such a feature not to be already available via the default libraries. thanks, -- guy For world domination - press 1, or dial 0, and please hold, for the creator. -- nob o. dy = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: 'per-process' DNS setup?
On Sun, Dec 08, 2002 at 03:53:00AM +0200, guy keren wrote: i'm trying to 'fake' DNS settings for a _single_ process on a linux box (i.e. when this process will query for the address of a given host, it will get a reply i set a-priory, while other processes will get the proper repely). i noticed there are various environment variables that allow overriding various settings for the resolver library, but they don't seem to allow enough control to actually override such settings, without changing the settings for the whole box. i've been searching on google, and looking for info in the o'rreily DNS and bind book - to no avail. if anyone has an idea if such a feature is available - i'd be glad for any pointer. it sounds odd for such a feature not to be already available via the default libraries. thanks, It should be relatively trivial to write a wrapper for the resolver functions which will be preloaded for one specific process. See the LD_PRELOAD environment variable, and the assorted dynamic linker functions in order to get started. -- Yotam Rubin msg23782/pgp0.pgp Description: PGP signature
Re: 'per-process' DNS setup?
On Sun, 8 Dec 2002 03:53:00 +0200 (IST) guy keren [EMAIL PROTECTED] wrote: i noticed there are various environment variables that allow overriding various settings for the resolver library, but they don't seem to allow enough control to actually override such settings I'd like to (ab)use your question to general config mechanisms available, and some comparisons: Environment variables: - Per-process - Inherited (so we can make them global) - No change (from outside) after process startup - Flat name-space (not scaleable) Global config files: - Global - Change may/may-not affect after process startup (e.g: SIGHUP to daemons etc.) - Managed case by case (each with its own rules) - Arbitrary types/ammounts of data Global config database (e.g: Windows Registry, GNOME GConf): - Global - Change affect processes even after process startup - Centralized management (but luckily, GConf doesn't force you to have all config in one big file) - Hierarchical namespace (scaleable) After looking at the pros/cons of each mechanism, I think it will be illuminating to present another very old mechanism: The X toolkit resource database: - Global - Hierarchical namespace (scaleable) - The key heirarchy permit overrides: - per type of application (window class) - per instance of application (window) - Centralized managment (xrdb(1)), but database may be spread at multiple locations (along the XAPPRESPATH and in the Xserver as well) - Application may allow changes to occur after startup (instantiation), see editres(1) Looks like it takes most of the pros from all methods (except of inheritance -- designed not Unix specific), without the cons. Now, isn't it a pitty that this mechanism is dying? Both KDE and GNOME chose to develop their own (inferior IMHO) mechanisms. Hopefully later GConf versions (which isn't GNOME/X specific) will include the missing parts, so we can return to the flexibility we had in the 80's :-) Oron Peled Voice/Fax: +972-4-8228492 [EMAIL PROTECTED] http://www.actcom.co.il/~oron A billion flies _can_ be wrong - I'd rather eat lamb chops than shit. -- Linus Torvalds on lkml = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]