Skip to content

Commit 4e87843

Browse files
adamgeorge309claude
andcommitted
visualizer: suppress interface netmask length when address is unspecified
The InterfaceTableVisualizer default format "%N %\%a%/%l" guards the slash directive (%/) on the network address being specified, but %l printed the IPv4 netmask length unconditionally. Any interface with an unspecified address carries the all-ones default netmask, so its label rendered as "<unspec>32" -- an orphaned length with no real subnet behind it. Guard %l the same way %/ is guarded: return "" when the IPv4 address is unspecified. Labels now read "<unspec>" instead of "<unspec>32", and "192.168.0.10/24" once an address is assigned. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ffeeb22 commit 4e87843

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/inet/visualizer/base/InterfaceTableVisualizerBase.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ std::string InterfaceTableVisualizerBase::DirectiveResolver::resolveDirective(ch
4242
case 'l': // TODO Ipv4 or Ipv6
4343
#ifdef INET_WITH_IPv4
4444
if (auto ipv4Data = networkInterface->findProtocolData<Ipv4InterfaceData>())
45-
return std::to_string(ipv4Data->getNetmask().getNetmaskLength());
45+
return ipv4Data->getIPAddress().isUnspecified() ? "" : std::to_string(ipv4Data->getNetmask().getNetmaskLength());
4646
#endif // INET_WITH_IPv4
4747
return "";
4848
case '4':

0 commit comments

Comments
 (0)