fix: an IPv4 route metric of 2^31 or more makes the Linux link read fail

Open Beginner friendly
#647 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
linux, rust
Domain
networking

Research direction

Locate the Linux link reader that parses rows from /proc/net/route and the metric column it currently reads as a signed 32-bit value; the related work in #492 touches the same reader. Change that parse to u32 and add reader contract cases for a metric of 2^31 and of 2^32 − 1 alongside the existing ones. Done when those cases pass and a default route with metric 4294967295 no longer makes the link read fail.

Written by the indexing model from the issue text.

Description

bug priority: low

Found while fixing #492, and already on main.

The Linux link reader parses each /proc/net/route row's metric as a signed 32-bit number, so a default route whose IPv4 metric is 2^31 or more makes the whole link read fail. Every location rule then fails to evaluate, so the location isn't tried. That's the safe direction, but wrong: the kernel stores the metric as an unsigned 32-bit number, and ip route add default … metric 4294967295 is accepted.

Fix: parse the metric as u32, with a reader contract case for a metric of 2^31 and of 2^32 − 1.

Low priority: no network manager sets such metrics by default.

Dominant language
Rust
Stars
0
Forks
0
Avg merge
56m
Merged PRs (30d)
349

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nledford/Ladderback

All issues in nledford/Ladderback

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.