Skip to content

Make command "showip" print the IP address of the NIC defined in atalkd.conf #58

@mabam

Description

@mabam

In a2server/scripts/tools/a2server-aliases the command "showip" is defined as printing the IP address of eth0. However, if you define a different NIC for AppleTalk in atalkd.conf manually, you would want "showip" to print the IP address of that one (for example, the on-board NIC of the C.H.I.P. or Banana Pi are not able to transport AppleTalk, so one needs a USB-to-Ethernet adapter which will then be recognized as eth1).

I therefore suggest to have "showip" check atalkd.conf for its NIC first and then display the IP address of that NIC:
'/sbin/ifconfig $(cat /etc/netatalk/atalkd.conf | tail -n 5 | grep "eth" | cut -d" " -f1) | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1'

Same goes for command "showmac". I suggest to change it into:
'/sbin/ifconfig $(cat /etc/netatalk/atalkd.conf | tail -n 5 | grep "eth" | cut -d" " -f1) | grep "HWaddr" | cut -dH -f2 | cut -c7-23'

Also, it seems "ifconfig" as a command can't be used anymore. Instead it needs to be used with its path: "/sbin/ifconfig". Not sure whether that's the case (and correct path) for every system.
This is an issue with the "showip", "showmac", "showip-wifi", and "showmac-wifi" commands.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions