Throw an error if SIOCETHTOOL returns a bad PHC index.

If the kernel supports the ioctl, but the driver does not (like igb in
kernel version 3.5), then ptp4l will incorrectly choose the system clock.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-08-22 04:43:47 +02:00
parent cd8996ecb9
commit ba4727ccaf
2 changed files with 3 additions and 2 deletions

2
sk.c
View File

@ -119,7 +119,7 @@ int sk_interface_phc(char *name, int *index)
close(fd);
*index = info.phc_index;
return 0;
return info.phc_index < 0 ? -1 : 0;
#else
return -1;
#endif

3
sk.h
View File

@ -33,7 +33,8 @@ int sk_interface_index(int fd, char *device);
/**
* Obtain the PHC device index of a network interface.
* @param name The name of the interface
* @return index The phc index associated with this iface
* @return index The non-negative phc index associated with this iface.
* On error a negative integer is returned.
*/
int sk_interface_phc(char *name, int *index);