ip_print_ifs returns wrong MTU.

, , , ,

ip_print_ifs(); returns a MTU of 16 yet it is defined as 1500.

ifmtu(i, 0)); returns goofy values but ifmtu(i, _if_tab[0].ipaddr)); returns 1500.

in ip.lib

printf("%-4s %4u ", IF_P2P(i) ? (IF_PKT_ETH(i) ? “ppoe” : “ppp”) : IF_PKT_REAL_WIFI(i) ? “wifi”
: “eth”, ifmtu(i, _if_tab[i].ipaddr));

Returns 16

Something is very goofy.

You didn’t give any relevant information. What version of DC are you using? What Rabbit board are you using?

What networking parameters do you have set up? How did you set them up?

DC 10.72 and a RCM4310

#define TCPCONFIG 1 /* Static IP */
#define _PRIMARY_STATIC_IP “192.168.1.230”
#define _PRIMARY_NETMASK “255.255.255.0”
#define MY_GATEWAY “192.168.1.1”
#define MY_NAMESERVER “192.168.1.10”

InitExternalIO();
GetIpAddress(IpAddress); //This reads the IP from a set of 8 hex rotary switches…

ifconfig(IF_ETH0,
IFS_IPADDR, aton(IpAddress),
IFS_NETMASK, aton(“255.255.255.0”),
IFS_UP,
IFS_END);
while (ifpending(IF_ETH0) == 1) tcp_tick(NULL);

ip_print_ifs();

In DC 10.72 Function lookup:
ip_print_ifs

SYNTAX: void ip_print_ifs(void)

KEYWORDS: tcpip, interface

DESCRIPTION: Print all interface table entries. This is for debugging
only, since the results are printed to the Dynamic C stdio
window.

           There are 8 fields for each interface entry:
             #:
               the interface number
             IP addr:
               The local ("home") IP address of this interface.  May
               be 0.0.0.0 if interface is not currently active.
             Mask:
               Local subnet mask.
             Up:
               Indicates status; one of
                 Yes: interface currently active
                 No:  currently inactive
                 NYU: Not Yet Up i.e. coming up
                 NYD: Not Yet Down i.e. coming down
             Type:
               Interface type; one of
                 eth: normal ethernet
                 ppp: PPP over serial port
                 pppoe: PPP over ethernet
             MTU:
               Maximum transmission unit.
             Flags:
               A list of the following characters:
                 * = this is the default interface (IF_DEFAULT)
                 D = Use DHCP
                 DD= Currently configured via DHCP
                 S = allow IP address configuration via directed
                     ping (ICMP echo).
                 SS= IP address currently set via directed ping
                 1 = IGMP version 1 router present on this interface
                 ->nn = Virtual interface on specified real i/f
             Peer/router:
               IP address of peer node (for PPP or PPPOE), or address
               of default router on this interface (for ethernet
               type).  May be blank or 0.0.0.0 if no peer or router
               is available.

When I run display_mac.c on an RCM4310 I get

IP addr. Mask Up Lnk Type MTU Flags Peer/router


0 192.168.0.192 255.255.255.0 yes yes eth 16 * 192.168.0.1

When I run it on an RCM6750 I get

IP addr. Mask Up Lnk Type MTU Flags Peer/router


0 192.168.0.192 255.255.255.0 yes yes eth 1500 * 192.168.0.1

I would assume this is a bug as the MTU should be 1500 for ethernet and 1489 if WiFi and Rabbit 5000 or above.

Indeed, I looked into debugging it but gave up as I have more pressing issues.