[utils.inc] [is_linklocal()] Invalid LL recognition code



  • Hi,

    While working on correct dynamic gateway creation algo I've noticed the subject function which is implemented as:

    return (strtolower(substr($ipaddr, 0, 5)) == "fe80:");
    

    I believe this code will fail to recognise LL address in some cases because LL scope has a /10 prefix … so even "fe81:" is a correct LL address will be counted as invalid.

    After some research I've noticed that this code affects the following functions in case of [FE81..FEBF] LL addresses:
    [interfaces.inc] interface_configure() - Will remove all valid LL addresses on all interfaces;
    [interfaces.inc] find_interface_ipv6_ll() - Will never find first LL address on the interface;
    [services.inc] services_dnsmasq_configure() - dnsmasq will be unable to bind on valid LL address;
    [system.inc] system_routing_configure() - Routing will not be properly configured because scope won't be added if LL address is not FE80;
    [gwlb.inc] setup_gateways_monitor() - Gateway monitors will not be properly configured if LL address is not FE80;

    I will post a pull request soon with fix for the subject along with some fixes for dynamic gateways, but I think this fix should be merged to 2.1 branch too. Yeah, this bug is not that sensitive but you never know what can\could\will happen  :)


Log in to reply