! ! Try to make IPv6 configuration work better: ! - convert to new rc.conf syntax. ! - make sure to prepend "inet6 " when writing user input out if not there. ! - allow "Apply" button to work hooking up the slot. ! - enable accepting RAs for SLAAC to work when on "autoconfig". ! - leave comments for future considerations. ! ! Submitted by: bz ! Sponsored by: The FreeBSD Foundation ! Sponsored by: iXsystems ! Index: src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.cpp =================================================================== --- src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.cpp (revision 10769) +++ src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.cpp (working copy) @@ -184,9 +184,22 @@ void ethernetconfig::slot_apply() if ( checkIPv6Enable->isChecked() ) { // Get rid of the ifconfig line for the ipv6 interface + // Remove old deprecated syntax as well: Utils::setConfFileValue( "/etc/rc.conf", "ipv6_ifconfig_" + DeviceName + "=", "", -1); + Utils::setConfFileValue( "/etc/rc.conf", "ifconfig_" + DeviceName + "_ipv6=", "", -1); + // Set accept_rtadv + Utils::setConfFileValue( "/etc/rc.conf", "ifconfig_" + DeviceName + "_ipv6=", "ifconfig_" + DeviceName + "_ipv6=\"inet6 accept_rtadv\"", -1); } else { - Utils::setConfFileValue( "/etc/rc.conf", "ipv6_ifconfig_" + DeviceName + "=", "ipv6_ifconfig_" + DeviceName + "=\"" + lineIPv6Address->text() + "\"", -1); + // Set static address and disbale accept_rtadv. This means someone will also have to set + // the default gateway which currently is configured form the advanced tab. This should + // move here or all should move to a dedicated IPv6 tab like "General" is IPv4ish. + if (lineIPv6Address->text() != "") { + QString tmp = lineIPv6Address->text(); + if (!tmp.contains(QRegExp("^inet6 "))) { + tmp.prepend("inet6 "); + } + Utils::setConfFileValue( "/etc/rc.conf", "ifconfig_" + DeviceName + "_ipv6=", "ifconfig_" + DeviceName + "_ipv6=\"" + tmp + " -accept_rtadv\"", -1); + } } // Check if we want to use the lagg interface @@ -231,9 +244,9 @@ void ethernetconfig::programInit() connect(checkMAC, SIGNAL(clicked()), this, SLOT(slotMacClicked()) ); connect(lineIP, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckGlobalText() ) ); connect(lineNetmask, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckGlobalText() ) ); + connect(checkIPv6Enable, SIGNAL(clicked()), this, SLOT(slotIPv6clicked() ) ); connect(lineIPv6Address, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckGlobalText() ) ); connect(lineMAC, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckGlobalText() ) ); - } void ethernetconfig::setDevice(QString Device) @@ -500,8 +513,19 @@ void ethernetconfig::slotFinishLoad() // Check for the IPv6 Configuration // Start loading the device information - tmp = Utils::getConfFileValue( "/etc/rc.conf", "ipv6_ifconfig_" + DeviceName + "=", 1 ); + tmp = Utils::getConfFileValue( "/etc/rc.conf", "ifconfig_" + DeviceName + "_ipv6=", 1 ); if ( tmp.isEmpty() ) { + // Check for backward compat. + tmp = Utils::getConfFileValue( "/etc/rc.conf", "ipv6_ifconfig_" + DeviceName + "=", 1 ); + } + if ( ! tmp.isEmpty() ) { + // remove the SLAAC default. + tmp.remove(QRegExp("inet6 ")); + tmp.remove(QRegExp("accept_rtadv")); + tmp.remove(QRegExp("^\\s*")); + tmp.remove(QRegExp("\\s*$")); + } + if ( tmp.isEmpty() ) { checkIPv6Enable->setChecked(TRUE); } else { checkIPv6Enable->setChecked(FALSE);