On Tue, Apr 12, 2016 at 12:27:10PM +0100, Stuart Henderson wrote:
> On 2016/04/12 13:00, Martin Pieuchot wrote:
> > Relying on the "scopeid" field is not a viable long-term solution. I'm
> > spending too much time these days trying to figure out which interface
> > correspond to which index.
> >
> > Here's a difference in output, then the diff itself. ok?
> >
> > @@ -1,31 +1,29 @@
> > lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
> > + index 4
> > priority: 0
> > groups: lo
> > inet6 ::1 prefixlen 128
> > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
> > inet 127.0.0.1 netmask 0xff000000
> > em0:
> > flags=18b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST,MPSAFE>
> > mtu 1500
> > - lladdr f0:de:f9:1d:88:53
> > + index 1 lladdr f0:de:f9:1d:88:53
>
> This will break scripts, e.g. "awk '/lladdr/ {print $2}'"
>
> I would expect putting it after lladdr would be better for the sort
> of scripts a user is likely to write, but bsd.rd would need a change
> if that was done, it uses sed 's/.*lladdr \(.*\)/\1/p;d'
>
> On a new line would be safer.
How about appending to the flags line, like this?
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768 index 4