Add support for interface/ipaddress binding to libpq - Mailing list pgsql-hackers

From Grigory Kareev
Subject Add support for interface/ipaddress binding to libpq
Date
Msg-id CAPi2LfC=ZVYr2jzrPVdTCw4fvr8Vfa0RPcjWDBdtmzFD2Y+TyQ@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hello!

I'm willing to implement the 'Add support for interface/ipaddress binding to libpq' feature from the ToDo list.
Actually, the 'ipaddress' part.

For this I'm planning to do the following:
    - Introduce 'sourceaddr' parameter keyword and 'PGSOURCEADDR' env var which can be used to specify local IPv4 or IPv6 ipaddress to bind to
    - Silently ignore the parameter's value in case of Unix-domain communication with database
    - Use BLOCKING bind() call to bind communication socket to specified local ipaddress in two functions:
        src/interfaces/libpq/fe-connect.c@internal_cancel()
        src/interfaces/libpq/fe-connect.c@PQconnectPoll()

Is this enough or I missed something?

WBR, Grigory.

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.
Next
From: Robert Haas
Date:
Subject: Re: Change pg_cancel_*() to ignore current backend