Skip to content

IPv6 connections cause IllegalArgumentException: Only IPv4 supported and prevent players from logging in #43

Description

@Qicwken777

Environment

  • Navauth: 0.1.6-SNAPSHOT
  • Proxy: Velocity 3.5.0-SNAPSHOT

Description

When a player connects using an IPv6 address, Navauth throws an exception during PreLoginEvent:

java.lang.IllegalArgumentException: Only IPv4 supported
    at pl.spcode.navauth.common.domain.common.IPAddress$Companion.fromInetAddress(IPAddress.kt:34)

Because the exception occurs before the authentication session is created, the following events fail as well:

  • GameProfileRequestEvent throws NullPointerException
  • The player has no auth session
  • The player is disconnected

Stack trace

[09:08:47 ERROR]: Couldn't pass PreLoginEvent to navauth 0.1.6-SNAPSHOT
java.lang.IllegalArgumentException: Only IPv4 supported
        at pl.spcode.navauth.common.domain.common.IPAddress$Companion.fromInetAddress(IPAddress.kt:34)
        at pl.spcode.navauth.velocity.application.auth.InvalidSessionCacheService.cachePremiumConnection(InvalidSessionCacheService.kt:45)
        at pl.spcode.navauth.velocity.listener.velocity.LoginListeners.onPreLogin(LoginListeners.kt:100)

[09:08:47 ERROR]: Couldn't pass GameProfileRequestEvent to navauth 0.1.6-SNAPSHOT
java.lang.NullPointerException
        at pl.spcode.navauth.velocity.listener.velocity.LoginListeners.onGameProfile(LoginListeners.kt:176)

After that, the proxy reports:

Player ... went through preLogin event without auth session
PlayerChooseInitialServer: server tried to pick initial server ... without an auth session
OnServerConnect: player ... tried to connect without an auth session

Additional information

The player's connection is using IPv6:

[connected player] Little_Qic (/[240e:****:****:****:****:****:****:****]:46744) has connected

The exception appears to originate from IPAddress.fromInetAddress(), which currently rejects IPv6 addresses by throwing IllegalArgumentException("Only IPv4 supported").

Expected behavior

Navauth should support both IPv4 and IPv6 connections, or at least fail gracefully instead of preventing authentication and disconnecting the player.

If IPv6 is intentionally unsupported, a clear configuration option or documentation would also be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions