This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: SNMP shows zero tx packets?
- To: Andrew Lunn <andrew dot lunn at ascom dot ch>
- Subject: Re: [ECOS] SNMP shows zero tx packets?
- From: Gary Thomas <gthomas at redhat dot com>
- Date: Thu, 04 Jan 2001 06:28:28 -0700 (MST)
- Cc: ecos-discuss at sources dot redhat dot com, Grant Edwards <grante at visi dot com>
- Organization: Red Hat, Inc.
On 04-Jan-2001 Andrew Lunn wrote:
> On Thu, Jan 04, 2001 at 09:14:50AM +0100, Andrew Lunn wrote:
>> You need to look in packages/net/snmp/agent/mibgroups/mibII/inferfaces.c
>>
>> The offending bit of code is
>>
>> case IFOUTUCASTPKTS:
>> long_ret = ifp->if_opackets - ifp->if_omcasts;
>> return (unsigned char *) &long_ret;
>>
>> This is returning the number of multicast packets output!
>> It should return if_opackets.
>
> Duh, i should not better than to reply before drinking the mornings
> first cup of coffee. That line is correct.
>
> Thats seems to be missing is code to increment if_opackets. I cannot
> find that anyway. Realy you need to go back to the OpenBSD sources and
> find out where it increments the counter. I suspect its either in the
> device driver itself, or the generic ethernet layer between the driver
> and the stack.
Correct you are. This is something I missed when abstracting the device
drivers [eCos drivers know nothing of the OpenBSD stack environment].
This patch oughta do the trick:
Index: io/eth/current/src/net/eth_drv.c
===================================================================
RCS file: /home/cvs/ecc/ecc/io/eth/current/src/net/eth_drv.c,v
retrieving revision 1.10
diff -u -5 -p -r1.10 eth_drv.c
--- io/eth/current/src/net/eth_drv.c 2000/12/11 16:41:27 1.10
+++ io/eth/current/src/net/eth_drv.c 2001/01/04 13:26:14
@@ -554,11 +554,13 @@ static struct mbuf *mbuf_key;
static void
eth_drv_tx_done(struct eth_drv_sc *sc, CYG_ADDRESS key, int status)
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *m0 = (struct mbuf *)key;
+
// Check for errors here (via 'status')
+ ifp->if_opackets++;
// Done with packet
mbuf_key = m0;
m_freem(m0);
// Start another if possible
eth_drv_send(ifp);