summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch')
-rw-r--r--meta/recipes-extended/rpcbind/rpcbind/rpcbind_add_option_to_fix_port_number.patch58
1 files changed, 29 insertions, 29 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
index 434b6b1c4c..535f9ce20d 100644
--- 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
@@ -15,7 +15,7 @@ Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
15 3 files changed, 26 insertions(+), 3 deletions(-) 15 3 files changed, 26 insertions(+), 3 deletions(-)
16 16
17diff --git a/man/rpcbind.8 b/man/rpcbind.8 17diff --git a/man/rpcbind.8 b/man/rpcbind.8
18index af6200f..2e6146b 100644 18index fbf0ace..66f7c08 100644
19--- a/man/rpcbind.8 19--- a/man/rpcbind.8
20+++ b/man/rpcbind.8 20+++ b/man/rpcbind.8
21@@ -11,7 +11,7 @@ 21@@ -11,7 +11,7 @@
@@ -27,17 +27,17 @@ index af6200f..2e6146b 100644
27 .Sh DESCRIPTION 27 .Sh DESCRIPTION
28 The 28 The
29 .Nm 29 .Nm
30@@ -107,6 +107,8 @@ will automatically add 30@@ -96,6 +96,8 @@ will automatically add
31 and if IPv6 is enabled, 31 and if IPv6 is enabled,
32 .Li ::1 32 .Li ::1
33 to the list. 33 to the list.
34+.It Fl p 34+.It Fl p
35+Bind for fixed UDP port number 35+Bind for fixed UDP port number
36 .It Fl i 36 If no
37 .Dq Insecure 37 .Fl h
38 mode. 38 option is specified,
39diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c 39diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
40index 8aef9e5..c2632a4 100644 40index 1743dad..07a1c75 100644
41--- a/src/rpcb_svc_com.c 41--- a/src/rpcb_svc_com.c
42+++ b/src/rpcb_svc_com.c 42+++ b/src/rpcb_svc_com.c
43@@ -48,6 +48,7 @@ 43@@ -48,6 +48,7 @@
@@ -60,8 +60,8 @@ index 8aef9e5..c2632a4 100644
60 int fd; 60 int fd;
61 struct rmtcallfd_list *rmt; 61 struct rmtcallfd_list *rmt;
62 SVCXPRT *xprt; 62 SVCXPRT *xprt;
63+ struct __rpc_sockinfo si; 63+ struct __rpc_sockinfo si;
64+ struct t_bind taddr; 64+ struct t_bind taddr;
65 65
66 if ((fd = __rpc_nconf2fd(nconf)) == -1) { 66 if ((fd = __rpc_nconf2fd(nconf)) == -1) {
67 if (debugging) 67 if (debugging)
@@ -70,23 +70,23 @@ index 8aef9e5..c2632a4 100644
70 return (-1); 70 return (-1);
71 } 71 }
72+ 72+
73+ if (fixed_port) { 73+ if (fixed_port) {
74+ __rpc_fd2sockinfo(fd, &si); 74+ __rpc_fd2sockinfo(fd, &si);
75+ memset(&taddr, 0, sizeof(taddr)); 75+ memset(&taddr, 0, sizeof(taddr));
76+ taddr.addr.maxlen = taddr.addr.len = si.si_alen; 76+ taddr.addr.maxlen = taddr.addr.len = si.si_alen;
77+ taddr.addr.buf = malloc(si.si_alen); 77+ taddr.addr.buf = malloc(si.si_alen);
78+ if (taddr.addr.buf == NULL) { 78+ if (taddr.addr.buf == NULL) {
79+ return -1; 79+ return -1;
80+ } 80+ }
81+ *(unsigned short *)(&(taddr.addr.buf[0])) = si.si_af; 81+ *(unsigned short *)(&(taddr.addr.buf[0])) = si.si_af;
82+ *(unsigned short *)(&(taddr.addr.buf[2])) = htons(fixed_port); 82+ *(unsigned short *)(&(taddr.addr.buf[2])) = htons(fixed_port);
83+ xprt = svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, RPC_MAXDATASIZE); 83+ xprt = svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, RPC_MAXDATASIZE);
84+ } else 84+ } else
85 xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0); 85 xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0);
86 if (xprt == NULL) { 86 if (xprt == NULL) {
87 if (debugging) 87 if (debugging)
88diff --git a/src/rpcbind.c b/src/rpcbind.c 88diff --git a/src/rpcbind.c b/src/rpcbind.c
89index 137011b..dc3d2d6 100644 89index 25d8a90..36a95b9 100644
90--- a/src/rpcbind.c 90--- a/src/rpcbind.c
91+++ b/src/rpcbind.c 91+++ b/src/rpcbind.c
92@@ -111,6 +111,7 @@ int runasdaemon = 0; 92@@ -111,6 +111,7 @@ int runasdaemon = 0;
@@ -97,7 +97,7 @@ index 137011b..dc3d2d6 100644
97 97
98 char **hosts = NULL; 98 char **hosts = NULL;
99 int nhosts = 0; 99 int nhosts = 0;
100@@ -869,7 +870,7 @@ parseargs(int argc, char *argv[]) 100@@ -884,7 +885,7 @@ parseargs(int argc, char *argv[])
101 { 101 {
102 int c; 102 int c;
103 oldstyle_local = 1; 103 oldstyle_local = 1;
@@ -106,25 +106,25 @@ index 137011b..dc3d2d6 100644
106 switch (c) { 106 switch (c) {
107 case 'a': 107 case 'a':
108 doabort = 1; /* when debugging, do an abort on */ 108 doabort = 1; /* when debugging, do an abort on */
109@@ -887,6 +888,9 @@ parseargs(int argc, char *argv[]) 109@@ -902,6 +903,9 @@ parseargs(int argc, char *argv[])
110 if (hosts[nhosts - 1] == NULL) 110 if (hosts[nhosts - 1] == NULL)
111 errx(1, "Out of memory"); 111 errx(1, "Out of memory");
112 break; 112 break;
113+ case 'p': 113+ case 'p':
114+ fixed_port = atoi(optarg); 114+ fixed_port = atoi(optarg);
115+ break; 115+ break;
116 case 'i': 116 case 'i':
117 insecure = 1; 117 insecure = 1;
118 break; 118 break;
119@@ -905,7 +909,7 @@ parseargs(int argc, char *argv[]) 119@@ -920,7 +924,7 @@ parseargs(int argc, char *argv[])
120 break; 120 break;
121 #endif 121 #endif
122 default: /* error */ 122 default: /* error */
123- fprintf(stderr, "usage: rpcbind [-adhilswf]\n"); 123- fprintf(stderr, "usage: rpcbind [-adhilswf]\n");
124+ fprintf(stderr, "usage: rpcbind [-adhpilswf]\n"); 124+ fprintf(stderr, "usage: rpcbind [-adhpilswf]\n");
125 exit (1); 125 exit (1);
126 } 126 }
127 } 127 }
128-- 128--
1291.9.1 1292.25.1
130 130