eggheads / eggdrop

The Eggdrop IRC Bot
GNU General Public License v2.0
510 stars 84 forks source link

ipv6 chat preference #1410

Open thommey opened 1 year ago

thommey commented 1 year ago

This .dcc output

17:17.35 < mondino> [11:17:23] #mondino# dccstat
17:17.35 < mondino> IDX ADDR                                     + PORT NICK      TYPE  INFO
17:17.35 < mondino> --- ---------------------------------------- ------ --------- ----- ---------
17:17.35 < mondino> 5   X.Y.Z.196                            103xx (telnet)  lstn  103xx
17:17.35 < mondino> 8   X:Y:Z:37::2                       6667 (server)  serv  (lag: 0)

leads to a dcc chat reply to /ctcp chat with the ipv6 address that is used to connect to the ircd instead of the only ipv4 address it listens on. I don't think that should ever happen. prefer-ipv6 is 1 but it doesn't listen on ipv6

Found by: mondino

vanosg commented 1 year ago

Can you clarify the problem with more detail?

thommey commented 1 year ago

ctcp.mod automatically attempts to figure out the address to respond with after /ctcp bot chat. It sends DCC CHAT <botip> <botport> to make the user connect to itself. In the example above, the listen-addr (or listen X.X.X.X 103xx all) was IPv4, and yet, the response includes an ipv6 address it doesn't even listen on, that is pointless, the user cannot connect to that. Example:

# eggdrop.conf
set prefer-ipv6 1
set vhost6 200a:2003::1
listen 10.0.0.1 3333 all

The bot then responds with DCC CHAT 200a:2003::1 3333 which the bot does not listen on

thommey commented 1 year ago

Broken by https://github.com/eggheads/eggdrop/pull/1162

michaelortmann commented 1 year ago

Is it really a bug? Would it really be a fix to ignore vhost* and send a listen address?

If you have eggdrop on a box in a local network, lets say ipv4 192.168.0.x, and you do Network address translation (NAT) on your router, which has public ipv6, and you want someone from the internet to dcc to your bot, you would setup port forwarding on your router. If you also want someone from the internet to ctcp chat to your bot, your bot must not send its local listen address via dcc chat, but the address of the router and the port the router listens on for forwarding to your bot. How would you do this? I would try to set vhost/vhost6. If the router only has a public ipv6, i would configure it like in your example. prefer-ipv6 is a kinda global setting for eggdrop that could interfere.

Eggdrop cannot check or know, if a forwarding address is valid for dcc chat or not, it can only blindly use, what is configured by vhost/vhost6.

A workaround could be to use the IP the irc server sees the bot coming from. but in this case, what about the port number?

Do we need to introduce additional config variables to dewarp the situation?

The bug is complex and without more information / feedback i cannot "just fix".