Skip to content

[P/D] Check wildcard address for layerwise connector - #7389

Merged
wangxiyuan merged 2 commits into
vllm-project:mainfrom
liziyu179:fix_layerwise_proxy
Mar 24, 2026
Merged

wangxiyuan merged 2 commits into
vllm-project:mainfrom
liziyu179:fix_layerwise_proxy

Conversation

@liziyu179

@liziyu179 liziyu179 commented Mar 17, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

Check wildcard address address for layerwise connector

Does this PR introduce any user-facing change?

How was this patch tested?

Signed-off-by: liziyu <liziyu16@huawei.com>
@liziyu179
liziyu179 requested a review from wangxiyuan as a code owner March 17, 2026 13:07
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the layerwise connector by explicitly disallowing the use of loopback addresses for its host configuration. This change prevents potential misconfigurations or unintended behavior when setting up the connector, ensuring it operates with valid network endpoints. The modification includes a dedicated function for loopback address detection and integrates this check into the argument parsing process.

Highlights

  • Loopback Address Validation: Introduced a new utility function, is_loopback_address, to determine if a given host string represents a loopback address (e.g., 'localhost', '0.0.0.0', '::', or IP loopback ranges).
  • Layerwise Connector Restriction: Implemented a check to prevent the use of loopback addresses for the layerwise connector's host argument, raising a ValueError if a loopback address is detected.
  • IPv6 Auto-completion Comment: Added a comment clarifying the purpose of the existing IPv6 auto-completion logic within the __init__ method of the Backend class.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • examples/disaggregated_prefill_v1/load_balance_proxy_layerwise_server_example.py
    • Added a comment explaining the IPv6 auto-completion logic.
    • Introduced a new function is_loopback_address to check for various forms of loopback addresses.
    • Integrated a validation step in parse_args to raise an error if a loopback address is provided for the layerwise connector's host.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a validation check to prevent the use of loopback or unspecified addresses for the layerwise connector host. This is achieved by adding a new function, is_loopback_address, and using it to validate the --host argument during argument parsing. My review focuses on improving the clarity and correctness of this new validation function by suggesting a rename and a more concise implementation that better utilizes the ipaddress library.

Comment on lines +259 to +275
def is_loopback_address(host):
"""Check if it is a loopback address"""
# Localhost
if host in ['localhost', 'localhost.localdomain', 'local']:
return True

# 0.0.0.0
if host in ['0.0.0.0', '::']:
return True

# Loopback address
try:
ip = ipaddress.ip_address(host)
return ip.is_loopback
except ValueError:
# If not a valid IP address, it may be a domain name, allow it to pass
return False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The function is_loopback_address incorrectly includes checks for unspecified addresses (e.g., 0.0.0.0, ::), which are distinct from loopback addresses. This makes the function name and docstring misleading. The implementation can be simplified and made more accurate by using ip.is_unspecified from the ipaddress module.

I suggest renaming the function to is_loopback_or_unspecified_address and updating its implementation for clarity and correctness. Please also update the call to this function and the corresponding error message on lines 292-293.

Suggested change
def is_loopback_address(host):
"""Check if it is a loopback address"""
# Localhost
if host in ['localhost', 'localhost.localdomain', 'local']:
return True
# 0.0.0.0
if host in ['0.0.0.0', '::']:
return True
# Loopback address
try:
ip = ipaddress.ip_address(host)
return ip.is_loopback
except ValueError:
# If not a valid IP address, it may be a domain name, allow it to pass
return False
def is_loopback_or_unspecified_address(host):
"""Check if a host is a loopback or unspecified address."""
if host in ('localhost', 'localhost.localdomain', 'local'):
return True
try:
ip = ipaddress.ip_address(host)
return ip.is_loopback or ip.is_unspecified
except ValueError:
# If not a valid IP address, it may be a domain name, allow it to pass
return False

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

@liziyu179 liziyu179 changed the title Check loopback address for layerwise connector [P/D] Check loopback address for layerwise connector Mar 18, 2026
@liziyu179
liziyu179 force-pushed the fix_layerwise_proxy branch 5 times, most recently from cf8492f to 05f7472 Compare March 20, 2026 07:13
@liziyu179 liziyu179 changed the title [P/D] Check loopback address for layerwise connector [P/D] Check wildcard address for layerwise connector Mar 20, 2026
Signed-off-by: liziyu <liziyu16@huawei.com>
@liziyu179
liziyu179 force-pushed the fix_layerwise_proxy branch from 05f7472 to 65fe230 Compare March 23, 2026 09:01
@wangxiyuan
wangxiyuan merged commit 568b6d0 into vllm-project:main Mar 24, 2026
22 checks passed
starmountain1997 pushed a commit to starmountain1997/vllm-ascend that referenced this pull request Mar 25, 2026
### What this PR does / why we need it?
Check wildcard  address address for layerwise connector

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: liziyu <liziyu16@huawei.com>
845473182 pushed a commit to 845473182/vllm-ascend that referenced this pull request Mar 25, 2026
…to qwen3next_graph

* 'main' of https://github.com/vllm-project/vllm-ascend: (94 commits)
  [bugfix] Fixed the error issue when overlaying MTP and full decode on DSV3.1 C8. (vllm-project#7571)
  [eagle3][pcp] fix acceptance rate for eagle3 and pcp enabled (vllm-project#7549)
  [bugfix][CI] fix '_OpNamespace' 'vllm' object has no attribute 'qkv_rmsnorm_rope' (vllm-project#7620)
  [Nightly] Nightly pre-build image (vllm-project#7388)
  [Bugfix]Fix deepseek 3.2 C8  precision by rotary tensor (vllm-project#7537)
  adapt to main2main for model runner v2 (vllm-project#7578)
  [Patch] Fix balance scheduling (vllm-project#7611)
  [310P]fused recurrent gated delta rule pytorch core and ut (vllm-project#7398)
  [CI] refine issue triage rules, wan regex and update stale setting (vllm-project#7531)
  [Lint]Add lint hooks for clang-format, shellcheck, forbidden imports, and boolean context manager checks (vllm-project#7511)
  [doc] add enable_sparse_c8 option in configuration options (vllm-project#7600)
  lower log level in PD Disaggregation (vllm-project#7589)
  [model_runner_v2]:optimize the performance of the _compute_slot_mappings_kernel (vllm-project#7575)
  [Feat][SP] Suport SP for VL MoE models (vllm-project#7044)
  Fix  Qwen3Next CI Config (vllm-project#7561)
  [Feat] Add npugraph_ex enablement logging (vllm-project#7574)
  [UT] Align input arguments with Ascend(Yarn)RotaryEmbedding with vLLM and add ut (vllm-project#7358)
  [P/D] Check wildcard  address for layerwise connector (vllm-project#7389)
  [P/D] [Bugfix] fix mooncake layerconnector dead when update_decoder_info fail (vllm-project#7514)
  [BugFix][P/D] fix padding error on FullGraph mode && fix layerwise connector mamba accuracy (vllm-project#7506)
  ...
lihaokun-2026 pushed a commit to lihaokun-2026/vllm-ascend that referenced this pull request Mar 29, 2026
### What this PR does / why we need it?
Check wildcard  address address for layerwise connector

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: liziyu <liziyu16@huawei.com>
chenchuw886 pushed a commit to chenchuw886/vllm-ascend that referenced this pull request Apr 1, 2026
### What this PR does / why we need it?
Check wildcard  address address for layerwise connector

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: liziyu <liziyu16@huawei.com>
yangzhe-2026 pushed a commit to yangzhe-2026/vllm-ascend that referenced this pull request May 6, 2026
### What this PR does / why we need it?
Check wildcard  address address for layerwise connector

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: liziyu <liziyu16@huawei.com>
nanxingMy pushed a commit to nanxingMy/vllm-ascend that referenced this pull request May 15, 2026
### What this PR does / why we need it?
Check wildcard  address address for layerwise connector

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: liziyu <liziyu16@huawei.com>
Signed-off-by: nanxing <1014662416@qq.com>
ader47 pushed a commit to ader47/vllm-ascend that referenced this pull request Jun 18, 2026
### What this PR does / why we need it?
Check wildcard  address address for layerwise connector

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: liziyu <liziyu16@huawei.com>
CXY-Katrina pushed a commit to CXY-Katrina/vllm-ascend that referenced this pull request Jun 27, 2026
### What this PR does / why we need it?
Check wildcard  address address for layerwise connector

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: liziyu <liziyu16@huawei.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants