Re: pipex(4)/npppd(8): remove dummy PIPEX{G,S}MODE ioctl(2) calls

2021-01-02 Thread YASUOKA Masahiko
Yes,

ok yasuoka

On Wed, 30 Dec 2020 03:02:55 +0300
Vitaliy Makkoveev  wrote:
> This time pipex(4) related ioctl(2) calls PIPEX{S,G}MODE are pretty 
> dummy and were kept for backward compatibility reasons. The diff below
> removes them.
> 
> ok?
> 
> Index: share/man/man4/pipex.4
> ===
> RCS file: /cvs/src/share/man/man4/pipex.4,v
> retrieving revision 1.13
> diff -u -p -r1.13 pipex.4
> --- share/man/man4/pipex.49 Aug 2020 14:35:31 -   1.13
> +++ share/man/man4/pipex.429 Dec 2020 23:51:57 -
> @@ -57,20 +57,6 @@ or
>  devices.
>  The added requests are as follows:
>  .Bl -tag -width Ds
> -.It Dv PIPEXGMODEFa "int *"
> -Get the devices's
> -.Nm
> -operation mode.
> -1 to enable
> -.Nm
> -on this device; 0 to disable.
> -.It Dv PIPEXSMODEFa "int *"
> -Set the device's
> -.Nm
> -operation mode.
> -1 to enable
> -.Nm
> -on this device; 0 to disable.
>  .It Dv PIPEXASESSION Fa "struct pipex_session_req *"
>  Add a new PPP session to be handled by
>  .Nm .
> Index: sys/net/pipex.c
> ===
> RCS file: /cvs/src/sys/net/pipex.c,v
> retrieving revision 1.127
> diff -u -p -r1.127 pipex.c
> --- sys/net/pipex.c   30 Aug 2020 19:48:16 -  1.127
> +++ sys/net/pipex.c   29 Dec 2020 23:51:59 -
> @@ -163,13 +163,6 @@ pipex_ioctl(void *ownersc, u_long cmd, c
>  
>   NET_ASSERT_LOCKED();
>   switch (cmd) {
> - case PIPEXSMODE:
> - break;
> -
> - case PIPEXGMODE:
> - *(int *)data = 1;
> - break;
> -
>   case PIPEXCSESSION:
>   ret = pipex_config_session(
>   (struct pipex_session_config_req *)data, ownersc);
> Index: sys/net/pipex.h
> ===
> RCS file: /cvs/src/sys/net/pipex.h,v
> retrieving revision 1.28
> diff -u -p -r1.28 pipex.h
> --- sys/net/pipex.h   27 Aug 2020 10:47:52 -  1.28
> +++ sys/net/pipex.h   29 Dec 2020 23:51:59 -
> @@ -165,8 +165,6 @@ struct pipex_session_descr_req {
>  
>  
>  /* PIPEX ioctls */
> -#define PIPEXSMODE   _IOW ('p',  1, int)
> -#define PIPEXGMODE   _IOR ('p',  2, int)
>  #define PIPEXASESSION_IOW ('p',  3, struct pipex_session_req)
>  #define PIPEXDSESSION_IOWR('p',  4, struct pipex_session_close_req)
>  #define PIPEXCSESSION_IOW ('p',  5, struct pipex_session_config_req)
> Index: usr.sbin/npppd/npppd/npppd_iface.c
> ===
> RCS file: /cvs/src/usr.sbin/npppd/npppd/npppd_iface.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 npppd_iface.c
> --- usr.sbin/npppd/npppd/npppd_iface.c5 Dec 2015 16:10:31 -   
> 1.13
> +++ usr.sbin/npppd/npppd/npppd_iface.c29 Dec 2020 23:52:00 -
> @@ -96,11 +96,6 @@ static void  npppd_iface_io_event_handle
>  static int   npppd_iface_log (npppd_iface *, int, const char *, ...)
>   __printflike(3,4);
>  
> -#ifdef USE_NPPPD_PIPEX
> -static int npppd_iface_pipex_enable(npppd_iface *_this);
> -static int npppd_iface_pipex_disable(npppd_iface *_this);
> -#endif /* USE_NPPPD_PIPEX */
> -
>  
>  /** initialize npppd_iface */
>  void
> @@ -311,12 +306,7 @@ npppd_iface_start(npppd_iface *_this)
>   goto fail;
>   }
>  
> -#ifdef USE_NPPPD_PIPEX
> - if (npppd_iface_pipex_enable(_this) != 0) {
> - log_printf(LOG_WARNING,
> - "npppd_iface_pipex_enable() failed: %m");
> - }
> -#else
> +#ifndef USE_NPPPD_PIPEX
>   if (_this->using_pppx) {
>   npppd_iface_log(_this, LOG_ERR,
>   "pipex is required when using pppx interface");
> @@ -358,13 +348,6 @@ npppd_iface_stop(npppd_iface *_this)
>   in_host_route_delete(&_this->ip4addr, &gw);
>   }
>   if (_this->devf >= 0) {
> -#ifdef USE_NPPPD_PIPEX
> - if (npppd_iface_pipex_disable(_this) != 0) {
> - log_printf(LOG_CRIT,
> - "npppd_iface_pipex_disable() failed: %m");
> - }
> -#endif /* USE_NPPPD_PIPEX */
> -
>   event_del(&_this->ev);
>   close(_this->devf);
>   npppd_iface_log(_this, LOG_INFO, "Stopped");
> @@ -381,32 +364,6 @@ npppd_iface_fini(npppd_iface *_this)
>   NPPPD_IFACE_ASSERT(_this != NULL);
>   _this->initialized = 0;
>  }
> -
> -
> -/***
> - * PIPEX related functions
> - ***/
> -#ifdef USE_NPPPD_PIPEX
> -
> -/** enable PIPEX on PPPAC interface */
> -int
> -npppd_iface_pipex_enable(npppd_iface *_this)
> -{
> - int enable = 1;
> -
> - return ioctl(_this->devf, PIPEXSMODE, &enable);
> -}
> -
> -/** disable PIPEX on PPPAC interface */
> -int
> -npppd_iface_pipex_disable(npppd_iface *_this)
> -{
> - int disable = 0;
> -
> - 

pipex(4)/npppd(8): remove dummy PIPEX{G,S}MODE ioctl(2) calls

2020-12-29 Thread Vitaliy Makkoveev
This time pipex(4) related ioctl(2) calls PIPEX{S,G}MODE are pretty 
dummy and were kept for backward compatibility reasons. The diff below
removes them.

ok?

Index: share/man/man4/pipex.4
===
RCS file: /cvs/src/share/man/man4/pipex.4,v
retrieving revision 1.13
diff -u -p -r1.13 pipex.4
--- share/man/man4/pipex.4  9 Aug 2020 14:35:31 -   1.13
+++ share/man/man4/pipex.4  29 Dec 2020 23:51:57 -
@@ -57,20 +57,6 @@ or
 devices.
 The added requests are as follows:
 .Bl -tag -width Ds
-.It Dv PIPEXGMODEFa "int *"
-Get the devices's
-.Nm
-operation mode.
-1 to enable
-.Nm
-on this device; 0 to disable.
-.It Dv PIPEXSMODEFa "int *"
-Set the device's
-.Nm
-operation mode.
-1 to enable
-.Nm
-on this device; 0 to disable.
 .It Dv PIPEXASESSION Fa "struct pipex_session_req *"
 Add a new PPP session to be handled by
 .Nm .
Index: sys/net/pipex.c
===
RCS file: /cvs/src/sys/net/pipex.c,v
retrieving revision 1.127
diff -u -p -r1.127 pipex.c
--- sys/net/pipex.c 30 Aug 2020 19:48:16 -  1.127
+++ sys/net/pipex.c 29 Dec 2020 23:51:59 -
@@ -163,13 +163,6 @@ pipex_ioctl(void *ownersc, u_long cmd, c
 
NET_ASSERT_LOCKED();
switch (cmd) {
-   case PIPEXSMODE:
-   break;
-
-   case PIPEXGMODE:
-   *(int *)data = 1;
-   break;
-
case PIPEXCSESSION:
ret = pipex_config_session(
(struct pipex_session_config_req *)data, ownersc);
Index: sys/net/pipex.h
===
RCS file: /cvs/src/sys/net/pipex.h,v
retrieving revision 1.28
diff -u -p -r1.28 pipex.h
--- sys/net/pipex.h 27 Aug 2020 10:47:52 -  1.28
+++ sys/net/pipex.h 29 Dec 2020 23:51:59 -
@@ -165,8 +165,6 @@ struct pipex_session_descr_req {
 
 
 /* PIPEX ioctls */
-#define PIPEXSMODE _IOW ('p',  1, int)
-#define PIPEXGMODE _IOR ('p',  2, int)
 #define PIPEXASESSION  _IOW ('p',  3, struct pipex_session_req)
 #define PIPEXDSESSION  _IOWR('p',  4, struct pipex_session_close_req)
 #define PIPEXCSESSION  _IOW ('p',  5, struct pipex_session_config_req)
Index: usr.sbin/npppd/npppd/npppd_iface.c
===
RCS file: /cvs/src/usr.sbin/npppd/npppd/npppd_iface.c,v
retrieving revision 1.13
diff -u -p -r1.13 npppd_iface.c
--- usr.sbin/npppd/npppd/npppd_iface.c  5 Dec 2015 16:10:31 -   1.13
+++ usr.sbin/npppd/npppd/npppd_iface.c  29 Dec 2020 23:52:00 -
@@ -96,11 +96,6 @@ static void  npppd_iface_io_event_handle
 static int   npppd_iface_log (npppd_iface *, int, const char *, ...)
__printflike(3,4);
 
-#ifdef USE_NPPPD_PIPEX
-static int npppd_iface_pipex_enable(npppd_iface *_this);
-static int npppd_iface_pipex_disable(npppd_iface *_this);
-#endif /* USE_NPPPD_PIPEX */
-
 
 /** initialize npppd_iface */
 void
@@ -311,12 +306,7 @@ npppd_iface_start(npppd_iface *_this)
goto fail;
}
 
-#ifdef USE_NPPPD_PIPEX
-   if (npppd_iface_pipex_enable(_this) != 0) {
-   log_printf(LOG_WARNING,
-   "npppd_iface_pipex_enable() failed: %m");
-   }
-#else
+#ifndef USE_NPPPD_PIPEX
if (_this->using_pppx) {
npppd_iface_log(_this, LOG_ERR,
"pipex is required when using pppx interface");
@@ -358,13 +348,6 @@ npppd_iface_stop(npppd_iface *_this)
in_host_route_delete(&_this->ip4addr, &gw);
}
if (_this->devf >= 0) {
-#ifdef USE_NPPPD_PIPEX
-   if (npppd_iface_pipex_disable(_this) != 0) {
-   log_printf(LOG_CRIT,
-   "npppd_iface_pipex_disable() failed: %m");
-   }
-#endif /* USE_NPPPD_PIPEX */
-
event_del(&_this->ev);
close(_this->devf);
npppd_iface_log(_this, LOG_INFO, "Stopped");
@@ -381,32 +364,6 @@ npppd_iface_fini(npppd_iface *_this)
NPPPD_IFACE_ASSERT(_this != NULL);
_this->initialized = 0;
 }
-
-
-/***
- * PIPEX related functions
- ***/
-#ifdef USE_NPPPD_PIPEX
-
-/** enable PIPEX on PPPAC interface */
-int
-npppd_iface_pipex_enable(npppd_iface *_this)
-{
-   int enable = 1;
-
-   return ioctl(_this->devf, PIPEXSMODE, &enable);
-}
-
-/** disable PIPEX on PPPAC interface */
-int
-npppd_iface_pipex_disable(npppd_iface *_this)
-{
-   int disable = 0;
-
-   return ioctl(_this->devf, PIPEXSMODE, &disable);
-}
-
-#endif /* USE_NPPPD_PIPEX */
 
 
 /***