Commit Graph
4681 Commits
Author SHA1 Message Date
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 3abecc8492 Fix IOU tests 2026-03-12 14:18:35 +08:00
grossmj 27ce1a4e25 Merge remote-tracking branch 'origin/2.2' into 3.0
# Conflicts:
#	gns3server/schemas/iou_template.py
#	tests/handlers/api/compute/test_iou.py
#	tests/handlers/api/controller/test_template.py
2026-03-12 14:11:05 +08:00
grossmj f41cc24383 Fix for duplicating Qemu nodes 2026-03-12 13:24:30 +08:00
Guobin Yue 085a485503 Merge branch '3.0' into fix/acl-endpoint-paths 2026-03-11 23:34:18 +08:00
YueGuobin f2fd725e07 fix(acl): correct endpoint paths for users, groups, and roles
Fix the path mismatch between /acl/endpoints API and actual routes:
- Users: /users/{id} → /access/users/{id}
- Groups: /groups/{id} → /access/groups/{id}
- Roles: /roles/{id} → /access/roles/{id}

This fixes the error where creating ACE entries fails with:
"Path '/groups/{id}' doesn't match any existing endpoint"

The actual routes are registered under /access/ prefix, but the
endpoints API was returning paths without the prefix.

Co-Authored-By: Yue Guobin <yueguobin@outlook.com>
2026-03-11 23:23:52 +08:00
grossmj 0624c1b945 Deactivate 'use default IOU values' by default and update RAM/NVRAM values 2026-03-10 20:28:00 +08:00
grossmj 69eafda777 Merge remote-tracking branch 'origin/2.2' into 3.0
# Conflicts:
#	gns3server/version.py
2026-03-09 17:12:24 +08:00
grossmj b658f7ff68 Make sure the node shows as stopped when the wrap console cannot be stopped. Ref https://github.com/GNS3/gns3-registry/pull/1010 2026-03-09 17:10:00 +08:00
grossmj 73ffb22aa2 Bundle web-ui v3.1.0.dev1 2026-03-07 17:47:44 +08:00
UmmmAGoodName 6ff4d46838 Fixed the path traversal check 2026-03-05 16:38:55 +01:00
grossmj 4606613673 Fix image handling 2026-03-05 12:38:28 +08:00
grossmj 8b245c96f8 Qemu VMs: only compute MD5 checksums for existing disks 2026-03-04 18:54:52 +08:00
grossmj 5b00529666 Copy config files and database from a previous version if it exists 2026-03-04 17:23:10 +08:00
grossmj 7010baccee Add enable_http_auth in gns3_server.conf sample 2026-03-04 16:35:26 +08:00
Mark Paronyan 8c3aaa78f5 feat(compute): option to disable compute authentication 2026-03-03 00:28:57 +03:00
Jeremy Grossmann dce4a71004 Merge pull request #2619 from yueguobin/fix/docker-container-name-conflict
fix(docker): handle container name conflict automatically
2026-02-28 12:56:24 +08:00
grossmj 151feb369f Development on 3.1.0.dev1 2026-02-28 11:35:46 +08:00
YueGuobin ce90b2b92c fix(docker): handle container name conflict automatically
When a Docker container with the same name already exists (e.g., from a
   previous crashed GNS3 session), Docker returns a 409 Conflict error
   when trying to create a new container with that name. This causes the
   project open operation to fail.

   This fix adds automatic cleanup of stale containers when encountering
   a name conflict:
   - Added DockerHttp409Error exception class
   - Updated http_query to detect 409 status codes
   - Modified create() to remove conflicting containers and retry

   Fixes the issue where opening a project fails with:
   "Docker has returned an error: 409 Conflict. The container name
   '/GNS3.xxx' is already in use by container 'xxx'"
2026-02-27 23:35:11 +08:00
Jeremy Grossmann a0116902a6 Merge pull request #2618 from yueguobin/fix-port-nonename-error
feat(virtualbox): add fallback for VBoxManage executable detection
2026-02-27 00:39:31 +08:00
YueGuobin a343ace637 Revert: restore original port name handling logic 2026-02-27 00:12:30 +08:00
YueGuobin fe73d0e935 Merge branch 'fix-vboxmanage-case-sensitivity' into fix-port-nonename-error 2026-02-26 10:02:43 +08:00
YueGuobin c55fd9e066 feat(virtualbox): add fallback for VBoxManage executable detection
Add an additional fallback check for the VBoxManage executable using the capitalized "VBoxManage" command name. This improves compatibility on systems where the executable may be case-sensitive or installed with a different naming convention, ensuring the VirtualBox manager can locate the necessary binary when the lowercase "vboxmanage" is not found.
2026-02-26 09:57:51 +08:00
YueGuobin cde4bdc114 feat: simplify port name assignment logic
Refactor port name assignment to use `or` operator for fallback values, improving code readability and consistency. Changes applied in `node.py` and `port_factory.py` to handle custom adapter settings more cleanly.
2026-02-25 22:41:22 +08:00
YueGuobin f6777064db feat(ports): add null checks for port name in short name generation
Add conditional checks to ensure `self._name` is not None before performing string operations in the `short_name` property. This prevents potential AttributeError exceptions when port name is undefined, improving robustness and compatibility with edge cases in port configuration.
2026-02-25 22:21:05 +08:00
grossmj 47a7324eb5 Fix tests 2026-02-25 19:00:57 +08:00
Jeremy Grossmann 4519130a8c Merge pull request #2614 from yueguobin/3.0
Implement tags for nodes and templates
2026-02-25 00:33:15 +08:00
grossmj ef7c271a9a Development on 3.0.7.dev1 2026-02-24 21:32:36 +08:00
grossmj 4d85e517b4 Development on 2.2.57.dev2 2026-02-24 21:21:03 +08:00
grossmj ddacd956b2 Merge remote-tracking branch 'yueguobin/3.0' into fork/yueguobin/3.0 2026-02-23 23:32:15 +08:00
grossmj 547e68fd2b Remove unneeded rbac_repo in get_templates 2026-02-23 23:31:35 +08:00
Jeremy Grossmann 11e36cb32c Merge branch '3.0' into 3.0 2026-02-23 23:28:47 +08:00
grossmj a9525503c6 Set up database schema migration 2026-02-23 23:27:10 +08:00
grossmj bdcb6445c7 Use lists for tags instead of dicts 2026-02-23 23:26:42 +08:00
grossmj c66e851498 Fix for resizing Qemu VM disks 2026-02-23 17:10:15 +08:00
Guobin Yue 66f32cecf2 Merge branch 'GNS3:3.0' into 3.0 2026-02-23 01:37:05 +08:00
YueGuobin c05f667f3d feat(templates): safely access settings dict keys
Use dict.get() method to safely access 'image' and 'path' keys in settings dictionary to avoid KeyError exceptions when these keys are missing. This improves error handling and prevents server crashes when creating templates with incomplete settings.
2026-02-23 01:02:32 +08:00
YueGuobin e27ddf2cdf feat(api): fix ETag handling and JSON serialization in template endpoint
- Use `default=str` in `json.dumps` to handle non-serializable objects
- Return proper HTTP 304 response with ETag header instead of raising exception
- Ensure consistent ETag generation for template caching
2026-02-22 23:43:47 +08:00
YueGuobin a3616e6d33 feat(api): add tag filtering to nodes and templates endpoints
- Add optional `tags` query parameter to `/nodes` and `/templates` endpoints
- Support filtering by tags in format "key:value" with multiple tags ANDed together
- Example: `?tags=vendor:cisco&tags=model:7200` filters nodes/templates with both tags
- Maintain backward compatibility for existing API usage without tags parameter
2026-02-22 22:52:28 +08:00
grossmj be4b87e8cd Update project schema and fix tests 2026-02-22 18:13:08 +08:00
Felix Schulz 8ab34924b5 Add 'created_by' field to track project creator 2026-02-21 22:15:21 +01:00
grossmj 5e3ca29c58 Fix updating packet filters 2026-02-21 21:42:22 +08:00
grossmj 60abbade27 Revert merged changes from 2.2 introduced by PR #2607 2026-02-21 21:35:12 +08:00
YueGuobinandClaude Sonnet 4.5 56ece7ce88 Add vendor, model and netmiko_device_type fields to templates
Add three new optional fields to the template schema:
- vendor: Device vendor (e.g., Cisco, Juniper, Huawei)
- model: Device model (e.g., ISR4451-X, MX204, NE40E)
- netmiko_device_type: Netmiko device type for automation (e.g., cisco_ios, juniper_junos, huawei)

These fields enable AI/LLM integration to determine the appropriate
Netmiko device type when automating network device configuration.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-20 23:38:00 +08:00
grossmj c5b9f379fe Merge remote-tracking branch 'origin/2.2' into 3.0
# Conflicts:
#	Dockerfile
#	dev-requirements.txt
#	gns3server/compute/qemu/qemu_vm.py
#	gns3server/version.py
#	requirements.txt
2026-02-20 16:28:53 +08:00
grossmj 47cc827c1f Remove some files not related to PR 2026-02-20 15:56:08 +08:00
Jeremy Grossmann bc1729b255 Merge branch '2.2' into fix/busybox-musl-ldd-check 2026-02-20 15:24:54 +08:00
Dale Arbogast 279f05a14a fix: handle RuntimeError in notification_manager emit()
asyncio.get_running_loop() raises RuntimeError when emit() is called
from a thread without an active event loop (e.g. when the disk space
check in project_manager triggers a log.warning notification from a
threadpool worker).

This causes a 500 Internal Server Error on project creation/open when
disk usage is high, instead of the intended warning notification.

Wrap the emit loop in try/except RuntimeError so that notifications
are silently dropped when no event loop is available, rather than
crashing the request.

Fixes #2502
Fixes #2505
2026-02-19 16:49:50 -05:00
Dale Arbogast 3dd4184193 fix: busybox static link detection on Alpine/musl
On musl-based systems (Alpine), ldd returns exit code 0 for static
binaries, unlike glibc which returns 1. This causes install_busybox()
to reject all busybox binaries as "dynamically linked" on Alpine.

Fix by also accepting binaries whose executable name contains "static"
(i.e. busybox-static, busybox.static), which are the first two
candidates checked by the function. The generic "busybox" fallback
still relies on the ldd return code check.
2026-02-19 16:44:01 -05:00
grossmj 013ec341b3 Fix tests 2026-02-16 19:32:47 +08:00