lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Re: [lwip] Initialization Sequence


From: Adam Dunkels
Subject: [lwip-users] Re: [lwip] Initialization Sequence
Date: Wed, 08 Jan 2003 23:46:08 -0000

Hi Leon!

On Thursday 20 December 2001 14.36, you wrote:
> in followup to John's question. A function that closes all connections
> and their resources,  might be very handy (hint :), also in the light of
> DHCP support.

I wouldn't recommend killing off all active connections just because the DHCP 
client fails to get a lease, however! If your system has a short network 
outage at the "right time", i.e., just when it is about to renew its address 
it might timeout and think that it didn't get a lease. When the DHCP client 
tries again, the network is fixed and it will get an address. All connections 
would still be functional after an event like this. Also, if the IP address 
changes, chances are that it might change back again. If so, old TCP 
connection (that was initiated with the old address) will work again.

Still, if you really want to abort all TCP connections, the following code 
line will do it:

while(tcp_active_pcbs) tcp_abort(tcp_active_pcbs);

> Suppose all conections have been closed, what's the neatest way of
> ignoring new connection attempts?
>
> 1) Removing the interfaces.
> 2) Zeroing the interfaces IP addresses
> 3) ... something completely different?

If you really doesn't want to receive any data at all, option 1 would be the 
best. Option 2 will make you receive all packets; an IP address of all-zeroes 
means IP_ADDR_ANY. The reason for this behaviour is to allow DHCP clients to 
boot with a network interface that accepts all incoming packets including 
DHCP offers.

But there are no ways to prevent only incoming TCP SYNs from being processed 
(other than to take down all listening connections).

Why would you want to prevent incoming connections by the way?

/adam
-- 
Adam Dunkels <address@hidden>
http://www.sics.se/~adam
[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]