112 Commits

Author SHA1 Message Date
YueGuobin
e659b64bf0
Add async_iterable_to_stream utility to avoid aiohttp compatibility issues
Create async_iterable_to_stream() in gns3server.utils.asyncio that
converts an async iterable to an aiohttp StreamReader via a background
feeder task. This bypasses aiohttp's AsyncIterablePayload which can
cause 'Connection reset by peer' with certain HTTP servers.

Use it in _run_http_query for the __aiter__ data path.
2026-06-09 23:55:59 +08:00
Cristi
9d451eb652 feat(compute): Updated server host key to use the secure ssh-ed25519 instead of old ssh-rsa algorithm 2026-04-30 17:56:05 +03:00
Cristi
d64eca0418 feat(compute): add SSH console type support 2026-04-30 15:52:47 +03:00
grossmj
0b6f17cf8e
Add keepalive mechanism using the NOP command 2026-03-31 18:30:59 +08:00
Cristi
7f3468dcd3 Improved exception handling and telnet client disconnect 2026-03-24 15:23:00 +02:00
Cristi
83558d4d9f Enhancement: Re-write current Telnet server implementation using telnetlib3 library 2026-03-24 13:23:45 +02:00
YueGuobin
cda5fdd94b feat(telnet_server): improve error handling and connection management
- Catch OSError alongside ConnectionError in connection processing to handle more network errors
- Move client_info retrieval inside try block to prevent AttributeError on failed connections
- Replace bare except with specific exceptions (OSError, ConnectionError, asyncio.TimeoutError)
- Improve error logging to include specific exception details and client information
2026-03-15 00:19:51 +08:00
YueGuobin
e4faf673af fix(telnet): handle connection race condition during broadcast
Fixes two critical issues in telnet server when clients rapidly
   connect/disconnect during broadcast operations:

   1. **OSError [Errno 107]**: Transport endpoint not connected
      - Root cause: getpeername() called outside try block
      - Fix: Move getpeername() inside try block and catch OSError
      - Expand exception handling to include OSError and TimeoutError

   2. **KeyError**: Double deletion from connections dictionary
      - Root cause: Connection deleted in broadcast loop, then deleted
        again in top-level exception handler
      - Fix: Use dict.pop(key, None) instead of del dict[key]

   **Changes**:
   - Line 216: Add OSError to top-level exception handler
   - Line 227-228: Use pop() to avoid KeyError on double deletion
   - Line 305-316: Move getpeername() inside try block, expand
     exception types, use pop() for safe deletion

   **Impact**:
   - Prevents unhandled exceptions from propagating to asyncio event loop
   - Ensures proper resource cleanup even with race conditions
   - No resource leaks or zombie connections
   - Long-lived clients unaffected by rapid client disconnects

   **Test Script**:
   - Added stress test script to reproduce the issue
   - Supports IOU-L3, VPCS, and generic device types
   - Rapid clients send broadcast-triggering commands (show/run/OSPF)

   **Related**: Fixes bug documented in docs/bugs/telnet-server-connection-race-condition.md
2026-03-15 00:19:51 +08:00
grossmj
28e7c014c8
Enable parallel compression with zstandard. Fixes #2324 2026-02-16 18:28:11 +08:00
grossmj
aabfd08524
Merge remote-tracking branch 'origin/2.2' into 3.0
# Conflicts:
#	CHANGELOG
#	dev-requirements.txt
#	gns3server/crash_report.py
#	gns3server/version.py
#	requirements.txt
2026-02-11 17:52:14 +08:00
grossmj
abaeab6242
Upgrade greenlet and sqlalchemy dependencies 2026-01-26 19:50:42 +08:00
Iskander Nafikov
2414b7a968 Fix telnet keepalive options on macOS 2026-01-26 00:31:03 +08:00
grossmj
69a695c9e6
Merge branch '2.2' into 3.0
# Conflicts:
#	dev-requirements.txt
#	gns3server/appliances/infix.gns3a
#	gns3server/crash_report.py
#	gns3server/run.py
#	gns3server/utils/asyncio/__init__.py
#	gns3server/version.py
#	requirements.txt
#	setup.py
2026-01-24 19:27:39 +08:00
grossmj
4335fd7ce0
Drop Python 3.8 support 2026-01-24 18:51:44 +08:00
grossmj
5269d4386c
Drop Python 3.8 2024-12-30 15:36:40 +07:00
grossmj
c4fcb43e78
Merge branch '2.2' into 3.0
# Conflicts:
#	.github/workflows/testing.yml
#	CHANGELOG
#	README.md
#	dev-requirements.txt
#	gns3server/compute/docker/docker_vm.py
#	gns3server/controller/export_project.py
#	gns3server/controller/import_project.py
#	gns3server/controller/project.py
#	gns3server/crash_report.py
#	gns3server/static/web-ui/index.html
#	gns3server/static/web-ui/main.df8c319a3da6fb0e3629.js
#	gns3server/version.py
#	requirements.txt
#	setup.py
#	tests/compute/docker/test_docker_vm.py
#	tests/controller/test_import_project.py
2024-10-31 12:54:35 +10:00
grossmj
24bfc205db
Symbolic links support for project export/import 2024-10-19 15:49:23 +10:00
grossmj
800920e3df
Merge branch '2.2' into 3.0
# Conflicts:
#	.github/workflows/testing.yml
#	gns3server/compute/docker/__init__.py
#	gns3server/compute/docker/docker_vm.py
#	gns3server/run.py
#	requirements.txt
#	setup.py
#	tests/compute/docker/test_docker_vm.py
2024-02-21 12:24:30 +08:00
John Fleming
763ef24108 Address the telnet console bug. Add wait_for for drain() call. If we're stuck on drain then the buffer isn't getting emptied. 5 seconds after drain() blocks, exception will be thrown and client will be removed from connection table and will no longer be a problem. 2024-02-02 22:09:31 -05:00
grossmj
0037f31553
Merge branch '2.2' into 3.0
# Conflicts:
#	CHANGELOG
#	docs/api/notifications/link.updated.json
#	docs/api/notifications/log.warning.json
#	docs/api/v2/compute/ethernet_switch/projectsprojectidethernetswitchnodes.rst
#	docs/api/v2/compute/ethernet_switch/projectsprojectidethernetswitchnodesnodeid.rst
#	docs/api/v2/compute/iou/projectsprojectidiounodes.rst
#	docs/api/v2/compute/project/projects.rst
#	docs/api/v2/compute/qemu/projectsprojectidqemunodes.rst
#	docs/api/v2/compute/qemu/projectsprojectidqemunodesnodeid.rst
#	docs/api/v2/compute/qemu/projectsprojectidqemunodesnodeidstart.rst
#	docs/api/v2/controller/link/projectsprojectidlinks.rst
#	docs/api/v2/controller/link/projectsprojectidlinkslinkid.rst
#	docs/api/v2/controller/link/projectsprojectidlinkslinkidstartcapture.rst
#	docs/api/v2/controller/project/projects.rst
#	docs/api/v2/controller/project/projectsprojectidduplicate.rst
#	docs/controller_notifications.rst
#	docs/curl.rst
#	docs/gns3_file.json
#	docs/project_notifications.rst
#	gns3server/compute/qemu/qemu_vm.py
#	gns3server/controller/project.py
#	gns3server/crash_report.py
#	gns3server/schemas/ethernet_hub.py
#	gns3server/schemas/ethernet_switch.py
#	gns3server/static/web-ui/3rdpartylicenses.txt
#	gns3server/static/web-ui/index.html
#	gns3server/utils/asyncio/telnet_server.py
#	gns3server/version.py
#	gns3server/web/web_server.py
#	requirements.txt
#	tests/controller/test_project.py
#	tests/controller/test_topology.py
#	tests/handlers/api/controller/test_project.py
2024-01-28 12:30:43 +11:00
John Fleming
6c5f54fe57
Update telnet_server.py
Maybe use the correct object name this time for the socket objects.
2024-01-28 12:14:07 +11:00
John Fleming
082fbee1bd
Update telnet_server.py
Set tcp keepalive timers to 60 seconds. Seems to default to 2 hours on ubuntu 22. Most firewalls will age out an idle tcp session at 1 hour.

Will not address telnet console failing after a tcp session has failed (TimeoutError).
2024-01-28 12:14:07 +11:00
John Fleming
54abf85523
Update telnet_server.py
Maybe use the correct object name this time for the socket objects.
2024-01-25 01:41:57 -05:00
John Fleming
ac86717bc0
Update telnet_server.py
Set tcp keepalive timers to 60 seconds. Seems to default to 2 hours on ubuntu 22. Most firewalls will age out an idle tcp session at 1 hour.

Will not address telnet console failing after a tcp session has failed (TimeoutError).
2024-01-23 13:15:17 -05:00
grossmj
f3b6825e40 Test if busybox is not dynamically linked 2023-08-11 14:10:25 +10:00
grossmj
1ff23348d3 Merge branch '2.2' into 3.0
# Conflicts:
#	gns3server/compute/base_node.py
#	gns3server/compute/docker/__init__.py
#	gns3server/compute/qemu/qemu_vm.py
#	gns3server/controller/compute.py
#	gns3server/controller/gns3vm/virtualbox_gns3_vm.py
#	gns3server/controller/node.py
#	gns3server/controller/project.py
#	gns3server/crash_report.py
#	gns3server/handlers/api/controller/template_handler.py
#	gns3server/static/web-ui/index.html
#	gns3server/static/web-ui/main.8448c96e4facbe79a613.js
#	gns3server/version.py
#	tests/compute/iou/test_iou_vm.py
#	tests/compute/qemu/test_qemu_vm.py
#	tests/handlers/api/controller/test_template.py
2023-06-20 16:06:53 +09:30
grossmj
af2fc8c111 Use proc.communicate() when checking for subprocess output
As recommended in https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process.stderr
2023-05-14 13:58:50 +08:00
grossmj
267c4cbbbb Merge branch '2.2' into 3.0
# Conflicts:
#	README.md
#	gns3server/compute/base_node.py
#	gns3server/compute/dynamips/__init__.py
#	gns3server/compute/dynamips/hypervisor.py
#	gns3server/compute/qemu/__init__.py
#	gns3server/compute/qemu/qemu_vm.py
#	gns3server/controller/__init__.py
#	gns3server/crash_report.py
#	gns3server/handlers/api/controller/node_handler.py
#	gns3server/schemas/qemu_template.py
#	gns3server/static/web-ui/index.html
#	gns3server/static/web-ui/main.11410ae4eaf4d4c08cd0.js
#	gns3server/version.py
#	requirements.txt
2023-03-17 17:44:32 +10:00
grossmj
30c85703c8 Attempt to fix "cannot reopen console". Ref #2182 2023-02-13 19:32:44 +08:00
grossmj
a7d19fd89a Fix StreamWriter doesn't have the wait_closed() method in Python3.6. Fixes #2170 2023-01-20 13:14:57 +08:00
grossmj
c57b0cbb53 Find Dynamips version before hypervisor launch and do not require Dynamips v0.2.23 2023-01-16 18:04:46 +08:00
grossmj
27d9063e56 Merge 2.2 2023-01-05 12:38:00 +08:00
grossmj
ae200d9add Add Trusted Platform Module (TPM) support for Qemu VMs 2023-01-04 12:13:19 +08:00
grossmj
b3a6b9173b Fix reset console. Fixes #1619 2022-12-31 09:43:17 +08:00
grossmj
1148dbc48e Fix issue when calling reset_console with running VPCS and Qemu nodes. Ref #1619 2022-12-30 20:54:37 +08:00
grossmj
263febecbc Merge branch '2.2' into 3.0
# Conflicts:
#	.github/workflows/testing.yml
#	CHANGELOG
#	appveyor.yml
#	dev-requirements.txt
#	gns3server/compute/base_node.py
#	gns3server/controller/__init__.py
#	gns3server/controller/appliance_manager.py
#	gns3server/crash_report.py
#	gns3server/static/web-ui/index.html
#	gns3server/utils/get_resource.py
#	gns3server/version.py
#	gns3server/web/route.py
#	requirements.txt
#	tests/handlers/api/compute/test_qemu.py
#	win-requirements.txt
2022-11-09 20:30:28 +08:00
grossmj
f3b8f43689 Fix creating asyncio task in Python 3.6 2022-10-30 22:21:28 +08:00
grossmj
2d74d1ad94 Fix tests for Python 3.11 2022-10-30 22:07:44 +08:00
grossmj
c98a10dcfd Do not tweak zstd compression params 2022-06-03 11:26:26 +07:00
grossmj
8a964390f8 Add zstandard compression support for project export 2022-05-31 18:08:34 +07:00
grossmj
74c675d5b0 Drop Windows support 2022-01-19 22:28:36 +10:30
grossmj
afdda427d2 Merge branch 'master' into 3.0
# Conflicts:
#	.github/workflows/testing.yml
#	gns3server/compute/builtin/nodes/nat.py
#	gns3server/compute/qemu/__init__.py
#	gns3server/controller/link.py
#	gns3server/utils/asyncio/embed_shell.py
#	gns3server/utils/asyncio/raw_command_server.py
#	gns3server/utils/asyncio/telnet_server.py
#	gns3server/version.py
#	gns3server/web/web_server.py
2021-08-29 19:23:51 +09:30
grossmj
8aada49414 Some fixes for early support for Python3.10
The loop parameter has been removed from most of asyncio‘s high-level API following deprecation in Python 3.8.
2021-08-15 15:25:33 +09:30
grossmj
c021e21309 Use black with -l 120 param. 2021-04-13 18:46:50 +09:30
grossmj
f928738bd5 Use pyupgrade with --py36-plus param. 2021-04-13 18:37:58 +09:30
grossmj
af22fb8e98 Comment unused code that causes issue with flake8 2020-06-26 18:47:31 +09:30
grossmj
f498ab06b4 Wait longer for x11 socket file to be created. Ref #1761 2020-06-10 20:37:13 +09:30
grossmj
5b59a09e8d Deprecate running with Python 3.5 2020-05-19 16:14:58 +09:30
grossmj
a98fc2d308 Python3.8 support. Ref https://github.com/GNS3/gns3-gui/issues/2895 2019-11-11 12:44:31 +08:00
grossmj
6db8cecda5 Merge 2.1 into 2.2 2019-04-13 18:39:06 +07:00