Strange behavior in SNMP / UDP Code

Paul Whitfield paulw at omnitronics.com.au
Mon Nov 1 07:36:26 UTC 2010


Hi All,

I have seen some strange behaviour with the snmp code and the
network stack and I was wondering if anyone can shed some light on it.

In the SNMP code that is meant to list the current UDP sessions
a sysctl call is made (simplified code) as shown


     int             sname[] =
         { CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_PCBLIST };

     if (sysctl(sname, 4, 0, &len, 0, 0) < 0) {
         return;
     }

However, the length returned is negative, causing subsequent
code to fail.

Looking at the internals of the network code,
I tracked this back to a negative value in the
the function

udp_pcblist

It does the following calculation, and the value of udbinfo.ipi_count
is negative.

	n = udbinfo.ipi_count;
	req->oldidx = 2 * (sizeof xig)
		+ (n + n/8) * sizeof(struct xinpcb);

Firstly: I am using an old version of rtems (4.6.6) and so this may
be a problem that has been fixed, however I could not see any
evidence of this in the history of udp_userreq.c


Regards

Paul

*** YES I know I need to update to a more current version of RTEMS,
it is at the top of my todo list, and has been for a very long time.

-- 
Regards

Paul Whitfield
Software Engineer

27 Sarich Court, Osborne Park
Perth WA 6017
P:  +61 8 9445 2633
F:  +61 8 9445 1687
I: www.omnitronics.com.au <http://www.omnitronics.com.au>

  Please consider the environment before printing this email.
This message and any attachment are confidential. If you are not the
intended recipient, please telephone or email the sender and delete the
message and any attachment from your system. If you are not the intended
recipient you must not copy this message or attachment or disclose the
contents to any other person.

-- 
Message  protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.http://www.mailguard.com.au/mg




More information about the users mailing list