dapphp / radius

A pure PHP RADIUS client based on SysCo/al implementation
GNU Lesser General Public License v3.0
80 stars 43 forks source link

ability to populate NAS-IPv6-Address instead of NAS-IP-Address #26

Open restena-sw opened 2 years ago

restena-sw commented 2 years ago

function Radius::setNasIpAddress() always tries to populate the NAS-IP-Address attribute, which is IPv4 only.

When invoking the lib from an IPv6 host without arguments, or the hostname as argument, this will resolve the hostname to its IPv4 address, and incorrectly create a RADIUS packet that has an IPv4 address in NAS-IP-Address, even though the request is /actually/ sent over IPv6

When invoking the lib from an IPv6 host with an explicit IPv6 address or a $_SERVER['SERVER_ADDR'] like 2001:db8::1, the function will fail because the input is neither a reswolvable hostname nor an IPv4 address.

Suggestions: