* Re: RPC clnt_create() adress already in use
@ 2017-09-29 9:52 PAULUS, Raimund, TI-ABN
2017-09-29 17:36 ` Mark Geisert
0 siblings, 1 reply; 4+ messages in thread
From: PAULUS, Raimund, TI-ABN @ 2017-09-29 9:52 UTC (permalink / raw)
To: cygwin
Hello Mark,
i downloaded the sources of libtirpc from this url: https://sourceforge.net/projects/libtirpc/files/libtirpc/1.0.1/ and unpacked it in the local subdirectory libtirpc-1.0.1.
I had to make the following changes:
libtirpc-1.0.1/src/clnt_bcast.c (because POLLRDNORM, POLLRDBAND are already defined in /usr/include/sys/poll.h) :
--> #ifndef POLLRDNORM
--> # define POLLRDNORM 0x040 /* Normal data may be read. */
--> # define POLLRDBAND 0x080 /* Priority data may be read. */
--> #endif
libtirpc-1.0.1/tirpc/rpc/xdr.h (typedefs where missed):
--> #include <rpc/types.h>
--> typedef __uint64_t u_quad_t;
--> typedef __int64_t quad_t;
I linked the necessary source files with my testprogram:
gcc -D__GLIBC__ -D__linux__ -I/c/dh-progs/tstdir/libtirpc-1.0.1/tirpc \
tst_rpc.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_bcast.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_dg.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_generic.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_perror.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_vc.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_callmsg.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_commondata.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_generic.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_prot.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/rpcb_clnt.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/rpcb_prot.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_array.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_mem.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_rec.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_reference.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/getnetconfig.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/getnetpath.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/auth_none.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/auth_unix.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/authunix_prot.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/mt_misc.c \
/c/dh-progs/tstdir/libtirpc-1.0.1/src/debug.c \
-o tst_rpc-libtirpc-1-0-1
The program works perfectly (no errors is test cases 1 and 2).
I assume, there must be a difference between the downloaded lib-files and the Cygwin-libtirpc.
Raimund Paulus
-----Ursprüngliche Nachricht-----
Von: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] Im Auftrag von Mark Geisert
Gesendet: Mittwoch, 27. September 2017 11:50
An: cygwin@cygwin.com
Betreff: Re: RPC clnt_create() adress already in use
Hello Raimund,
Let's keep this on the mailing list please.
PAULUS, Raimund, TI-ABN wrote:
> Hallo Mark Geisert,
>
> many thanks for your answer. I supposed this too.
>
> I included in my source code the following function calls after clnt_create():
>
> int fd = 0;
> bool bool_ret = clnt_control(cl, CLGET_FD, &fd); if(bool_ret == true) {
> printf("fd: %d\n", fd);
>
> int enable = 1;
> retval = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int));
> if(retval < 0)
> fprintf(stderr, "Fehler setsockopt(): %s\n", strerror(errno)); }
>
> The function clnt_control() delivers the socket of the RPC-Client-Handle.
> The result is the same as before. Moreover i think, the effect of setsockopt() would be valid only during the process is running (my test scenarios 1 and 2).
> But it wouldn't change anything regarding my test scenario 3 (several restarts).
>
> Raimund
I looked through the libtirpc source code and nowhere is SO_REUSEADDR being set.
You are on the right track with how to do it, but by the time clnt_create() returns to you it is already too late. As far as I can tell there is no way to get access to the socket between the time it's created within libtirpc and the time it's made available to you by clnt_create().
I did try running your testcase (thanks for supplying that) but I don't have a local machine running RPC services and don't wish to poke at random machines on the Internet ;-). I had to compile it as so:
gcc -g -o test_rpc -I/usr/include/tirpc test_rpc.c -ltirpc You are taking care to compile against the correct RPC-package includes and link against the correct RPC-package libraries, yes?
Speculation: There might be a way to decompose what clnt_create() does into other libtirpc functions that accomplish the same thing, but in smaller pieces such that you could set the socket option before bind() is called. That would be a fair amount of work though and given my cursory look at the source I don't know if it's even possible.
..mark
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RPC clnt_create() adress already in use
2017-09-29 9:52 RPC clnt_create() adress already in use PAULUS, Raimund, TI-ABN
@ 2017-09-29 17:36 ` Mark Geisert
2017-11-21 12:35 ` WG: " PAULUS, Raimund, TI-ABN
0 siblings, 1 reply; 4+ messages in thread
From: Mark Geisert @ 2017-09-29 17:36 UTC (permalink / raw)
To: cygwin
PAULUS, Raimund, TI-ABN wrote:
> Hello Mark,
>
> i downloaded the sources of libtirpc from this url: https://sourceforge.net/projects/libtirpc/files/libtirpc/1.0.1/ and unpacked it in the local subdirectory libtirpc-1.0.1.
> I had to make the following changes:
>
> libtirpc-1.0.1/src/clnt_bcast.c (because POLLRDNORM, POLLRDBAND are already defined in /usr/include/sys/poll.h) :
>
> --> #ifndef POLLRDNORM
> --> # define POLLRDNORM 0x040 /* Normal data may be read. */
> --> # define POLLRDBAND 0x080 /* Priority data may be read. */
> --> #endif
>
> libtirpc-1.0.1/tirpc/rpc/xdr.h (typedefs where missed):
>
> --> #include <rpc/types.h>
>
> --> typedef __uint64_t u_quad_t;
> --> typedef __int64_t quad_t;
>
>
> I linked the necessary source files with my testprogram:
>
> gcc -D__GLIBC__ -D__linux__ -I/c/dh-progs/tstdir/libtirpc-1.0.1/tirpc \
> tst_rpc.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_bcast.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_dg.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_generic.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_perror.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_vc.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_callmsg.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_commondata.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_generic.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_prot.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpcb_clnt.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpcb_prot.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_array.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_mem.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_rec.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_reference.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/getnetconfig.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/getnetpath.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/auth_none.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/auth_unix.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/authunix_prot.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/mt_misc.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/debug.c \
> -o tst_rpc-libtirpc-1-0-1
>
> The program works perfectly (no errors is test cases 1 and 2).
>
> I assume, there must be a difference between the downloaded lib-files and the Cygwin-libtirpc.
Thank you Raimund for debugging this to the root cause. Cygwin claims to be
providing libtirpc 1.0.1 so I suspect you're correct about the cause. I will
figure out what the differences are and take the issue up with the Cygwin
libtirpc maintainer. Congrats on solving the problem yourself!
Thanks again,
..mark
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 4+ messages in thread
* WG: RPC clnt_create() adress already in use
2017-09-29 17:36 ` Mark Geisert
@ 2017-11-21 12:35 ` PAULUS, Raimund, TI-ABN
2017-11-22 21:54 ` Mark Geisert
0 siblings, 1 reply; 4+ messages in thread
From: PAULUS, Raimund, TI-ABN @ 2017-11-21 12:35 UTC (permalink / raw)
To: cygwin
Hello Mark,
is there any news with respect to libtirpc? Very important: I need it in Cygwin 2.5.1.
Raimund Paulus
-----Ursprüngliche Nachricht-----
Von: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] Im Auftrag von Mark Geisert
Gesendet: Freitag, 29. September 2017 11:52
An: cygwin@cygwin.com
Betreff: Re: RPC clnt_create() adress already in use
PAULUS, Raimund, TI-ABN wrote:
> Hello Mark,
>
> i downloaded the sources of libtirpc from this url: https://sourceforge.net/projects/libtirpc/files/libtirpc/1.0.1/ and unpacked it in the local subdirectory libtirpc-1.0.1.
> I had to make the following changes:
>
> libtirpc-1.0.1/src/clnt_bcast.c (because POLLRDNORM, POLLRDBAND are already defined in /usr/include/sys/poll.h) :
>
> --> #ifndef POLLRDNORM
> --> # define POLLRDNORM 0x040 /* Normal data may be read. */
> --> # define POLLRDBAND 0x080 /* Priority data may be read. */
> --> #endif
>
> libtirpc-1.0.1/tirpc/rpc/xdr.h (typedefs where missed):
>
> --> #include <rpc/types.h>
>
> --> typedef __uint64_t u_quad_t;
> --> typedef __int64_t quad_t;
>
>
> I linked the necessary source files with my testprogram:
>
> gcc -D__GLIBC__ -D__linux__ -I/c/dh-progs/tstdir/libtirpc-1.0.1/tirpc
> \ tst_rpc.c \ /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_bcast.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_dg.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_generic.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_perror.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/clnt_vc.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_callmsg.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_commondata.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_generic.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpc_prot.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpcb_clnt.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/rpcb_prot.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_array.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_mem.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_rec.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/xdr_reference.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/getnetconfig.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/getnetpath.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/auth_none.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/auth_unix.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/authunix_prot.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/mt_misc.c \
> /c/dh-progs/tstdir/libtirpc-1.0.1/src/debug.c \ -o
> tst_rpc-libtirpc-1-0-1
>
> The program works perfectly (no errors is test cases 1 and 2).
>
> I assume, there must be a difference between the downloaded lib-files and the Cygwin-libtirpc.
Thank you Raimund for debugging this to the root cause. Cygwin claims to be providing libtirpc 1.0.1 so I suspect you're correct about the cause. I will figure out what the differences are and take the issue up with the Cygwin libtirpc maintainer. Congrats on solving the problem yourself!
Thanks again,
..mark
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: WG: RPC clnt_create() adress already in use
2017-11-21 12:35 ` WG: " PAULUS, Raimund, TI-ABN
@ 2017-11-22 21:54 ` Mark Geisert
0 siblings, 0 replies; 4+ messages in thread
From: Mark Geisert @ 2017-11-22 21:54 UTC (permalink / raw)
To: cygwin
(3rd attempt at sending this)
PAULUS, Raimund, TI-ABN wrote:
> Hello Mark,
>
> is there any news with respect to libtirpc? Very important: I need it in Cygwin 2.5.1.
I neglected to report what I found; sorry for that. The difference(s) between
the vanilla libtirpc 1.0.1 that you downloaded and the one supplied by Cygwin
are due to the patches applied as part of the Cygwin build. If you have the
Cygwin package's source downloaded and unpacked with 'cygport prep' you can find
these patches in /usr/src/libtirpc-1.0.1-1.src.
I noticed one of the patches is a security fix. I suspect one or more of these
patches are causing the difficulty you're having but I don't know enough about
RPC in general to set up a test environment and can't devote time to digging
further. This is as far as I can go. Apologies again for not stating this.
Regards,
..mark
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-22 21:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 9:52 RPC clnt_create() adress already in use PAULUS, Raimund, TI-ABN
2017-09-29 17:36 ` Mark Geisert
2017-11-21 12:35 ` WG: " PAULUS, Raimund, TI-ABN
2017-11-22 21:54 ` Mark Geisert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).