Skip to content

Commit

Permalink
[analyzer] Open server on IPv6 when available (#158).
Browse files Browse the repository at this point in the history
This commit makes ikos-scan and ikos-view use IPv6 when available. More
specifically, it replaces uses of HTTPServer, which by default only
listens on IPv4 interfaces, with calls to a custom class HTTPServerIPv6.
The latter listens on IPv6 when available, as well as IPv4 whenever
dual-stack is supported. If IPv6 is not available, the server defaults
to the old behavior implemented by HTTPServer.
  • Loading branch information
ivanperez-keera committed Nov 27, 2023
1 parent 4514e1e commit a3b34fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions analyzer/python/ikos/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,8 @@ def __init__(self):
try:
# try to start the http server on a random port
self.port = random.randint(8000, 9000)
self.httpd = http.HTTPServer(('', self.port),
ScanServerRequestHandler)
self.httpd = http.HTTPServerIPv6(('', self.port),
ScanServerRequestHandler)
except (OSError, IOError):
self.port = None # port already in use

Expand Down
4 changes: 2 additions & 2 deletions analyzer/python/ikos/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
from ikos import settings
from ikos.enums import Result, CheckKind
from ikos.highlight import CppLexer, HtmlFormatter, highlight
from ikos.http import HTTPServer, BaseHTTPRequestHandler
from ikos.http import HTTPServerIPv6, BaseHTTPRequestHandler
from ikos.log import printf
from ikos.output_db import OutputDatabase

Expand Down Expand Up @@ -337,7 +337,7 @@ def __init__(self, db, port=8080):
self.report = ViewReport(self.db)

try:
self.httpd = HTTPServer(('', self.port), RequestHandler)
self.httpd = HTTPServerIPv6(('', self.port), RequestHandler)
except (OSError, IOError) as e:
log.error("Could not start the HTTP server: %s" % e)
sys.exit(1)
Expand Down

0 comments on commit a3b34fa

Please sign in to comment.