Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to close the local timewait? #258

Open
HsuJv opened this issue Aug 13, 2020 · 6 comments
Open

How to close the local timewait? #258

HsuJv opened this issue Aug 13, 2020 · 6 comments

Comments

@HsuJv
Copy link

HsuJv commented Aug 13, 2020

Hi there,

I'd like to free the socket resources immediately without any time wait so that I can create no odp pools for timewait timer.
I've found that there's one variable ofp_nolocaltimewait to trigger it.

But the thing is, why we keep the error to 0 that will always create a time wait timer?

src/ofp_tcp_timewait.c: 177
	if (V_nolocaltimewait) {
		int error = 0;
#ifdef INET6
		if (isipv6)
			error = 0 /*in6_localaddr(&inp->in6p_faddr)*/;
		else
#endif
			error = 0 /* HJo: FIX in_localip(inp->inp_faddr)*/;

		if (error) {
			tp = ofp_tcp_close(tp);
			if (tp != NULL)
				INP_WUNLOCK(inp);
			return;
		}
	}

Kindly help,
thanks in advance.

@HsuJv
Copy link
Author

HsuJv commented Aug 17, 2020

Hello?
Anyone here would help?
Thanks.

@bogdanPricope
Copy link
Contributor

Hi,
I guess OFP maintainers are in vacation. Btw, since you are with Nokia, can you check what Matias/Jere/etc. are doing?
Else, I can have a look at this in the following days...

@HsuJv
Copy link
Author

HsuJv commented Aug 18, 2020

Hi @bogdanPricope
Thx for the information,
Actually I'm not with Nokia.
I'll try to make a if (1) in my project. And keep monitoring what will happen.
Also will be patient to wait for the maintainers' response.

Regards

@bogdanPricope
Copy link
Contributor

Oops.. my bad (my confusion).

Ok, it looks like this is a remain of the initial integration of BSD code... (one of those things was supposed to be fixed during incubation phase or immediately after). So, there is no better explanation for the 'error' being 0 other than the poor integration.

Have a look at this code for reference (https://reviews.freebsd.org/file/data/ls656a7hy5wlwjbxe35f/PHID-FILE-cvyptzi6cc3u67kpuqcl/file).

Else, ofp_nolocaltimewait should be (never tried) configurable with ofp_sysctl().

Btw, what is the problem with V_tcptw_zone?

@HsuJv
Copy link
Author

HsuJv commented Aug 22, 2020

Thanks a lot for the information

I found that

 		int error = 0;
 #ifdef INET6
 		if (isipv6)
 			error = in6_localaddr(&inp->in6p_faddr);
 #endif
 #if defined(INET6) && defined(INET)
 		else
 #endif
 #ifdef INET
 			error = in_localip(inp->inp_faddr);
 #endif

in the Reference, so the error was meant to check if the peer ip was ours? (Correct me if I was wrong)

Btw, what is the problem with V_tcptw_zone?

A: I still have no idea about it and cannot figure out whether it is an ofp issue or an odp issue.
My project is working with an odp version implemented by the Marvell.
And during the Stress Testing, I can always find that there will be very few possibilities that, an fd keeps open along with its time wait timer active, but the timer will never expire and the callout fails to be called. After some ineffective troubleshooting, I finally decided to close the tcptw_zone

@bogdanPricope
Copy link
Contributor

I guess the original implementation was like this:

/*

  • Return 1 if an internet address is for the local host and configured

  • on one of its interfaces.
    */
    int
    in_localip(struct in_addr in)
    {
    struct rm_priotracker in_ifa_tracker;
    struct in_ifaddr *ia;

     IN_IFADDR_RLOCK(&in_ifa_tracker);
     LIST_FOREACH(ia, INADDR_HASH(in.s_addr), ia_hash) {
             if (IA_SIN(ia)->sin_addr.s_addr == in.s_addr) {
                     IN_IFADDR_RUNLOCK(&in_ifa_tracker);
                     return (1);
             }
     }
     IN_IFADDR_RUNLOCK(&in_ifa_tracker);
     return (0);
    

}

TCP side is not so great in OFP. I was planing some updates in my own repo but I did not had the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants