brandonmpace / routeparser

A route command output text parser
Other
2 stars 2 forks source link

Parse `src`, `linkdown` and `onlink` from `ip route` output #2

Open KOLANICH opened 2 years ago

brandonmpace commented 2 years ago

Hello,

Is this information that you would like to have accessible on a Route instance?

Do you have some examples for them? (with fake/replaced data)

KOLANICH commented 2 years ago

Is this information that you would like to have accessible on a Route instance?

Exactly this.

Do you have some examples for them?

From https://unix.stackexchange.com/questions/579087/whats-the-meaning-of-linkdown-and-online-in-linux-route

192.168.123.0/24 dev enp0s25 scope link linkdown
192.168.125.0/24 via 192.168.123.111 dev wlp3s0 onlink
192.168.126.0/24 via 192.168.123.111 dev enp0s25 onlink linkdown

From https://www.redhat.com/sysadmin/route-ip-route

192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

from https://serverfault.com/questions/1079631/interface-following-a-link

192.0.2.0/25 dev vethtest1 proto kernel scope link src 192.0.2.2 dead linkdown
KOLANICH commented 2 years ago

BTW I wonder if we should write a formal grammar instead of handcoding the parser.