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
parent
cd8996ecb9
commit
ba4727ccaf
2
sk.c
2
sk.c
|
@ -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
3
sk.h
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue