Bug 26373

Summary: Rpc.statd implements the SM_NOTIFY call but does not accept it
Product: Base System Reporter: bg <bg>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: bg
Priority: Normal    
Version: 4.2-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description bg 2001-04-05 21:00:01 UTC
Rpc.statd implements the SM_NOTIFY call but because of an outdated
sm_inter.x file the daemon will not accept the call. Reception of the
call is made by a routine generated from sm_inter.x. by rpcgen.

Fix: First sm_inter.x must be changed to include procedure #6, this also
requires a type stat_chge.

Remove the definition of stat_chge that was kludged into statd.h.
How-To-Repeat: 
Make a SunOS 5.x box call statd on your FreeBSD machine.
Comment 1 Dan Nelson 2002-04-03 21:01:50 UTC
Here is another patch that more closely follows what was already
committed to 5.*:

Index: include/rpcsvc/sm_inter.x
===================================================================
RCS file: /home/ncvs/src/include/rpcsvc/sm_inter.x,v
retrieving revision 1.8
diff -u -r1.8 sm_inter.x
--- include/rpcsvc/sm_inter.x	27 Aug 1999 23:45:11 -0000	1.8
+++ include/rpcsvc/sm_inter.x	3 Apr 2002 19:06:02 -0000
@@ -62,6 +62,7 @@
 		struct sm_stat				 SM_UNMON_ALL(struct my_id) = 4;
 
 		void					 SM_SIMU_CRASH(void) = 5;
+		void					 SM_NOTIFY(struct stat_chge) = 6;
 
 	} = 1;
 } = 100024;
@@ -90,6 +91,10 @@
 	opaque priv[16]; 		/* private information to store at monitor for requesting process */
 };
 
+struct stat_chge {
+	string  mon_name<SM_MAXSTRLEN>;         /* name of the site that had the state change */
+	int state;
+};
 
 /*
  * state # of status monitor monitonically increases each time
@@ -101,13 +106,13 @@
 	int state;		/* state # of status monitor */
 };
 
-enum res {
+enum sm_res {
 	stat_succ = 0,		/* status monitor agrees to monitor */
 	stat_fail = 1		/* status monitor cannot monitor */
 };
 
 struct sm_stat_res {
-	res res_stat;
+	sm_res res_stat;
 	int state;
 };
 
@@ -115,7 +120,7 @@
  * structure of the status message sent back by the status monitor
  * when monitor site status changes
  */
-struct status {
+struct sm_status {
 	string mon_name<SM_MAXSTRLEN>;
 	int state;
 	opaque priv[16];		/* stored private information */
Index: usr.sbin/rpc.statd/procs.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/rpc.statd/procs.c,v
retrieving revision 1.4
diff -u -r1.4 procs.c
--- usr.sbin/rpc.statd/procs.c	28 Aug 1999 01:19:37 -0000	1.4
+++ usr.sbin/rpc.statd/procs.c	3 Apr 2002 19:07:51 -0000
@@ -301,7 +301,7 @@
   struct timeval timeout = { 20, 0 };	/* 20 secs timeout		*/
   CLIENT *cli;
   static char dummy; 
-  status tx_arg;		/* arg sent to callback procedure	*/
+  sm_status tx_arg;		/* arg sent to callback procedure	*/
   MonList *lp;
   HostInfo *hp;
   pid_t pid;
@@ -340,7 +340,7 @@
     }
     else
     {
-      if (clnt_call(cli, lp->notifyProc, xdr_status, &tx_arg, xdr_void, &dummy,
+      if (clnt_call(cli, lp->notifyProc, xdr_sm_status, &tx_arg, xdr_void, &dummy,
         timeout) != RPC_SUCCESS)
       {
         syslog(LOG_ERR, "Failed to call rpc.statd client at host %s",
Index: usr.sbin/rpc.statd/statd.h
===================================================================
RCS file: /home/ncvs/src/usr.sbin/rpc.statd/statd.h,v
retrieving revision 1.2
diff -u -r1.2 statd.h
--- usr.sbin/rpc.statd/statd.h	1 Apr 1996 05:36:06 -0000	1.2
+++ usr.sbin/rpc.statd/statd.h	3 Apr 2002 19:56:35 -0000
@@ -35,20 +35,6 @@
 
 #include "sm_inter.h"
 
-/* These pieces are missing from the distributed sm_inter.x, which	*/
-/* omits the SM_NOTIFY procedure used between cooperating rpc.statd's	*/
-
-#define SM_NOTIFY ((u_long)6)
-extern void *sm_notify_1();
- 
-struct stat_chge
-{
-  char *mon_name;
-  int state;
-};
-typedef struct stat_chge stat_chge;
-bool_t xdr_stat_chge();
-
 /* ------------------------------------------------------------------------- */
 /*
   Data structures for recording monitored hosts



-- 
	Dan Nelson
	dnelson@allantgroup.com
Comment 2 Alfred Perlstein freebsd_committer freebsd_triage 2002-04-11 18:08:56 UTC
State Changed
From-To: open->closed

patch has been committed, thank you very much.