All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rpcbind: add option to make customer able to use fixed port number
@ 2014-09-17  8:22 rongqing.li
  2014-09-17 23:14 ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: rongqing.li @ 2014-09-17  8:22 UTC (permalink / raw)
  To: openembedded-core

From: Li Wang <li.wang@windriver.com>

add option to make customer able to use fixed port number

Signed-off-by: Li Wang <li.wang@windriver.com>
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
 .../rpcbind_add_option_to_fix_port_number.patch    |   97 ++++++++++++++++++++
 meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb     |    1 +
 2 files changed, 98 insertions(+)
 create mode 100644 meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch

diff --git a/meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch b/meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch
new file mode 100644
index 0000000..9193658
--- /dev/null
+++ b/meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch
@@ -0,0 +1,97 @@
+From bb78a9571d6a3d0c542ed9d929bf71fd82448968 Mon Sep 17 00:00:00 2001
+From: Roy Li <rongqing.li@windriver.com>
+Date: Wed, 17 Sep 2014 13:22:14 +0800
+Subject: [PATCH] add option to make customer able to use fixed port number
+
+Upstream-status: Pending
+
+Signed-off-by: Li Wang <li.wang@windriver.com>
+Signed-off-by: Roy Li <rongqing.li@windriver.com>
+---
+ src/rpcb_svc_com.c |   17 +++++++++++++++++
+ src/rpcbind.c      |    6 +++++-
+ 2 files changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
+index f6bd6bd..0bbd6e4 100644
+--- a/src/rpcb_svc_com.c
++++ b/src/rpcb_svc_com.c
+@@ -48,6 +48,7 @@
+ #include <rpc/rpc.h>
+ #include <rpc/rpcb_prot.h>
+ #include <rpc/svc_dg.h>
++#include <rpc/rpc_com.h>
+ #include <netconfig.h>
+ #include <errno.h>
+ #include <syslog.h>
+@@ -496,6 +497,7 @@ xdr_opaque_parms(XDR *xdrs, struct r_rmtcall_args *cap)
+ 
+ static struct rmtcallfd_list *rmthead;
+ static struct rmtcallfd_list *rmttail;
++extern unsigned short fixed_port;
+ 
+ int
+ create_rmtcall_fd(struct netconfig *nconf)
+@@ -503,6 +505,8 @@ create_rmtcall_fd(struct netconfig *nconf)
+ 	int fd;
+ 	struct rmtcallfd_list *rmt;
+ 	SVCXPRT *xprt;
++	struct __rpc_sockinfo si;
++	struct t_bind taddr;
+ 
+ 	if ((fd = __rpc_nconf2fd(nconf)) == -1) {
+ 		if (debugging)
+@@ -511,6 +515,19 @@ create_rmtcall_fd(struct netconfig *nconf)
+ 			nconf->nc_device, errno);
+ 		return (-1);
+ 	}
++
++	if (fixed_port) {
++		__rpc_fd2sockinfo(fd, &si);
++		memset(&taddr, 0, sizeof(taddr));
++		taddr.addr.maxlen = taddr.addr.len = si.si_alen;
++		taddr.addr.buf = malloc(si.si_alen);
++		if (taddr.addr.buf == NULL) {
++			return -1;
++		}
++		*(unsigned short *)(&(taddr.addr.buf[0])) = si.si_af;
++		*(unsigned short *)(&(taddr.addr.buf[2])) = htons(fixed_port);
++		xprt = svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, RPC_MAXDATASIZE);
++	} else
+ 	xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0);
+ 	if (xprt == NULL) {
+ 		if (debugging)
+diff --git a/src/rpcbind.c b/src/rpcbind.c
+index 83dbe93..a2caa32 100644
+--- a/src/rpcbind.c
++++ b/src/rpcbind.c
+@@ -99,6 +99,7 @@ int runasdaemon = 0;
+ int insecure = 0;
+ int oldstyle_local = 0;
+ int verboselog = 0;
++unsigned short fixed_port = 0;
+ 
+ char **hosts = NULL;
+ int nhosts = 0;
+@@ -748,7 +749,7 @@ parseargs(int argc, char *argv[])
+ {
+ 	int c;
+ 	oldstyle_local = 1;
+-	while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
++	while ((c = getopt(argc, argv, "adh:p:ilswf")) != -1) {
+ 		switch (c) {
+ 		case 'a':
+ 			doabort = 1;	/* when debugging, do an abort on */
+@@ -766,6 +767,9 @@ parseargs(int argc, char *argv[])
+ 			if (hosts[nhosts - 1] == NULL)
+ 				errx(1, "Out of memory");
+ 			break;
++		case 'p':
++			fixed_port = atoi(optarg);
++			break;
+ 		case 'i':
+ 			insecure = 1;
+ 			break;
+-- 
+1.7.10.4
+
diff --git a/meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb b/meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb
index 4a5562b..391f094 100644
--- a/meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb
+++ b/meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb
@@ -16,6 +16,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/rpcbind/rpcbind-${PV}.tar.bz2 \
            ${UCLIBCPATCHES} \
            file://rpcbind.conf \
            file://rpcbind.service \
+           file://rpcbind_add_option_to_fix_port_number.patch \
           "
 
 UCLIBCPATCHES_libc-uclibc = "file://0001-uclibc-nss.patch \
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rpcbind: add option to make customer able to use fixed port number
  2014-09-17  8:22 [PATCH] rpcbind: add option to make customer able to use fixed port number rongqing.li
@ 2014-09-17 23:14 ` Khem Raj
  2014-09-18  0:50   ` Rongqing Li
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2014-09-17 23:14 UTC (permalink / raw)
  To: rongqing.li@windriver.com; +Cc: Patches and discussions about the oe-core layer

On Wed, Sep 17, 2014 at 1:22 AM,  <rongqing.li@windriver.com> wrote:
> From: Li Wang <li.wang@windriver.com>
>
> add option to make customer able to use fixed port number

if you have not submitted it upstream please do so. I would be
interested to hear feedback from upstream before we apply this patch

>
> Signed-off-by: Li Wang <li.wang@windriver.com>
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
>  .../rpcbind_add_option_to_fix_port_number.patch    |   97 ++++++++++++++++++++
>  meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb     |    1 +
>  2 files changed, 98 insertions(+)
>  create mode 100644 meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch
>
> diff --git a/meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch b/meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch
> new file mode 100644
> index 0000000..9193658
> --- /dev/null
> +++ b/meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch
> @@ -0,0 +1,97 @@
> +From bb78a9571d6a3d0c542ed9d929bf71fd82448968 Mon Sep 17 00:00:00 2001
> +From: Roy Li <rongqing.li@windriver.com>
> +Date: Wed, 17 Sep 2014 13:22:14 +0800
> +Subject: [PATCH] add option to make customer able to use fixed port number
> +
> +Upstream-status: Pending
> +
> +Signed-off-by: Li Wang <li.wang@windriver.com>
> +Signed-off-by: Roy Li <rongqing.li@windriver.com>
> +---
> + src/rpcb_svc_com.c |   17 +++++++++++++++++
> + src/rpcbind.c      |    6 +++++-
> + 2 files changed, 22 insertions(+), 1 deletion(-)
> +
> +diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
> +index f6bd6bd..0bbd6e4 100644
> +--- a/src/rpcb_svc_com.c
> ++++ b/src/rpcb_svc_com.c
> +@@ -48,6 +48,7 @@
> + #include <rpc/rpc.h>
> + #include <rpc/rpcb_prot.h>
> + #include <rpc/svc_dg.h>
> ++#include <rpc/rpc_com.h>
> + #include <netconfig.h>
> + #include <errno.h>
> + #include <syslog.h>
> +@@ -496,6 +497,7 @@ xdr_opaque_parms(XDR *xdrs, struct r_rmtcall_args *cap)
> +
> + static struct rmtcallfd_list *rmthead;
> + static struct rmtcallfd_list *rmttail;
> ++extern unsigned short fixed_port;
> +
> + int
> + create_rmtcall_fd(struct netconfig *nconf)
> +@@ -503,6 +505,8 @@ create_rmtcall_fd(struct netconfig *nconf)
> +       int fd;
> +       struct rmtcallfd_list *rmt;
> +       SVCXPRT *xprt;
> ++      struct __rpc_sockinfo si;
> ++      struct t_bind taddr;
> +
> +       if ((fd = __rpc_nconf2fd(nconf)) == -1) {
> +               if (debugging)
> +@@ -511,6 +515,19 @@ create_rmtcall_fd(struct netconfig *nconf)
> +                       nconf->nc_device, errno);
> +               return (-1);
> +       }
> ++
> ++      if (fixed_port) {
> ++              __rpc_fd2sockinfo(fd, &si);
> ++              memset(&taddr, 0, sizeof(taddr));
> ++              taddr.addr.maxlen = taddr.addr.len = si.si_alen;
> ++              taddr.addr.buf = malloc(si.si_alen);
> ++              if (taddr.addr.buf == NULL) {
> ++                      return -1;
> ++              }
> ++              *(unsigned short *)(&(taddr.addr.buf[0])) = si.si_af;
> ++              *(unsigned short *)(&(taddr.addr.buf[2])) = htons(fixed_port);
> ++              xprt = svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, RPC_MAXDATASIZE);
> ++      } else
> +       xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0);
> +       if (xprt == NULL) {
> +               if (debugging)
> +diff --git a/src/rpcbind.c b/src/rpcbind.c
> +index 83dbe93..a2caa32 100644
> +--- a/src/rpcbind.c
> ++++ b/src/rpcbind.c
> +@@ -99,6 +99,7 @@ int runasdaemon = 0;
> + int insecure = 0;
> + int oldstyle_local = 0;
> + int verboselog = 0;
> ++unsigned short fixed_port = 0;
> +
> + char **hosts = NULL;
> + int nhosts = 0;
> +@@ -748,7 +749,7 @@ parseargs(int argc, char *argv[])
> + {
> +       int c;
> +       oldstyle_local = 1;
> +-      while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
> ++      while ((c = getopt(argc, argv, "adh:p:ilswf")) != -1) {
> +               switch (c) {
> +               case 'a':
> +                       doabort = 1;    /* when debugging, do an abort on */
> +@@ -766,6 +767,9 @@ parseargs(int argc, char *argv[])
> +                       if (hosts[nhosts - 1] == NULL)
> +                               errx(1, "Out of memory");
> +                       break;
> ++              case 'p':
> ++                      fixed_port = atoi(optarg);
> ++                      break;
> +               case 'i':
> +                       insecure = 1;
> +                       break;
> +--
> +1.7.10.4
> +
> diff --git a/meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb b/meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb
> index 4a5562b..391f094 100644
> --- a/meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb
> +++ b/meta/recipes-extended/rpcbind/rpcbind_0.2.1.bb
> @@ -16,6 +16,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/rpcbind/rpcbind-${PV}.tar.bz2 \
>             ${UCLIBCPATCHES} \
>             file://rpcbind.conf \
>             file://rpcbind.service \
> +           file://rpcbind_add_option_to_fix_port_number.patch \
>            "
>
>  UCLIBCPATCHES_libc-uclibc = "file://0001-uclibc-nss.patch \
> --
> 1.7.10.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rpcbind: add option to make customer able to use fixed port number
  2014-09-17 23:14 ` Khem Raj
@ 2014-09-18  0:50   ` Rongqing Li
  2014-09-18  1:39     ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Rongqing Li @ 2014-09-18  0:50 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer



On 09/18/2014 07:14 AM, Khem Raj wrote:
> On Wed, Sep 17, 2014 at 1:22 AM,<rongqing.li@windriver.com>  wrote:
>> >From: Li Wang<li.wang@windriver.com>
>> >
>> >add option to make customer able to use fixed port number
> if you have not submitted it upstream please do so. I would be
> interested to hear feedback from upstream before we apply this patch
>

1. this patch was from a customer requirement. the customer verified it 
works.

2. I post this patch to rpcbind discussion,
https://sourceforge.net/p/rpcbind/discussion/716839/thread/32af721d/

-Roy


>> >

-- 
Best Reagrds,
Roy | RongQing Li


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rpcbind: add option to make customer able to use fixed port number
  2014-09-18  0:50   ` Rongqing Li
@ 2014-09-18  1:39     ` Khem Raj
  0 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2014-09-18  1:39 UTC (permalink / raw)
  To: Rongqing Li; +Cc: Patches and discussions about the oe-core layer

On Wed, Sep 17, 2014 at 5:50 PM, Rongqing Li <rongqing.li@windriver.com> wrote:
>
>
> On 09/18/2014 07:14 AM, Khem Raj wrote:
>>
>> On Wed, Sep 17, 2014 at 1:22 AM,<rongqing.li@windriver.com>  wrote:
>>>
>>> >From: Li Wang<li.wang@windriver.com>
>>> >
>>> >add option to make customer able to use fixed port number
>>
>> if you have not submitted it upstream please do so. I would be
>> interested to hear feedback from upstream before we apply this patch
>>
>
> 1. this patch was from a customer requirement. the customer verified it
> works.

Nice to know however, its important to not digress w.r.t feature from upstream

>
> 2. I post this patch to rpcbind discussion,
> https://sourceforge.net/p/rpcbind/discussion/716839/thread/32af721d/

Update this thread when you hear back from upstream rpcbind ml.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-18  1:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-17  8:22 [PATCH] rpcbind: add option to make customer able to use fixed port number rongqing.li
2014-09-17 23:14 ` Khem Raj
2014-09-18  0:50   ` Rongqing Li
2014-09-18  1:39     ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.