Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-10

fcl-db + IPv6 + Firebird

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

A couple of questions...

1. Does fcl-db code support connecting to databases (any DB servers) listening to IPv6 connections?

2. Does anybody know how to tell Firebird RDBMS to listen to IPv6 connections? From the 'netstat -a' output I can see that my Firebird server is only listening to IPv4 tcp connections.

An fcl-db IPv4 connection string to Firebird is in the format "<ip_address>:</path/to/database>" and this results to real connection string looking as follows:

'192.168.0.20:E:\Databases\Test.fdb' (Windows) or
'192.168.0.20:/data/devel/databases/test.fdb' (Unix)

My concern is that IPv6 address use the : (colon) symbol, but it seems even with IPv4 connections under Windows, it doesn't mind the extra colon in the connection string (the colon after the drive letter). So what would fcl-db's connection string look like to a IPv6 database?

Apache Web Server changes the syntax for IPv6 connections to [<ipv6_address>]:<port>
where the [ and ] are literal characters. This makes we wonder if fcl-db with Firebird, and possible other database server follow a similar pattern (I don't know if it is a well known standard - what Apache does)
- wrapping IPv6 address with brackets. So a Firebird IPv6 connection could possible look as follows:

'[2a02:c7f:143d:8400:cceb:e8:5338:9797]:/path/to/database/test.fdb' or
'[2a02:c7f:143d:8400:cceb:e8:5338:9797]:E:\dbpath\test.fdb'

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp
Tony Whyman
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
1. Does fcl-db code support connecting to databases (any DB servers) listening to IPv6 connections? 2. Does anybody know how to tell Firebird RDBMS to listen to IPv6 connections? From the 'netstat -a' output I can see that my Firebird server is only listening to IPv4 tcp connections.

With Firebird this should have nothing to do with the fcl-db and everything to do with the Firebird Client library DLL or ".so". You will need Firebird 3 for IPv6 and my understanding is that this uses IPv6 by default with fallback to IPv4. That is the server will normally listen on an IPv6 socket but accept IPv4 incoming. The client initiated connection uses IPv6 or IPv4 depending on the database path name. The release notes have more info.

Tony Whyman
MWA

Mark Morgan Lloyd
to Graeme Geldenhuys: A couple of questions... 1. Does fcl-db code support connecting to databases (any DB…
Graeme Geldenhuys wrote
Apache Web Server changes the syntax for IPv6 connections to [<ipv6_address>]:<port> where the [ and ] are literal characters.

I think this is mandated by one or the other RFCs, it's not just an Apache thing.

I'd suggest that your question actually has two parts:

i) If a server name only resolves to an IP6 address, does fcl-db honour it?

ii) If a server is specified by IP6 address ditto.

I've written something that was specifically IP6-aware but can't remember whether I investigated the behaviour of the backend servers (PostgreSQL and Firebird) which were assumed to be local (RFC 1918 addresses). I do remember vaguely that there were issues with the OS or libraries (Linux etc. in this case) mapping IP4 onto part of the IP6 range when both were in use.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Graeme Geldenhuys
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote
I think this is mandated by one or the other RFCs, it's not just an Apache thing.

It seems you are correct. After posting the message I searched some more and got a link to the Firebird Bug Tracker where they mentioned the same thing you did.

Regards,
Graeme