summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended
diff options
context:
space:
mode:
authorLi Wang <li.wang@windriver.com>2018-06-06 10:54:45 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-15 17:56:24 +0100
commitc7786c5bb8b35fcba81a2ad2622374bc98b37ccd (patch)
tree0281bd72ffc1af990a0132e22ec5eb33719a1962 /meta/recipes-extended
parent61e587b32d10c796503f98f16eb3d66f24835708 (diff)
downloadpoky-c7786c5bb8b35fcba81a2ad2622374bc98b37ccd.tar.gz
rpcbind: add option to make user able to use fixed port number
Add option "-p" to specify fixed port number (From OE-Core rev: f6f3f7388cefb2833b4240c2c9ddbf8bd201bc61) Signed-off-by: Li Wang <li.wang@windriver.com> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r--meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch130
-rw-r--r--meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb1
2 files changed, 131 insertions, 0 deletions
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 0000000000..434b6b1c4c
--- /dev/null
+++ b/meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch
@@ -0,0 +1,130 @@
1From 76f8598fd20727908e760cbb497dd6a17eda4af5 Mon Sep 17 00:00:00 2001
2From: Roy Li <rongqing.li@windriver.com>
3Date: Wed, 17 Sep 2014 13:22:14 +0800
4Subject: [PATCH] add option to make users able to use fixed port number
5
6Upstream-Status: Submitted [https://sourceforge.net/p/rpcbind/discussion/716839/thread/32af721d/]
7
8Signed-off-by: Li Wang <li.wang@windriver.com>
9Signed-off-by: Roy Li <rongqing.li@windriver.com>
10Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
11---
12 man/rpcbind.8 | 4 +++-
13 src/rpcb_svc_com.c | 17 +++++++++++++++++
14 src/rpcbind.c | 8 ++++++--
15 3 files changed, 26 insertions(+), 3 deletions(-)
16
17diff --git a/man/rpcbind.8 b/man/rpcbind.8
18index af6200f..2e6146b 100644
19--- a/man/rpcbind.8
20+++ b/man/rpcbind.8
21@@ -11,7 +11,7 @@
22 .Nd universal addresses to RPC program number mapper
23 .Sh SYNOPSIS
24 .Nm
25-.Op Fl adhiLls
26+.Op Fl adhpiLls
27 .Sh DESCRIPTION
28 The
29 .Nm
30@@ -107,6 +107,8 @@ will automatically add
31 and if IPv6 is enabled,
32 .Li ::1
33 to the list.
34+.It Fl p
35+Bind for fixed UDP port number
36 .It Fl i
37 .Dq Insecure
38 mode.
39diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
40index 8aef9e5..c2632a4 100644
41--- a/src/rpcb_svc_com.c
42+++ b/src/rpcb_svc_com.c
43@@ -48,6 +48,7 @@
44 #include <rpc/rpc.h>
45 #include <rpc/rpcb_prot.h>
46 #include <rpc/svc_dg.h>
47+#include <rpc/rpc_com.h>
48 #include <netconfig.h>
49 #include <errno.h>
50 #include <syslog.h>
51@@ -497,6 +498,7 @@ xdr_opaque_parms(XDR *xdrs, struct r_rmtcall_args *cap)
52
53 static struct rmtcallfd_list *rmthead;
54 static struct rmtcallfd_list *rmttail;
55+extern unsigned short fixed_port;
56
57 int
58 create_rmtcall_fd(struct netconfig *nconf)
59@@ -504,6 +506,8 @@ create_rmtcall_fd(struct netconfig *nconf)
60 int fd;
61 struct rmtcallfd_list *rmt;
62 SVCXPRT *xprt;
63+ struct __rpc_sockinfo si;
64+ struct t_bind taddr;
65
66 if ((fd = __rpc_nconf2fd(nconf)) == -1) {
67 if (debugging)
68@@ -512,6 +516,19 @@ create_rmtcall_fd(struct netconfig *nconf)
69 nconf->nc_device, errno);
70 return (-1);
71 }
72+
73+ if (fixed_port) {
74+ __rpc_fd2sockinfo(fd, &si);
75+ memset(&taddr, 0, sizeof(taddr));
76+ taddr.addr.maxlen = taddr.addr.len = si.si_alen;
77+ taddr.addr.buf = malloc(si.si_alen);
78+ if (taddr.addr.buf == NULL) {
79+ return -1;
80+ }
81+ *(unsigned short *)(&(taddr.addr.buf[0])) = si.si_af;
82+ *(unsigned short *)(&(taddr.addr.buf[2])) = htons(fixed_port);
83+ xprt = svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, RPC_MAXDATASIZE);
84+ } else
85 xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0);
86 if (xprt == NULL) {
87 if (debugging)
88diff --git a/src/rpcbind.c b/src/rpcbind.c
89index 137011b..dc3d2d6 100644
90--- a/src/rpcbind.c
91+++ b/src/rpcbind.c
92@@ -111,6 +111,7 @@ int runasdaemon = 0;
93 int insecure = 0;
94 int oldstyle_local = 0;
95 int verboselog = 0;
96+unsigned short fixed_port = 0;
97
98 char **hosts = NULL;
99 int nhosts = 0;
100@@ -869,7 +870,7 @@ parseargs(int argc, char *argv[])
101 {
102 int c;
103 oldstyle_local = 1;
104- while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
105+ while ((c = getopt(argc, argv, "adh:p:ilswf")) != -1) {
106 switch (c) {
107 case 'a':
108 doabort = 1; /* when debugging, do an abort on */
109@@ -887,6 +888,9 @@ parseargs(int argc, char *argv[])
110 if (hosts[nhosts - 1] == NULL)
111 errx(1, "Out of memory");
112 break;
113+ case 'p':
114+ fixed_port = atoi(optarg);
115+ break;
116 case 'i':
117 insecure = 1;
118 break;
119@@ -905,7 +909,7 @@ parseargs(int argc, char *argv[])
120 break;
121 #endif
122 default: /* error */
123- fprintf(stderr, "usage: rpcbind [-adhilswf]\n");
124+ fprintf(stderr, "usage: rpcbind [-adhpilswf]\n");
125 exit (1);
126 }
127 }
128--
1291.9.1
130
diff --git a/meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb b/meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb
index dcdee6c468..3c6774c28b 100644
--- a/meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb
+++ b/meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb
@@ -18,6 +18,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/rpcbind/rpcbind-${PV}.tar.bz2 \
18 file://0001-rpcbind-pair-all-svc_getargs-calls-with-svc_freeargs.patch \ 18 file://0001-rpcbind-pair-all-svc_getargs-calls-with-svc_freeargs.patch \
19 file://pmapproc_dump-Fixed-typo-in-memory-leak-patch.patch \ 19 file://pmapproc_dump-Fixed-typo-in-memory-leak-patch.patch \
20 file://rpcbproc_callit_com-Stop-freeing-a-static-pointer.patch \ 20 file://rpcbproc_callit_com-Stop-freeing-a-static-pointer.patch \
21 file://rpcbind_add_option_to_fix_port_number.patch \
21 " 22 "
22SRC_URI[md5sum] = "cf10cd41ed8228fc54c316191c1f07fe" 23SRC_URI[md5sum] = "cf10cd41ed8228fc54c316191c1f07fe"
23SRC_URI[sha256sum] = "074a9a530dc7c11e0d905aa59bcb0847c009313f02e98d3d798aa9568f414c66" 24SRC_URI[sha256sum] = "074a9a530dc7c11e0d905aa59bcb0847c009313f02e98d3d798aa9568f414c66"