EmbeddedRelated.com
Forums

Changing between DHCP and manual network config during runtime

Started by jamie30522 May 3, 2006
All,

I'm using a 2210 with a rs232 keypad and lcd. My code is compiled with DC 8.61. I'm
able to configure using DHCP without a hitch but when I try to use ifconfig( ) to change
from a DHCP configured ethernet connection to one created by manual entries, the
ifconfig( ) call never returns.

My dhcp config code is:

rc = ifconfig( IF_ETHO,
IFS_DOWN,
IFS_DHCP, 1,
IFS_UP,
IFS_END);

The offending manual config code is:

rc = ifconfig( IF_ETHO,
IFS_DOWN,
IFS_DHCP, 0,
IFS_IPADDR, aton( params.ip ),
IFS_NETMASK, aton( params.subnet),
IFS_ROUTER_SET, aton( params.gateway),
IFS_NAMESERVER_SET, aton( params.dns),
IFS_UP,
IFS_END);

The ifconfig( ) call never returns.

In the TCP config I have my default configuration set to:

#define USE_DHCP 1
#define ETHERNET 1
#define IFCONFIG_ETHO IFS_DOWN

I'm sure whatever I'm doing is a freshmen mistake but I sure don't see it.
If someone could shed a little light on it, I'd appreciate the help.

Thanks,

Jamie
How fortuitous. I have been programming the Rabbit for 2 years now, so I'm no rookie and I have exactly the same problem with the RCM3200/BL2600 and DC 8.61. I just ran into this two weeks ago and still heven't been able to solve it. Can anyone help us out here?

Mark

jamie30522 wrote:
All,

I'm using a 2210 with a rs232 keypad and lcd. My code is compiled with DC 8.61. I'm
able to configure using DHCP without a hitch but when I try to use ifconfig( ) to change
from a DHCP configured ethernet connection to one created by manual entries, the
ifconfig( ) call never returns.

My dhcp config code is:

rc = ifconfig( IF_ETHO,
IFS_DOWN,
IFS_DHCP, 1,
IFS_UP,
IFS_END);

The offending manual config code is:

rc = ifconfig( IF_ETHO,
IFS_DOWN,
IFS_DHCP, 0,
IFS_IPADDR, aton( params.ip ),
IFS_NETMASK, aton( params.subnet),
IFS_ROUTER_SET, aton( params.gateway),
IFS_NAMESERVER_SET, aton( params.dns),
IFS_UP,
IFS_END);

The ifconfig( ) call never returns.

In the TCP config I have my default configuration set to:

#define USE_DHCP 1
#define ETHERNET 1
#define IFCONFIG_ETHO IFS_DOWN

I'm sure whatever I'm doing is a freshmen mistake but I sure don't see it.
If someone could shed a little light on it, I'd appreciate the help.

Thanks,

Jamie

SPONSORED LINKS
Embedded module Microcontrollers Z-world Intel microprocessors

---------------------------------
YAHOO! GROUPS LINKS

---------------------------------
Chris,

I'll give it a try. Thank you so very much.

To be clear, you call sock_init( ) before any calls to ifconfig( )? I've looked at the examples
included with the compiler and they are calling ifconfig before sock_init. (Or it was REALLY
past my bedtime.)

Thanks again,

Jamie

--- In r..., "van der Kruit, Chris" wrote:
>
> I had problems with switching dhcp in runtime but here is how is solved it.
>
> First use #define TCPCONFIG 6,
>
> then first off al call sock_init, this may only be called once.
>
> The rest of my code is is very similar. It seems sock_init must be called
> before any config is set.
>
> Good luck,
>
> Chris
>