byobu-5.5: get_network_interface not working in Mac OSX

Bug #930656 reported by yegle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
byobu
Fix Released
Low
Dustin Kirkland 

Bug Description

/usr/lib/byobu/include/shutil:
get_network_interface() {
        if [ -n "$MONITORED_NETWORK" ]; then
                _RET="$MONITORED_NETWORK"
        else
        local Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
        while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do
            [ "$Mask" = "00000000" ] && break
        done < /proc/net/route
        _RET="$Iface"
    fi
}

But there's no procfs support on Mac OSX thus this doesn't work in Mac OSX.

It's better to test if the current system has procfs support by determining if there's /proc directory.

Revision history for this message
yegle (cnyegle) wrote :

btw, this bug exists on the latest 6.7 too.

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Okay, thanks for the report.

As I don't have access to a Mac OSX system, can you propose some shell code that would do the equivalent of this on Mac? I'm happy to test and special case it, but I'll need working logic for OSX.

Thanks!

Changed in byobu:
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
yegle (cnyegle) wrote :

This may works.

$ /sbin/route get default
   route to: default
destination: default
       mask: default
    gateway: 192.168.1.1
  interface: en1
      flags: <UP,GATEWAY,DONE,STATIC,PRCLONING>
 recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
       0 0 0 0 0 0 1500 0

$ /sbin/route get default|grep interface:|awk '{print $2}'
en1

Manpage of OSX's BSD style /sbin/route command: https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/route.8.html

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Thanks.

Note that you can always manually set MONITORED_NETWORK in your ~/.byobu/statusrc to MONITORED_NETWORK=en1.

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Okay, committing something like this. Please give it a test. Thanks!

Changed in byobu:
status: Incomplete → In Progress
assignee: nobody → Dustin Kirkland (kirkland)
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Committed revision 1919. Will be in byobu-5.13.

Changed in byobu:
status: In Progress → Fix Committed
Changed in byobu:
status: Fix Committed → Triaged
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.