Author: Run <carlo@alinoe.com>
Log message:
Overview of changes
-------------------
- The ircd will now always use bind() to bind sockets to interfaces,
the compile option VIRTUAL_HOST has been removed therefore as it
is turned on by default now.
- It has become possible to specify in the ircd.conf the interfaces
to which each listen port should bind to, per port. A default is
available too though.
- The ircd will now correctly use the same interface as the client
used to connect to the server when doing an identd lookup.
- It is not needed anymore for the hostname in the M: line to resolve.
Moreover, if you want to hide your server, make sure it doesn't :).
If it DOES resolve, then it should be the correct IP-number of
the actually host (one of your interfaces), in that case it will
be just like the current ircu with VIRTUAL_HOST defined.
Each interface has an IP-number, you can list those by typing the
following command on the UNIX prompt:
ifconfig -a
You can specify the interfaces to which a listen port needed to bind
to by giving this IP-number in the corresponding "passwd" field of the
P: line (the third field). For example, to bind a listen port `6667'
to 127.0.0.1, use:
P::127.0.0.1::6667
At this moment, each P: line represents a client port. With hide8.patch
however, you can also bind the server listen port to an interface
by simply adding a P: line, forinstance:
P::192.168.1.2::4400
would bind the server port to 192.168.1.2. Here `4400' is the server
port that is specified in the M: line! (You can only have one server
port). You can of course bind it to more than one interface now
(that was not possible before, it was all (#undef VIRTUAL_HOST) or
only one (#define VIRTUAL_HOST)) by adding more P: lines for port 4400.
For instance:
P::192.168.1.2::4400
P::127.0.0.1::4400
Using a '*' in the password field will bind that port to ALL interfaces,
while using nothing at all will use the DEFAULT inteface.
For example:
P::::6667
will bind a client port 6667 to the DEFAULT interface.
The default interface is determined as follows:
1) If an interface is specified on the commandline (using the -w commandline
option), then that is the default interface; otherwise
2) If the hostname in the M: line resolves to a local IP number, then that
is the default interface; otherwise
3) All interfaces will be bound by default (as if a '*' was specified).
For outgoing connect (/connect and /uping), the ircd will use a slightly
different "default" interface:
1) If the IP of the peer server to connect is 127.0.0.1 it will use
127.0.0.1 as interface; otherwise
2) see 1) above
3) see 2) above
4) The last interface specified in a P: line in the ircd.conf for the
server port that is not 127.0.0.1 is the default interface; otherwise
5) see 3) above
However, I wouldn't worry about this too much: it should do what is
intuitively right.
Finally, the syntax of /CONNECT and /UPING have been extended.
It now is possible to specify an IP-number explicitely to distinguish
between different C/N: lines.
You can still do:
/CONNECT target.server 4400 remote.server
but you can also use:
/CONNECT target.server <IP number>:4400 remote.server
For instance, if "remote.server" had the following C/N lines for
target.server:
C:111.111.111.111:passwd:target.server
N:111.111.111.111:passwd:target.server
C:127.0.0.1:passwd:target.server
N:127.0.0.1:passwd:target.server
Then you can specify to which interface you want to connect
by using:
/CONNECT target.server 111.111.111.111:4400 remote.server
or
/CONNECT target.server 127.0.0.1:4400 remote.server
by default it will use the C: line at the top.
If you want to hide your HUB, then you can apply this patch --
add C/N lines for all your peers using 127.0.0.1 as IP number
and set up portwarders (ask Nemesi for help with the latter).
Of course your peers need to fix their and ircd.conf and rehash,
as well as use a portforwarder too (like ssh) but they won't need
to patch their servers.
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@20
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c