mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 20:40:13 +03:00
fix(marker): reserve "global" name prefix for future marker inheritance
This commit is contained in:
parent
d3527c00de
commit
369badc6c2
@ -1093,7 +1093,7 @@ class BaseNode:
|
||||
# mark <bpf> [tag <id>] [pcap <path>] — tag/pcap keyword pairs, any order.
|
||||
# name travels from the controller REST layer (MarkerCreate schema) but is
|
||||
# validated here too as defense-in-depth against hand-edited topology files.
|
||||
_MARKER_NAME_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_.-]*$")
|
||||
_MARKER_NAME_RE = re.compile(r"^(?i)(?!global)[A-Za-z0-9][A-Za-z0-9_.-]*$")
|
||||
if not _MARKER_NAME_RE.match(name):
|
||||
raise UbridgeError(f"Invalid marker name: {name!r}")
|
||||
cmd = 'bridge add_packet_filter {bridge} {name} mark "{bpf}"'.format(
|
||||
|
||||
@ -151,9 +151,9 @@ class MarkerCreate(BaseModel):
|
||||
|
||||
name: Optional[str] = Field(
|
||||
None,
|
||||
pattern=r"^[A-Za-z0-9][A-Za-z0-9_.-]*$",
|
||||
pattern=r"^(?i)(?!global)[A-Za-z0-9][A-Za-z0-9_.-]*$",
|
||||
max_length=128,
|
||||
description="Unique marker name on the link. Auto-generated when absent.",
|
||||
description='Unique marker name on the link. Auto-generated when absent. Names starting with "global" are reserved.',
|
||||
)
|
||||
bpf: str
|
||||
tag: Optional[int] = None
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user