inex / IXP-Manager

Full stack web application powering peering at over 200 Internet Exchange Points (IXPs) globally.
https://www.ixpmanager.org/
GNU General Public License v2.0
377 stars 161 forks source link

Can not update IRRDB if only IPv6 is configured. #662

Closed YukariChiba closed 4 years ago

YukariChiba commented 4 years ago

ISSUE TYPE

Bug Report

OS

Linux Debian 10 (4.19.0-8-amd64)

VERSION
define( 'APPLICATION_VERSION', '5.6.0' );
define( 'APPLICATION_VERDATE', '2020052300' );
ENVIRONMENT
PHP 7.3.14-1~deb10u1 (cli) (built: Feb 16 2020 15:07:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.14, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.14-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies

https://gist.github.com/SteveCharlesYang/1d3d6e8f3b86150d30ef18f801957497

CONFIGURATION
APP_DEBUG=true
APP_URL="https://portal.ix42.org"
APP_TIMEZONE="UTC"
APP_LOG="single"
APP_LOG_LEVEL=debug
IXP_FE_FRONTEND_DISABLED_LOOKING_GLASS=false
IXP_RESELLER_ENABLED=false
IXP_AS112_UI_ACTIVE=false
IXP_FE_FRONTEND_DISABLED_LOGO=false
GRAPHER_BACKENDS="dummy"
GRAPHER_CACHE_ENABLED=true
GRAPHER_BACKEND_MRTG_DBTYPE="log"
GRAPHER_BACKEND_SMOKEPING_ENABLED=true
GRAPHER_BACKEND_SMOKEPING_URL="https://smokeping.ix42.org"
IXP_API_JSONEXPORTSCHEMA_PUBLIC=true
CACHE_DRIVER=file
DOCTRINE_PROXY_AUTOGENERATE=false
DOCTRINE_CACHE=file
DOCTRINE_CACHE_NAMESPACE=IXPMANAGERNAMESPACE
IXP_IRRDB_BGPQ3_PATH=/usr/bin/bgpq3
SUMMARY
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
The IRRDB update process has completed. Customer not a RS client or IRRDB filtered. Prefixes, if any, wiped from database.
There are a total of 0 IPv6 prefixes of which 0 are new and have been added; and 0 are stale and have been removed.
IMPORTANCE

If there is no IPv4 configured at the interface, IRRDB update will fail.

RELEVANT CODES

app/Tasks/Irrdb/UpdateAsnDb.php:49
app/Tasks/Irrdb/UpdatePrefixDb.php:50

if( $this->customer()->isRouteServerClient() && $this->customer()->isIrrdbFiltered() ) {

From app/Models/Customer.php:279:

public function isRouteServerClient( int $proto = 4 ): bool

A possible solution is:

if( $this->customer()->isRouteServerClient() || $this->customer()->isRouteServerClient(6) && $this->customer()->isIrrdbFiltered() ) {
barryo commented 4 years ago

Thanks @SteveCharlesYang and very close with:

if( $this->customer()->isRouteServerClient() || $this->customer()->isRouteServerClient(6) && $this->customer()->isIrrdbFiltered() ) {

In the end, I moved the proto foreach() loop up a level to achieve the same thing with better messaging.