diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-10-20 15:01:26 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-10-20 15:01:26 +0000 |
commit | ee8b3e0af473a1efa48e5e8a009dde0baef50d9f (patch) | |
tree | 50538097b8de331568ac99bf4fa39d66e50c7457 | |
parent | 487be35e43119368f3078e59b86de3f55f8c141e (diff) | |
download | fetchmail-ee8b3e0af473a1efa48e5e8a009dde0baef50d9f.tar.gz fetchmail-ee8b3e0af473a1efa48e5e8a009dde0baef50d9f.tar.bz2 fetchmail-ee8b3e0af473a1efa48e5e8a009dde0baef50d9f.zip |
Fix interface option.
svn path=/trunk/; revision=1523
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | interface.c | 14 |
2 files changed, 13 insertions, 2 deletions
@@ -15,6 +15,7 @@ fetchmail-4.3.2 () * More slow-UIDL patches from Wolfgang Wander. * Yet another attempt to fix IMAP-K4. This one, my beta-testers say, works. * Only re-poll on actual dispatches (not just fetches). +* kwrohrer's patch for interface option on newer Linux kernels. There are 262 people on fetchmail-friends and 54 on fetchmail-announce. diff --git a/interface.c b/interface.c index 266cf6ba..370d078d 100644 --- a/interface.c +++ b/interface.c @@ -48,6 +48,7 @@ static int _get_ifinfo_(int socket_fd, FILE *stats_file, const char *ifname, struct ifreq request; char *cp, buffer[256]; int found = 0; + int counts[4]; /* initialize result */ memset((char *) ifinfo, 0, sizeof(ifinfo_t)); @@ -58,8 +59,17 @@ static int _get_ifinfo_(int socket_fd, FILE *stats_file, const char *ifname, if (!strncmp(cp, ifname, namelen) && cp[namelen] == ':') { cp += namelen + 1; - sscanf(cp, "%d %*d %*d %*d %*d %d %*d %*d %*d %*d %*d", - &ifinfo->rx_packets, &ifinfo->tx_packets); + if (sscanf(cp, "%d %d %*d %*d %*d %d %*d %d %*d %*d" + " %*d %*d %d",counts, counts+1, counts+2, + counts+3,&found)>4) { /* found = dummy */ + /* newer kernel with byte counts */ + ifinfo->rx_packets=counts[1]; + ifinfo->tx_packets=counts[3]; + } else { + /* older kernel, no byte counts */ + ifinfo->rx_packets=counts[0]; + ifinfo->tx_packets=counts[2]; + } found = 1; } } |