Commit graph

53 commits

Author SHA1 Message Date
Aaron Jones a6b99c07d1
serv_connect(): ensure both sa_bind[]/sa_connect[] are always populated (#352)
Due to [1], linking with SCTP sometimes does not multi-home correctly.
This is triggered by the rand() on the lines immediately above these.

The connect{} blocks already support an `aftype` parameter to instruct
IRCd to prefer IPv4 or IPv6. This commit additionally ensures that the
other structure is always populated with the other address (if any) if
this parameter is specified.

This will allow SCTP server-linking users to work around the bug and
ensure that it always multi-homes by setting `connect::aftype` to IPv4.
Without this commit, that would cause Solanum to not include the IPv6
addresses (if any) in the connect block in its SCTP setup.

If there isn't a valid IP address in the other sockaddr, this should be
of no consequence, because it will not be used by rb_connect_tcp(), and
both rb_connect_sctp() and rb_sctp_bindx_only() already verify that
there is a valid IP address in the sockaddr before making use of it.

[1] https://marc.info/?l=linux-sctp&m=165684809726472&w=2
2022-07-05 06:01:26 +00:00
Ariadne Conill 81531536aa
Remove ziplinks (#218) 2021-06-26 17:45:52 +01:00
Ed Kellett ce376a21cc Keep propagated bans in a dictionary, not a list 2021-06-08 21:57:43 +01:00
Ed Kellett eeaea74616 Allow privset-less OPER bursting 2021-06-05 19:42:18 +01:00
Ed Kellett e5e814b3db Use opernames not servernames for remote opers 2020-11-13 23:30:04 +00:00
Doug Freed 99b8e2feea s_serv: refactor burst_modes_TS6 to use multiline 2020-11-12 19:18:01 -05:00
jesopo f0356d2a6f iter lists backwards when sending BMASK 2020-11-12 21:34:21 +00:00
jess a922755512
make more snotes L_NETWIDE 2020-11-08 14:30:41 -05:00
Ed Kellett 738b5d291e Mint CLICAP_FLAGS_PRIORITY 2020-10-19 19:30:43 -04:00
Ed Kellett 7c7065b07e Add class::max_autoconn configuration 2020-10-18 20:03:05 +01:00
Ed Kellett ed3ca2ff16
Propagate OPER
Move opername and privset storage to struct User, so it can exist for
remote opers.

On /oper and when bursting opers, send:

    :foo OPER opername privset

which sets foo's opername and privset. The contents of the privset on
remote servers come from the remote server's config, so the potential
for confusion exists if these do not match.

If an oper's privset does not exist on a server that sees it, it will
complain, but create a placeholder privset. If the privset is created by
a rehash, this will be reflected properly.

/privs is udpated to take an optional argument, the server to query, and
is now local by default:

    /privs [[nick_or_server] nick]
2019-09-13 10:08:27 +01:00
Simon Arlott 17809d2db7
librb: Fix type of dst for rb_inet_pton_sock() 2019-08-31 16:10:50 +01:00
Simon Arlott acd941bfed
ircd: use correct buffer sizes
This fixes an issue with truncated SJOINs.
2018-01-18 21:33:41 +00:00
Simon Arlott 6003ce763c
Add outgoing SCTP connect support 2017-08-24 20:08:21 +01:00
Simon Arlott 4ce1cac4b9
s_serv: connect using both IPv4 and IPv6 if unspecified 2017-08-22 21:55:12 +01:00
Simon Arlott de2934965c
remove RB_IPV6 2017-08-20 12:54:46 +01:00
Simon Arlott f3564f47f4
msgbuf: correctly split buffers into IRCv3 tags and RFC1459 message data 2017-07-29 22:46:07 +01:00
Simon Arlott 6c1e15a432
exit_remote_server: avoid clang static analysis warning
if IsServer(source_p) then the following must be all non-NULL:
 ->serv
 ->servptr
 ->servptr->serv

Remove unnecessary and inconsistent pointer checks.
2017-07-29 22:28:48 +01:00
Simon Arlott d2b3a2a474
ircd: check_server: don't allow a connection if that would exceed the class limit 2017-07-23 17:38:11 +01:00
Simon Arlott e3cea4d811
ircd: serv_connect: don't try to connect if that would exceed the class limit 2017-07-23 15:40:00 +01:00
Simon Arlott f41f79971c
server_estab: don't try to send to a dead client
If the zlib setup fails the client will be exited, so don't send
to it before checking this.
2016-11-20 21:41:18 +00:00
William Pitcock 087555a00f ircd: introduce 'no-export' links
Links that are 'no-export' are not distributed to the rest of the IRC network (including local peers).
This provides a core primitive for 'anycasting' services (but the actual issue of synchronizing data in
a services package is left to the authors of the services package).
2016-09-16 17:18:55 -05:00
Simon Arlott 86e1de17f3
ircd: serv_connect: initialise sa_connect/sa_bind to AF_UNSPEC
These are read to check if they're AF_UNSPEC (unset) but they aren't
initialised.
2016-09-03 14:52:48 +01:00
Jason Volk ffedad8dfb ircd: Allow non-default CAP_MASK during server estab. 2016-08-20 04:10:28 -07:00
Aaron Jones 4d5a902f08
strcpy: mass-migrate to strlcpy where appropriate 2016-05-15 03:57:16 +00:00
Aaron Jones b143df9ac4
minor spring cleaning: remove/relocate duplicate/unused includes & macros
[ci skip]
2016-05-14 23:29:33 +00:00
Simon Arlott 53789fddda
sslproc: simplify ssl open callback
Don't use the librb callback type as we're always passing client_p.

Provide a return value so that the connect handler can exit_client()
and the accept handler can opt to use the default dead handler.
2016-04-25 21:12:44 +01:00
Simon Arlott 5ad62c80ee
librb: remove socklen parameter from rb_connect_tcp 2016-04-24 17:11:20 +01:00
Simon Arlott d4214e9445
ircd: server connection configuration
Fix the server connection configuration so that it can simultaneously
handle a hostname/IPv4/IPv6 for connecting and a hostname/IPv4/IPv6
for binding. Maintains backwards compatibility for matching a hostname
with a mask.

Multiple host/vhost entries can be specified and the last value for
each address family is stored. Hostnames that resolve automatically
overwrite the IP address.

Server connections can now be made to either IPv4 or IPv6 at random
as well as preferring a specific address family.
2016-04-24 17:06:24 +01:00
Simon Arlott 65f43a4fc4
ircd: Don't try to connect to servers that we know have an invalid fingerprint
This just causes an unnecessary link/squit on the other server.
2016-04-24 11:49:21 +01:00
Simon Arlott 4fbb736202
ssld: add a callback when the connection is opened
This allows us to wait until we have the fingerprint information before
continuing with a server connect process.
2016-04-24 11:48:35 +01:00
Simon Arlott 84e3e445aa
mr_server: Report certificate fingerprint mismatches
Log the received certificate fingerprint when it causes a server to be
rejected.
2016-04-23 17:37:05 +01:00
Elizabeth Myers 7445ece1d1
Revert "Implement the netsplit batch type."
This needs more work, see
https://github.com/ircv3/ircv3-specifications/issues/253

This reverts commit 2373891299.
2016-04-16 11:05:00 -05:00
Elizabeth Myers 2373891299
Implement the netsplit batch type.
This also lays the groundwork for the netjoin batch type, but that isn't
implemented yet. I don't like how some of this is implemented but it'll
have to do for now...

Compile tested, needs more testing.
2016-04-15 16:50:43 -05:00
Elizabeth Myers f956cb0f1f Use rb_* versions of nonportable string functions 2016-04-05 05:39:59 -05:00
Elizabeth Myers d86692fa44 Add new sockaddr_storage port retrieval/setting macros
These macros are safe for use on IPv6 and clean up a lot of code.
2016-03-31 03:00:29 -05:00
William Pitcock de7cf7e009 ircd: client: substantially rework the connid registry system
now connid's are allocated on demand and clients may have as many connid's as necessary.
this allows us to build chains of helpers while ensuring the ircd properly tracks and GCs the resources.
2016-03-25 19:50:29 -05:00
Elizabeth Myers 79435744c7 common.h: raison d'être is gone, so out it goes.
Fold whatever was left into ircd_defs.h
2016-03-23 09:33:56 -05:00
William Pitcock 1859e9d7d7 ircd: remove basically entirely pointless ServerInfo.hub (closes #167) 2016-03-19 23:05:07 -05:00
William Pitcock bfc44622c8 ircd: do not shadow internal openssl symbol "ssl_ok" (yeah, i know) 2016-03-19 00:57:32 -05:00
Elizabeth Myers 07554369bd Detect stdbool.h and add conformant shims if it isn't available
Charybdis requires C99 already, so it's high time we start using
stdbool. I've converted a few pieces of code already.

A lot of the old code that uses YES/NO should probably be updated too
because that's fucking hideous.
2016-03-08 04:54:04 -06:00
Elizabeth Myers cbeab4bc34 Remove $Id tags from everything.
These are obsolete and none have changed since 10 years gao...
2016-03-06 02:47:27 -06:00
William Pitcock 65f2c0a263 ircd: simplify connid table handling 2016-03-02 15:31:50 -06:00
William Pitcock 193d4db30c sasl: transfer ownership of 'sasl' capability to m_sasl module 2016-02-28 00:29:26 -06:00
William Pitcock be2ce24c42 send: implement echo-message 2016-02-27 02:48:37 -06:00
William Pitcock 0416a2cc86 starttls: take ownership of 'tls' capability 2016-02-27 01:45:40 -06:00
William Pitcock 32df5e96a6 cap: substantial rewrite leveraging the ircd capabilities framework for client caps 2016-02-27 01:41:36 -06:00
William Pitcock 486cd34415 ircd: chase capability API changes 2016-02-27 00:01:54 -06:00
Simon Arlott 5e270e7d89
ircd: Handle which_ssld failure
It's possible for which_ssld to fail and return NULL, handle this in
start_ssld_connect and start_ssld_accept by returning NULL. The NULL
return value is already handled in all calls to start_ssld_accept,
so handle this for start_ssld_connect by reporting an error connecting.

Handle it in start_zlib_session by exiting the client.
2016-02-10 22:45:38 +00:00
Valerii Iatsko 5203cba5ce Remove libratbox's snprintf.c, update related ircd code 2016-02-10 02:25:32 +01:00