Bug 190425

Summary: /etc/ethers file format
Product: Red Hat Enterprise Linux 4 Reporter: Peter Riley <peter.riley>
Component: net-toolsAssignee: Radek Vokál <rvokal>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: low Docs Contact:
Priority: medium    
Version: 4.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.60-69 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-02 12:46:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Peter Riley 2006-05-02 08:11:41 UTC
Description of problem:

  Hello. I found a contradiction between two of the man
  pages included in the net-tools package while trying
  to set up my /etc/ethers file.

  "man 5 ethers" says to use this format in /etc/ethers:

       AA:BB:CC:DD:EE:FF   www.xxx.yyy.zzz

  However "man 8 arp" says to use the reverse format,
  which would be:

       www.xxx.yyy.zzz   AA:BB:CC:DD:EE:FF

  Which one is correct?

  Running the "arp -f" command definitely chokes when
  the /etc/ethers file is in the format that its own
  "man 5 ethers" page describes.

  But if using the reverse format, might something else
  break? (eg. rarpd)

  -PWR


Version-Release number of selected component (if applicable):

  RHEL 4 U3

How reproducible:

  100%

Steps to Reproduce:
1. man 5 ethers
2. man 8 arp
3. vi /etc/ethers ?!?

Comment 1 Peter Riley 2006-05-02 12:16:21 UTC
Oops.

>  Running the "arp -f" command definitely chokes when
>  the /etc/ethers file is in the format that its own
>  "man 5 ethers" page describes.

Please ignore this part; "arp -f" works well with either
format of the /etc/ethers file. Indeed, it even works when
lines of *both* formats are present together in the same
file.

I became confused because I had unwittingly introduced
extraneous whitespace on several lines in the file while
swapping columns; and unfortunately, arp complains about
extra whitespace on an otherwise blank line. For example,

  echo " " >> /etc/ethers; arp -f

will produce this error

  arp: format error on line %u of etherfile /etc/ethers !

I had mistakenly thought it errored because the columns
had been swapped.

----

Also, while looking through  net-tools-1.60-37.EL4.6.src.rpm
I came across this in arp.c:

380: /* Process an EtherFile */
381: static int arp_file(char *name)
382: {
...
408:     if (strchr (args[0], ':') != NULL) {
409:         /* We have a correct ethers file, switch hw adress and hostname
410:            for arp */
411:         char *cp;
412:         cp = args[1];
413:         args[1] = args[0];
414:         args[0] = cp;
415:     }

If the author of arp says that the "hwaddr ipaddr" order is correct,
the arp manpage must be wrong/unclear.

This bug could be closed, I think, if the ordering in the arp manpage
was switched here:

148:  The format of the file is simple; it
149:  only contains ASCII text lines with a hostname, and a hardware
150:  address separated by whitespace. Additionally the 

-PWR



Comment 2 Radek Vokál 2006-05-02 12:46:38 UTC
I've changed the man page for rawhide, not a big issue for RHEL I think. You're
right that both formats are more or less correct (eg. they are accepted by arp)