Eggheads: CIDR support

plazmus plazmus at
Wed Dec 13 10:50:11 CST 2006


  Nowadays most ircds support cidr addressing not only for k/g
lines, but also for channel bans, exempts and invites. However,
eggdrop uses wild_match() for b/e/I matching, which of course doesn't
work for cidr. As this type of addressing is already supported on
popular networks, I believe support should be implemented on eggdrop

   I understand that enabling it on networks, which don't support
it, will introduce some problems when enforcing cidr bans or removing
a person, matching internal cidr ban from the channel. Therefore it's
usage should be optional and either runtime or compile-time
configurable (or both).

    My idea for implementing cidr support in 1.6 is the following:

       - replace calls to wild_match() with calls to a new function,
e.g match_addr(), where this makes sense.

       - match_addr() should call wild_match for any nick!username
parts, passed to it, or for the complete masks, if the first argument
does not seem to be in proper cidr notation. It will call a specific
function to check if the extracted IP address matches the prefix.

       - preprocessor macro #define CIDR, which should be defined by
the user if cidr support is needed.

       - tcl command matchcidr, utilizing the internal changes to
enable cidr support in scripts without unneeded complication.

    I have tested this in practice and it worked on 1.6.17 and
1.6.18 sources, as well as on the current cvs snapshot with both IPv4
and IPv6 addresses (with inet_pton used instead of inet_addr, if IPV6
is defined before compiling).

   I have also some other small ideas/suggestions for the current
eggdrop series 1.6/1.7:

      - adding a msgrate config variable, instead of the current
#define msgrate in server.mod. Many users want to change this and
allowing this at run time is much more flexible. Not to mention that
users of precompiled bots have no other option.

      - maybe a more flexible command for bypassing the dequeueing
system than putdccraw. Something like [putserv noqueue] in eggdrop

      - new maskhost(), similar to ircmask_create_separate() in 1.9,
accompanied by a renewed maskhost nick!user at host ?type? tcl command
and a ban_type variable, allowing for custom ban types, e.g. when
banning +k users. Many people have been asking for this and it won't
hurt, since it doesn't involve great modifications.

  I believe some of these are previously discussed, but IMO we don't
need to wait for a 1.9 release to see them happen.

Rumen Stoyanov

More information about the Eggheads mailing list