RTCS doesnt compile with RTCSCFG_ENABLE_NAT, error in ip.c > undefined pcb

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTCS doesnt compile with RTCSCFG_ENABLE_NAT, error in ip.c > undefined pcb

Jump to solution
4,452 Views
CarlFST60L
Senior Contributor II

As the subject says.

 

I am using MQX3.4 and CW7.1.2 build 11 52259evb

 

It wont compile returning "undefined identifier 'pcb' on lines 583 and 598.

Is there something else that needs to be included so ip.c can see 'pcb ' which is defined in pcb.h

 

user_config.h looks like this

#define RTCSCFG_ENABLE_NAT 1
#define RTCSCFG_ENABLE_ICMP      1
#define RTCSCFG_ENABLE_UDP       1
#define RTCSCFG_ENABLE_TCP       0
#define RTCSCFG_ENABLE_STATS     1
#define RTCSCFG_ENABLE_GATEWAYS  1
#define FTPDCFG_USES_MFS         0
#define RTCSCFG_ENABLE_SNMP      0

 

 

I also cannot call

error = setsockopt(sock, SOL_NAT, RTCS_SO_NAT_TIMEOUTS, &nat_touts, sizeof(nat_touts));

the error I get is undefine 'SOL_NAT'

I do have #include <rtcs.h> and #include <nat.h> which holds the SOL_NAT definition

 

 

 

Another question:

 

Do I really need to hav:

#define RTCSCFG_ENABLE_NAT 1

#define RTCSCFG_ENABLE_IP_STATS 1

 

Just so I can change UDP timeout using:

 

setsockopt(sock, SOL_NAT, RTCS_SO_NAT_TIMEOUTS, &nat_touts, sizeof(nat_touts));

 

I have no indepth  understanding of RTCS, or related low level drivers, but it seems we are including a lot of recources that we will never use just to get a UDP to timeout.

 

PS. None of this would matter if my other thread regarding RTCS_MSG_PEEK was solved. I just need to retry sending UDP if I dont get a response in X time.

Message Edited by CarlFST60L on 2010-02-04 12:11 AM
Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
2,043 Views
CarlFST60L
Senior Contributor II
I fixed the problem, the problem was with resetting remote_sin after a shutdown.

View solution in original post

0 Kudos
Reply
8 Replies
2,043 Views
PetrM
Senior Contributor I

The thing is that not all RTCS functionality is available/functional yet.

NAT is another one in our TODO list.

We are sorry about such inconveniences.

 

PetrM

 

0 Kudos
Reply
2,043 Views
admin
Specialist II

Hello. I am using the TWR-MCF52259 with MQX 3.6 and I would like to set a Hostname to the TWR system on the network so the other hosts could connect the TWR system services by using its “network hostname”.

The following Network Configuration the tower system gets when I connect it to a DHCP network is:

Eth#: 0
Link: on
Bind: dhcpnoauto
MAC : 00:20:4a:89:93:4b
IP : 10.200.1.159
MASK: 255.255.255.0
GATE: 10.200.1.248
DNS1: 200.33.146.169
Link status task stopped

Since the Tower system gets its network configuration through DHCP then I will never know certainly what IP address is going to get. That is why I would like to refer the Tower system by its name (for example "twrsys123") in the network instead of refering it by it's Ip Address (10.200.1.159).  If I start a web server, ftp server or any other service on the Tower system It would be much more easy to access those services with a name in the network (like "http://twrsystem123" or "tftp://twrsystem123").


I have RTCSCFG_ENABLE_LWDNS set to 1

And   RTCSCFG_ENABLE_DNS se to 0

 

I changed RTCSCFG_ENABLE_DNS to 1 and tried to use the definition:

char DNS_Local_network_name[] = "twrsys123";

Which is at “Freescale\freescale MQX 3.6\rtcs\source\if\dnshosts.c” file, but didn’t work.

 

 Another possibility I imagine is In the “resolver.c” file located at “Freescale\freescale MQX 3.6\rtcs\source\apps\resolver.c”. There is the function:

boolean LWDNS_resolve( char_ptr  name_to_resolve,  _ip_address _PTR_ ipaddr_ptr, char_ptr  ipname,  uint_32  ipnamesize) is a function that calls the LWDNS_Send_Query and  LWDNS_Get_Response functions and is used to resolve any address name in the network by getting contact with the configured DNS server (LWDNS_server_ipaddr global variable).

 

Having noticed that I don’t know if there is an already developed library for MQX that mades the opposite thing: “to set the Twr system own host name and send it over the network so the external DNS server could update its address list and other hosts in the network could contact the TWR system by its hostname”.

 

Is the RTCSCFG_ENABLE_NAT definition you where talking about what could enable the use of adress resolution for the twr system?

 

I will very appreciate If somebody has the answer.

 

Thank you and my best regards

0 Kudos
Reply
2,043 Views
CarlFST60L
Senior Contributor II

Thanks for the reply Peter,

 

Can you give me an idea on how to do a timeout on UDP RX that wont cause any RTCS problems?

 

Carl. 

0 Kudos
Reply
2,043 Views
PetrM
Senior Contributor I

Let me point you to LWDNS code in rtcs\source\apps\resolver.c at the very bottom.

There you can see UDP socket maintaining including timeouts.

 

Hope this helps,

PetrM

 

0 Kudos
Reply
2,043 Views
CarlFST60L
Senior Contributor II

Thanks for the reply Peter.

 

I have had a look at the code you recommended, however it is rather involved as its intergrated into the DNS / TCP / UDP / RTCS code. I also was unable to find the core section that differs from what I am doing.

 

Currently, I cannot see how to do it. we have tried using RTCS_MSG_PEEK

 

error = recvfrom(sock, my_RXbuffer, 256, RTCS_MSG_PEEK, &remote_sin, &remote_len);

 

this causes a problem, even after you shutdown(); socket(); bind(); after the timeout for the response, the next sendto(); returns an error! I thought the idea of RTCS_MSG_PEEK was to allow a timeout for no blocking?

 

Can you be a little more specific how to create a simple UDP timeout that will work?

 

 

 

 

0 Kudos
Reply
2,043 Views
PetrM
Senior Contributor I

I'm not sure but maybe you have to somehow manually empty the input buffer, when you only "peek for data".

Try to use recvfrom with PEEK flag followed by recvfrom without the flag (if data found), to see if the error still occurs.

Another tip would be to use socket option OPT_RECEIVE_NOWAIT (see httpd) or recvfrom flag RTCS_MSG_NONBLOCK.

 

PetrM

 

0 Kudos
Reply
2,044 Views
CarlFST60L
Senior Contributor II

Hi Peter,

 

We have actually been doing RTCS_MSG_PEEK, if we get some data, we do the recvfrom() without message peek (which I think is pretty obvious). The problem with RTCS is, if you do RTCS_MSG_PEEK and there is no message (i.e. it times out), the next time you go to do sendto() it returns an error, even after you shutdown(); socket(); bind();

 

We will look into your other methods mentioned. We have entered a service request as this is clearly something that should work, and work easily.

Message Edited by CarlFST60L on 2010-02-15 07:13 PM
0 Kudos
Reply
2,044 Views
CarlFST60L
Senior Contributor II
I fixed the problem, the problem was with resetting remote_sin after a shutdown.
0 Kudos
Reply