Version 2 of YP uses TS-RPC and supports only IPv4 addresses. I am updating version 2 to use TI-RPC and adding support for IPv4/IPv6 in version 3.
### Compile
1. To update the object file,`cd /usr/src/include/rpcsvc/ && make all install` // Header
2. we need to update the linker file in lib/libc/yp/.`cd /usr/src/lib/libc/ && make all install` // Linker, However, running `make all install` in lib/libc/ will result inmet errors "
```
yp_xdr.c:277:2: error: must use 'struct' tag to refer to type 'netbuf' "
277 | netbuf **pp = &objp->ypbind_svcaddr;
| ^
| struct
1 error generated.
*** Error code 1
2. Run `Stop.
make all install` in include/rpcsvc to generate and install "yp.h" from "yp.x".
: stopped in /usr/src/lib/libc
```
3. Run `make all install` in `cd /usr/src/usr.sbin/ypbind/ to compile `&& make all install` // ypbind`. (RPC client)
### TI-RPC Changes
1. I replaced `svcudp_create` and `svctcp_create` with `getnetconfig`, `svc_tp_create`, and `svc_reg` within a while loop. This change binds version 3 of ypbind on every netconfig and binds version 2 of ypbind specifically on IPv4 over UDP/TCP.
2. I use `rpcb_unset` nstead of `pmap_unset` to unset any program before registering in the main and terminate functions. `pmap_unset` uses portmap to unset, while `rpcb_unset` uses rpcbind to unset the mapper.
3. Replaced `clntudp_bufcreate` with `clnt_dg_create`. Added a timeout using `clnt_control` because `clnt_dg_create` lacks a timeout parameter.
4. Replaced `clntudp_create` with `clnt_create`.
5. Replaced `clnt_broadcast` with `rpc_broadcast`. `clnt_broadcast` only broadcasts to portmap, whereas `rpc_broadcast` broadcasts to both portmap and rpcbind.
### Version 3 ypbind
1. I have included some version 3 data structures in "yp.x".
1. Use new `_dom_binding`. It is very similar to the old one, except for the address. Version 3 uses a new data structure, `ypbind_binding_3`, to represent addresses.
2. Use `ypbind_setdom_3` to replace `ypbind_setdom`. The difference is that version 3 uses the new `ypbind_binding_3` structure.
3. Use `ypbind_resp_3` to replace `ypbind_resp`, with the main difference still being `ypbind_binding_3`.
2. I have added version 3 functions like `ypbindprog_3`, `ypbindproc_domain_3_yp`, and `ypbindproc_setdom_3_yp`, following Sun's implementation. In their code, version 2 structures are converted to version 3 structures before calling version 3 functions.
3. I also revised the "yp_ping.c" function to support `struct sockaddr *`.
I couldn't fully test it as my test environment does not have a YP server.