server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: RuntimeException: Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".

Open tessus opened this issue 2 years ago • 8 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a bug, not a question or a configuration/webserver/proxy issue.
  • [X] This issue is not already reported on Github (I've searched it).
  • [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • [X] Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • [X] I agree to follow Nextcloud's Code of Conduct.

Bug description

The update server could not be reached since 3 days to check for new updates. Please check the Nextcloud and server log files for errors.

{
  "reqId": "NCNhjvyso8guXr9TQyzs",
  "level": 2,
  "time": "2022-08-16T18:32:01+02:00",
  "remoteAddr": "XX.XX.XX.XX",
  "user": "xxxx",
  "app": "appstoreFetcher",
  "method": "GET",
  "url": "/apps/serverinfo/update",
  "message": "Unable to check Ipv6. Check that PHP was not compiled with option \"disable-ipv6\".",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:103.0) Gecko/20100101 Firefox/103.0",
  "version": "23.0.8.1",
  "exception": {
    "Exception": "RuntimeException",
    "Message": "Unable to check Ipv6. Check that PHP was not compiled with option \"disable-ipv6\".",
    "Code": 0,
    "Trace": [
      {
        "file": "/data/projects/nextcloud/lib/private/Http/IpUtils.php",
        "line": 45,
        "function": "checkIp6",
        "class": "OC\\Http\\IpUtils",
        "type": "::",
        "args": [
          "2a01:4f8:130:32f1::53",
          "100.64.0.0/10"
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/Http/Client/LocalAddressChecker.php",
        "line": 49,
        "function": "checkIp",
        "class": "OC\\Http\\IpUtils",
        "type": "::",
        "args": [
          "2a01:4f8:130:32f1::53",
          [
            "100.64.0.0/10",
            "192.0.0.0/24"
          ]
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php",
        "line": 136,
        "function": "ThrowIfLocalIp",
        "class": "OC\\Http\\Client\\LocalAddressChecker",
        "type": "->",
        "args": [
          "2a01:4f8:130:32f1::53"
        ]
      },
      {
        "file": "/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php",
        "line": 35,
        "function": "OC\\Http\\Client\\{closure}",
        "class": "OC\\Http\\Client\\DnsPinMiddleware",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php",
        "line": 31,
        "function": "__invoke",
        "class": "GuzzleHttp\\PrepareBodyMiddleware",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php",
        "line": 71,
        "function": "GuzzleHttp\\{closure}",
        "class": "GuzzleHttp\\Middleware",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php",
        "line": 63,
        "function": "__invoke",
        "class": "GuzzleHttp\\RedirectMiddleware",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php",
        "line": 75,
        "function": "GuzzleHttp\\{closure}",
        "class": "GuzzleHttp\\Middleware",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php",
        "line": 331,
        "function": "__invoke",
        "class": "GuzzleHttp\\HandlerStack",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php",
        "line": 168,
        "function": "transfer",
        "class": "GuzzleHttp\\Client",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php",
        "line": 187,
        "function": "requestAsync",
        "class": "GuzzleHttp\\Client",
        "type": "->",
        "args": [
          "get",
          {
            "__class__": "GuzzleHttp\\Psr7\\Uri"
          },
          [
            "/data/projects/nextcloud/resources/config/ca-bundle.crt",
            60,
            [
              {
                "__class__": "Closure"
              }
            ],
            [
              false
            ],
            true,
            {
              "__class__": "GuzzleHttp\\HandlerStack"
            },
            true,
            true,
            false,
            false,
            [
              "GuzzleHttp/7"
            ]
          ]
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/Http/Client/Client.php",
        "line": 223,
        "function": "request",
        "class": "GuzzleHttp\\Client",
        "type": "->",
        "args": [
          "get",
          "https://apps.nextcloud.com/api/v1/apps.json",
          [
            "/data/projects/nextcloud/resources/config/ca-bundle.crt",
            60,
            [
              {
                "__class__": "Closure"
              }
            ],
            [
              false
            ],
            [
              "Nextcloud Server Crawler",
              "gzip"
            ],
            true
          ]
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php",
        "line": 120,
        "function": "get",
        "class": "OC\\Http\\Client\\Client",
        "type": "->",
        "args": [
          "https://apps.nextcloud.com/api/v1/apps.json",
          [
            60
          ]
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php",
        "line": 87,
        "function": "fetch",
        "class": "OC\\App\\AppStore\\Fetcher\\Fetcher",
        "type": "->",
        "args": [
          "",
          ""
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php",
        "line": 192,
        "function": "fetch",
        "class": "OC\\App\\AppStore\\Fetcher\\AppFetcher",
        "type": "->",
        "args": [
          "",
          "",
          false
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php",
        "line": 186,
        "function": "get",
        "class": "OC\\App\\AppStore\\Fetcher\\Fetcher",
        "type": "->",
        "args": [
          false
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/Installer.php",
        "line": 433,
        "function": "get",
        "class": "OC\\App\\AppStore\\Fetcher\\AppFetcher",
        "type": "->",
        "args": [
          false
        ]
      },
      {
        "file": "/data/projects/nextcloud/apps/serverinfo/lib/SystemStatistics.php",
        "line": 181,
        "function": "isUpdateAvailable",
        "class": "OC\\Installer",
        "type": "->",
        "args": [
          "accessibility"
        ]
      },
      {
        "file": "/data/projects/nextcloud/apps/serverinfo/lib/SystemStatistics.php",
        "line": 90,
        "function": "getAppsInfo",
        "class": "OCA\\ServerInfo\\SystemStatistics",
        "type": "->",
        "args": []
      },
      {
        "file": "/data/projects/nextcloud/apps/serverinfo/lib/Controller/PageController.php",
        "line": 60,
        "function": "getSystemStatistics",
        "class": "OCA\\ServerInfo\\SystemStatistics",
        "type": "->",
        "args": []
      },
      {
        "file": "/data/projects/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 217,
        "function": "update",
        "class": "OCA\\ServerInfo\\Controller\\PageController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 126,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\ServerInfo\\Controller\\PageController"
          },
          "update"
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/AppFramework/App.php",
        "line": 157,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\ServerInfo\\Controller\\PageController"
          },
          "update"
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\ServerInfo\\Controller\\PageController",
          "update",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          [
            "serverinfo.page.update"
          ]
        ]
      },
      {
        "file": "/data/projects/nextcloud/lib/base.php",
        "line": 1008,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/serverinfo/update"
        ]
      },
      {
        "file": "/data/projects/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/data/projects/nextcloud/lib/private/Http/IpUtils.php",
    "Line": 116,
    "CustomMessage": "Unable to check Ipv6. Check that PHP was not compiled with option \"disable-ipv6\"."
  },
  "id": "62fbc681e3834"
}

My server has IPv6 completely disabled and thus PHP was also compiled with disable-ipv6. This issue only became apparent after the lat update from 23.0.7 to 23.0.8.

It makes no sense to force people to setup IPv6 or compile IPv6 into PHP when IPv6 is not used at all.

Steps to reproduce

  1. Go to Settings -> Overview
  2. or wait a few days
  3. check log file

Expected behavior

Nestcloud should ignore IPv6 if it is not used and just use IPv4 instead and not throw an error that IPv6 support is not installed.

Installation method

Other

Operating system

Other

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

Updated from a minor version (ex. 22.2.3 to 22.2.4)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • [X] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "23.0.8.1",
        "installed": true,
        "forcessl": true,
        "loglevel": 0,
        "maintenance": false,
        "trusted_domains": [
            "xx.xx.xx"
        ],
        "share_folder": "\/Shared",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logdateformat": "Y-m-d H:i:s O",
        "logtimezone": "Europe\/Vienna",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "sendmail",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "appstore.experimental.enabled": true,
        "trashbin_retention_obligation": "auto",
        "updater.release.channel": "stable",
        "htaccess.RewriteBase": "\/",
        "overwrite.cli.url": "https:\/\/xxx.xxx.xxx",
        "auth.bruteforce.protection.enabled": false,
        "simpleSignUpLink.shown": false,
        "upgrade.disable-web": true,
        "theme": "evermeet",
        "mail_smtpauthtype": "PLAIN",
        "mail_smtpauth": 1,
        "mail_sendmailmode": "smtp",
        "filesystem_check_changes": 0,
        "mysql.utf8mb4": true,
        "connectivity_check_domains": [
            "xx.xx"
        ],
        "default_phone_region": "CA",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***"
    }
}


### List of activated Apps

```shell
Enabled:
  - accessibility: 1.9.0
  - activity: 2.15.0
  - admin_audit: 1.13.0
  - announcementcenter: 6.3.1
  - apporder: 0.15.0
  - bookmarks: 11.0.1
  - bruteforcesettings: 2.4.0
  - calendar: 3.4.2
  - circles: 23.1.2
  - cloud_federation_api: 1.6.0
  - comments: 1.13.0
  - contacts: 4.2.0
  - contactsinteraction: 1.4.0
  - dav: 1.21.0
  - federatedfilesharing: 1.13.0
  - federation: 1.13.0
  - files: 1.18.0
  - files_external: 1.15.0
  - files_pdfviewer: 2.4.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - files_videoplayer: 1.12.0
  - firstrunwizard: 2.12.0
  - impersonate: 1.10.0
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - nextcloud_announcements: 1.12.0
  - notes: 4.4.0
  - notifications: 2.11.1
  - notify_push: 0.4.0
  - oauth2: 1.11.0
  - password_policy: 1.13.0
  - phonetrack: 0.7.0
  - photos: 1.5.0
  - polls: 3.7.0
  - privacy: 1.7.0
  - provisioning_api: 1.13.0
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - sharebymail: 1.13.0
  - systemtags: 1.13.0
  - tasks: 0.14.4
  - text: 3.4.1
  - theming: 1.14.0
  - twofactor_backupcodes: 1.12.0
  - twofactor_totp: 6.4.0
  - updatenotification: 1.13.0
  - viewer: 1.7.0
  - weather_status: 1.3.0
  - workflowengine: 2.5.0
Disabled:
  - activitylog: 0.0.2
  - dashboard: 7.0.0
  - encryption
  - files_markdown: 2.3.6
  - recommendations: 0.5.0
  - support: 1.4.0
  - survey_client: 0.1.5
  - twofactor_u2f: 6.3.1
  - user_ldap
  - user_status: 1.0.1


### Nextcloud Signing status

```shell
No errors have been found.

Nextcloud Logs

{"reqId":"NCNhjvyso8guXr9TQyzs","level":2,"time":"2022-08-16T18:32:01+02:00","remoteAddr":"XX.XX.XX.XX","user":"xxxx","app":"appstoreFetcher","method":"GET","url":"/apps/serverinfo/update","message":"Unable to check Ipv6. Check that PHP was not compiled with option \"disable-ipv6\".","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:103.0) Gecko/20100101 Firefox/103.0","version":"23.0.8.1","exception":{"Exception":"RuntimeException","Message":"Unable to check Ipv6. Check that PHP was not compiled with option \"disable-ipv6\".","Code":0,"Trace":[{"file":"/data/projects/nextcloud/lib/private/Http/IpUtils.php","line":45,"function":"checkIp6","class":"OC\\Http\\IpUtils","type":"::","args":["2a01:4f8:130:32f1::53","100.64.0.0/10"]},{"file":"/data/projects/nextcloud/lib/private/Http/Client/LocalAddressChecker.php","line":49,"function":"checkIp","class":"OC\\Http\\IpUtils","type":"::","args":["2a01:4f8:130:32f1::53",["100.64.0.0/10","192.0.0.0/24"]]},{"file":"/data/projects/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php","line":136,"function":"ThrowIfLocalIp","class":"OC\\Http\\Client\\LocalAddressChecker","type":"->","args":["2a01:4f8:130:32f1::53"]},{"file":"/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php","line":35,"function":"OC\\Http\\Client\\{closure}","class":"OC\\Http\\Client\\DnsPinMiddleware","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":31,"function":"__invoke","class":"GuzzleHttp\\PrepareBodyMiddleware","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php","line":71,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":63,"function":"__invoke","class":"GuzzleHttp\\RedirectMiddleware","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php","line":75,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php","line":331,"function":"__invoke","class":"GuzzleHttp\\HandlerStack","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php","line":168,"function":"transfer","class":"GuzzleHttp\\Client","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/data/projects/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php","line":187,"function":"requestAsync","class":"GuzzleHttp\\Client","type":"->","args":["get",{"__class__":"GuzzleHttp\\Psr7\\Uri"},["/data/projects/nextcloud/resources/config/ca-bundle.crt",60,[{"__class__":"Closure"}],[false],true,{"__class__":"GuzzleHttp\\HandlerStack"},true,true,false,false,["GuzzleHttp/7"]]]},{"file":"/data/projects/nextcloud/lib/private/Http/Client/Client.php","line":223,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["get","https://apps.nextcloud.com/api/v1/apps.json",["/data/projects/nextcloud/resources/config/ca-bundle.crt",60,[{"__class__":"Closure"}],[false],["Nextcloud Server Crawler","gzip"],true]]},{"file":"/data/projects/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php","line":120,"function":"get","class":"OC\\Http\\Client\\Client","type":"->","args":["https://apps.nextcloud.com/api/v1/apps.json",[60]]},{"file":"/data/projects/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php","line":87,"function":"fetch","class":"OC\\App\\AppStore\\Fetcher\\Fetcher","type":"->","args":["",""]},{"file":"/data/projects/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php","line":192,"function":"fetch","class":"OC\\App\\AppStore\\Fetcher\\AppFetcher","type":"->","args":["","",false]},{"file":"/data/projects/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php","line":186,"function":"get","class":"OC\\App\\AppStore\\Fetcher\\Fetcher","type":"->","args":[false]},{"file":"/data/projects/nextcloud/lib/private/Installer.php","line":433,"function":"get","class":"OC\\App\\AppStore\\Fetcher\\AppFetcher","type":"->","args":[false]},{"file":"/data/projects/nextcloud/apps/serverinfo/lib/SystemStatistics.php","line":181,"function":"isUpdateAvailable","class":"OC\\Installer","type":"->","args":["accessibility"]},{"file":"/data/projects/nextcloud/apps/serverinfo/lib/SystemStatistics.php","line":90,"function":"getAppsInfo","class":"OCA\\ServerInfo\\SystemStatistics","type":"->","args":[]},{"file":"/data/projects/nextcloud/apps/serverinfo/lib/Controller/PageController.php","line":60,"function":"getSystemStatistics","class":"OCA\\ServerInfo\\SystemStatistics","type":"->","args":[]},{"file":"/data/projects/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"update","class":"OCA\\ServerInfo\\Controller\\PageController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/data/projects/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\ServerInfo\\Controller\\PageController"},"update"]},{"file":"/data/projects/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\ServerInfo\\Controller\\PageController"},"update"]},{"file":"/data/projects/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\ServerInfo\\Controller\\PageController","update",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},["serverinfo.page.update"]]},{"file":"/data/projects/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/serverinfo/update"]},{"file":"/data/projects/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/data/projects/nextcloud/lib/private/Http/IpUtils.php","Line":116,"CustomMessage":"Unable to check Ipv6. Check that PHP was not compiled with option \"disable-ipv6\"."},"id":"62fbc681e3834"}

Additional info

I always update via the updater.phar on the cli. No optio for that in this template...

tessus avatar Aug 16 '22 16:08 tessus

Thanks for reporting :+1:

I guess we need to wrap the checkIp calls with try-catch: https://github.com/nextcloud/server/blob/c5ffd7ce32a74c06dddd55652edea5c896ee9b3d/lib/private/Http/Client/LocalAddressChecker.php

kesselb avatar Aug 17 '22 10:08 kesselb

You are welcome. However, I am not sure whether the current tests are valid in the first place. You check only domain names for IPv6, not if IPv6 is actually able to reach an IPv6 host on the Internet.

e.g. I know several people and also companies that use IPv6 internally (and do not use any of the domain names you are testing for), but do have only a IPv4 gateway to reach the Internet for accessing IPv4 addresses. I also know of situations where an IPv6 address is assigned to the same interface that is using IPv4, but has no connectivity at all (the IPv6 address).

tessus avatar Aug 17 '22 12:08 tessus

Additionally, I am not sure what this code is supposed to do?

Are you trying to find local link addresses? In that case https://github.com/nextcloud/server/blob/c5ffd7ce32a74c06dddd55652edea5c896ee9b3d/lib/private/Http/Client/LocalAddressChecker.php#L40-L43 is wrong. Someone did not understand the referenced RFC. You should read RFC3927 instead.

tessus avatar Aug 28 '22 12:08 tessus

I am not sure what this code is supposed to do?

https://github.com/nextcloud/server/pull/33031

The patch improve the detection of local ip addresses.

kesselb avatar Aug 29 '22 12:08 kesselb

The description in the PR has no useful information.

If you are looking for a private IP range, it is wrong. 192.168.0.0/16 is a correct private C-class net. If you are looking for a link local address, the range is wrong. 169.254.0.0/16 is a link local IPv4 address range.

The code uses the term "local" IP address. What does that mean? Unfortunately it can mean a lot. It can be the IP address of your computer if it is behind a public facing IP. A link local address is an address the OS assigns, if there's no DHCP server, nor a static address is set.

Either way, I believe this needs a bit more explanation what the dev of that code intended.

tessus avatar Aug 29 '22 12:08 tessus

I also encounter this issue and get "Update server couldn't be reached for X days" notifications.

When I insert

public static function checkIp6(string $requestIp, string $ip) {
                $cacheKey = $requestIp.'-'.$ip;
                if (isset(self::$checkedIps[$cacheKey])) {
                        return self::$checkedIps[$cacheKey];
                }

+                return self::$checkedIps[$cacheKey] = false;

                if (!((\extension_loaded('sockets') && \defined('AF_INET6')) || @inet_pton('::1'))) {
                        throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".');
                }

in lib/private/Http/IpUtils.php everything works as expected.

IMO nextcloud should conservatively fall back to IPv4 in case IPv6 detection fails instead of aborting with the Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6" exception. Obviously this message implies missing IPv6 support, which should resemble the actual test result of checkIp6().

EDIT: Bug is still present in v24.0.5

heeplr avatar Aug 31 '22 06:08 heeplr

Hey,

https://github.com/nextcloud/server/pull/33031 was related to a security report. The report is disclosed now https://hackerone.com/reports/1608039. That should give you some background information why the check is here.

I assume the actual error / missing piece is somewhere else.

2a01:4f8:130:32f1::53 belongs to apps.nextcloud.com. If IPv6 is not available on the system we should probably not query an IPv6 address at all.

https://github.com/nextcloud/server/blob/c5ffd7ce32a74c06dddd55652edea5c896ee9b3d/lib/private/Http/Client/DnsPinMiddleware.php#L77

A solution could be to copy the check from checkIp6 and pass it to DnsPinMiddleware via constructor and adjust the above lines to only fetch ipv6 if enabled. However not everyone without IPv6 compiles php without IPv6 support. An additional configuration option is probably the better choice.

kesselb avatar Sep 19 '22 09:09 kesselb

Thanks a bunch for the explanation.

I just want to say that disabling ipv6 on the OS level and/or not compiling ipv6 support into PHP is not that uncommon. The reason is that sometimes even though IPv6 is not configured and used, SW still tries to initialize it, setup an address, and/or use it. It generates unnecessary overhead and often many warnings, even though everything is fine and correctly setup.

tessus avatar Sep 19 '22 19:09 tessus

In 25.0.0 the Exception moved but it's still there:

[internet_connection_check] Fehler: RuntimeException: Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6". at <<closure>>

 0. /var/www/hosts/cloud/htdocs/3rdparty/symfony/http-foundation/IpUtils.php line 52
    Symfony\Component\HttpFoundation\IpUtils::checkIp6()
 1. /var/www/hosts/cloud/htdocs/lib/private/Http/Client/LocalAddressChecker.php line 66
    Symfony\Component\HttpFoundation\IpUtils::checkIp()
 2. /var/www/hosts/cloud/htdocs/lib/private/Http/Client/DnsPinMiddleware.php line 136
    OC\Http\Client\LocalAddressChecker->ThrowIfLocalIp()
 3. /var/www/hosts/cloud/htdocs/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php line 35
    OC\Http\Client\DnsPinMiddleware->OC\Http\Client\{closure}("*** sensitive parameters replaced ***")
 4. /var/www/hosts/cloud/htdocs/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 31
    GuzzleHttp\PrepareBodyMiddleware->__invoke()
 5. /var/www/hosts/cloud/htdocs/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php line 71
    GuzzleHttp\Middleware::GuzzleHttp\{closure}("*** sensitive parameters replaced ***")
 6. /var/www/hosts/cloud/htdocs/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 63
    GuzzleHttp\RedirectMiddleware->__invoke()
 7. /var/www/hosts/cloud/htdocs/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php line 75
    GuzzleHttp\Middleware::GuzzleHttp\{closure}("*** sensitive parameters replaced ***")
 8. /var/www/hosts/cloud/htdocs/3rdparty/guzzlehttp/guzzle/src/Client.php line 331
    GuzzleHttp\HandlerStack->__invoke()
 9. /var/www/hosts/cloud/htdocs/3rdparty/guzzlehttp/guzzle/src/Client.php line 168
    GuzzleHttp\Client->transfer()
10. /var/www/hosts/cloud/htdocs/3rdparty/guzzlehttp/guzzle/src/Client.php line 187
    GuzzleHttp\Client->requestAsync()
11. /var/www/hosts/cloud/htdocs/lib/private/Http/Client/Client.php line 218
    GuzzleHttp\Client->request()
12. /var/www/hosts/cloud/htdocs/apps/settings/lib/Controller/CheckSetupController.php line 211
    OC\Http\Client\Client->get()
13. /var/www/hosts/cloud/htdocs/apps/settings/lib/Controller/CheckSetupController.php line 193
    OCA\Settings\Controller\CheckSetupController->isSiteReachable()
14. /var/www/hosts/cloud/htdocs/apps/settings/lib/Controller/CheckSetupController.php line 868
    OCA\Settings\Controller\CheckSetupController->hasInternetConnectivityProblems()
15. /var/www/hosts/cloud/htdocs/lib/private/AppFramework/Http/Dispatcher.php line 225
    OCA\Settings\Controller\CheckSetupController->check()
16. /var/www/hosts/cloud/htdocs/lib/private/AppFramework/Http/Dispatcher.php line 133
    OC\AppFramework\Http\Dispatcher->executeController()
17. /var/www/hosts/cloud/htdocs/lib/private/AppFramework/App.php line 172
    OC\AppFramework\Http\Dispatcher->dispatch()
18. /var/www/hosts/cloud/htdocs/lib/private/Route/Router.php line 298
    OC\AppFramework\App::main()
19. /var/www/hosts/cloud/htdocs/lib/base.php line 1047
    OC\Route\Router->match()
20. /var/www/hosts/cloud/htdocs/index.php line 36
    OC::handleRequest()

heeplr avatar Oct 29 '22 01:10 heeplr

Problem still persists in 25.0.1

Does anyone maybe have a better workaround than patching the source directly for not missing updates?

heeplr avatar Nov 26 '22 11:11 heeplr

Problem still exists in 25.0,2.

Like tessus, my host does not have IPv6 enabled (in de kernel / network stack). I have enabled IPv6 in PHP only to work around this issue and that works great. I can get updates and see the appstore again.

theerijn avatar Jan 18 '23 21:01 theerijn

Also my host does not have IPv6 enabled and my last running version is 24.0.3. Upgrading to any newer version leads to the problem described above. Unfortunately my technical knowledge is very limited to help, but does anybody know will there be version with the IPv6 issue fixed In the near future?

Stift1 avatar Feb 02 '23 09:02 Stift1

Use your package manager to upgrade Nextcloud to a version that's not affected. Once Nextcloud is at a version that has this bug fixed, you will be able to update the individual apps. Until then, you will not get notifications like "Update available for application X"

theerijn avatar Feb 03 '23 21:02 theerijn

@theerijn Downgrading nextcloud is not supported. Also this assumes, that it will be fixed before 26.x.x release since skipping major versions also isn't supported.

I'm patching the source manually for now but I hope this will be adressed soon since it's a major brickwall. Fingers crossed.

heeplr avatar Feb 03 '23 21:02 heeplr

Issue still present in 25.0.4

ehirt avatar Mar 03 '23 15:03 ehirt

Issue still present in 26.0.0.

As as side note, I'd like to suggest adding this check to the "Security & Setup Warnings" procedure.

It's not optimal to get a notification "The update server can't be reached" after three days. IMHO, it should come instantly as a warning like all other post-upgrade/setup warnings.

heeplr avatar Mar 25 '23 10:03 heeplr

Does anybody know, is this issue still present or fixed in the latest versions? Thanks

Stift1 avatar May 08 '23 08:05 Stift1

@Stift1 Just checked. Still persists in 26.0.1

(Had to wait since you don't know immediately after the update when it doesn't work. Nextcloud gives a notification "Update server couldn't be reached in 3 days")

heeplr avatar May 16 '23 07:05 heeplr

Still persists in 26.0.5, thank you @heeplr for the ugly, but efficient workaround.

canoine avatar Aug 28 '23 17:08 canoine

Still persists in 27.0.2, and I suppose 27.1.x versions are in the same state.

canoine avatar Oct 18 '23 06:10 canoine

Still persists in 27.0.2, and I suppose 27.1.x versions are in the same state.

The issue is still open, and therefore it's not a big surprise, right? Please refrain from further "still persists" comments as it creates unnecessary notifications.

kesselb avatar Oct 18 '23 09:10 kesselb

"unnecessary" ? Well... All the Nextcloud instances admins, who get regularly such "unnecessary" notifications because of this bug, might disagree, I guess.

I know that we all have only 24 hours a day, that most of the devs are volunteers, and this bug is not really so important, and so on. I understand, and I respect that. That said, this bug is open for more than one year, and seems rather easy to fix, AFAIK.

canoine avatar Oct 18 '23 11:10 canoine

I agree with @canoine: it’s pretty annoying… not the notification, but the delay in fixing such a little but persistent bug! :)

andrewhotlab avatar Oct 18 '23 11:10 andrewhotlab

Fixed with Nextcloud 29

kesselb avatar Mar 27 '24 16:03 kesselb