From 594b7124ffff7be498d574fddb62764d4ccb9037 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 22 Dec 2019 22:36:42 -0800 Subject: [PATCH] inspircd: warn when using InspIRCd 2 compat mode on an InspIRCd 3 uplink Some commands like KICK are not mangled correctly in this mode. --- README.md | 2 +- protocols/inspircd.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 627529d..c722c39 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ These IRCds (in alphabetical order) are frequently tested and well supported. If * [charybdis](https://github.com/charybdis-ircd/charybdis) (3.5+) - module `ts6` - For KLINE support to work, a `shared{}` block should be added for PyLink on all servers. * [InspIRCd](http://www.inspircd.org/) 2.0 - 3.x - module `inspircd` - Set the `target_version` option to `insp3` to target InspIRCd 3.x, or `insp20` to target InspIRCd 2.0 (currently the default). + - Set the `target_version` option to `insp3` to target InspIRCd 3.x, or `insp20` to target InspIRCd 2.0 (currently the default). - For vHost setting to work, `m_chghost.so` must be loaded. For ident and realname changing support, `m_chgident.so` and `m_chgname.so` must be loaded respectively. - Supported channel, user, and prefix modes are negotiated on connect, but hotloading modules that change these is not supported. After changing module configuration, it is recommended to SQUIT PyLink to force a protocol renegotiation. * [Nefarious IRCu](https://github.com/evilnet/nefarious2) (2.0.0+) - module `p10` diff --git a/protocols/inspircd.py b/protocols/inspircd.py index c6fde2c..a0986e3 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -491,8 +491,8 @@ class InspIRCdProtocol(TS6BaseProtocol): Handles the CAPAB command, used for capability negotiation with our uplink. """ - # 6 CAPAB commands are usually sent on connect: CAPAB START, MODULES, - # MODSUPPORT, CHANMODES, USERMODES, and CAPABILITIES. + # 5 CAPAB subcommands are usually sent on connect (excluding START and END): + # CAPAB MODULES, MODSUPPORT, CHANMODES, USERMODES, and CAPABILITIES # We check just about everything except MODULES if args[0] == 'START': @@ -503,6 +503,7 @@ class InspIRCdProtocol(TS6BaseProtocol): # <- CAPAB START 1205 self.remote_proto_ver = protocol_version = int(args[1]) + log.debug("(%s) handle_capab: got remote protocol version %s", self.name, protocol_version) if protocol_version < self.proto_ver: raise ProtocolError("Remote protocol version is too old! " "At least %s is needed. (got %s)" % @@ -512,11 +513,11 @@ class InspIRCdProtocol(TS6BaseProtocol): "and should not be relied upon for anything important.", self.name) elif protocol_version >= 1205 > self.proto_ver: - log.info("(%s) PyLink 2.1 introduces native support for InspIRCd 3.0. " - "You can enable this by setting the 'target_version' option in your " - "InspIRCd server block to 'insp3'.", self.name) - log.info("(%s) Falling back to InspIRCd 2.0 (compatibility) mode.", self.name) - log.debug("(%s) inspircd: got remote protocol version %s", self.name, protocol_version) + log.warning("(%s) PyLink 2.1 introduces native support for InspIRCd 3. " + "You should enable this by setting the 'target_version' option in your " + "InspIRCd server block to 'insp3'. Otherwise, some features will not " + "work correctly!", self.name) + log.warning("(%s) Falling back to InspIRCd 2.0 (compatibility) mode.", self.name) if self.proto_ver >= 1205: # Clear mode lists, they will be negotiated during burst