Re: svn commit: r345400 - in head/libexec/rc: . rc.d

2019-03-23 Thread Cy Schubert
In message <20190323.125853.93885646440204179@allbsd.org>, Hiroki 
Sato writ
es:
> Security_Multipart(Sat_Mar_23_12_58_53_2019_110)--
> Content-Type: Text/Plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Cy Schubert  wrote
>   in <201903220130.x2m1uq0p042...@repo.freebsd.org>:
>
> cy> Author: cy
> cy> Date: Fri Mar 22 01:30:51 2019
> cy> New Revision: 345400
> cy> URL: https://svnweb.freebsd.org/changeset/base/345400
> cy>
> cy> Log:
> cy>   Add rc.d support for ippool(8).
> cy>
> cy>   I've been using ippool at my site for approximately two years. It's
> cy>   about time this was committed.
> cy>
> cy>   PR: 218433
> cy>   MFC after:  2 weeks
>
> cy> Added: head/libexec/rc/rc.d/ippool
> cy> =
> =
> cy> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> cy> +++ head/libexec/rc/rc.d/ippool   Fri Mar 22 01:30:51 2019(r34540
> 0)
> cy> @@ -0,0 +1,40 @@
> cy> +#!/bin/sh
> cy> +#
> cy> +# $FreeBSD$
> cy> +#
> cy> +
> cy> +# PROVIDE: ippool
> cy> +# REQUIRE: FILESYSTEMS
> cy> +# BEFORE:  ipfilter
> cy> +# KEYWORD: nojail
> cy> +
> cy> +. /etc/rc.subr
> cy> +
> cy> +name="ippool"
> cy> +desc="user interface to the IPFilter pools"
> cy> +rcvar="ippool_enable"
> cy> +load_rc_config $name
> cy> +start_cmd="ippool_start"
> cy> +stop_cmd="${ippool_program} -F"
> cy> +reload_cmd="ippool_reload"
> cy> +extra_commands="reload"
> cy> +required_files="${ippool_rules}"
> cy> +required_modules="ipl:ipfilter"
> cy> +
> cy> +ippool_start()
> cy> +{
> cy> + if [ -r "${ippool_rules}" ]; then
> cy> + echo "Loading IP Pools."
> cy> + ${ippool_program} -f ${ippool_rules} ${ippool_flags}
> cy> + fi
>
>  This conditional is redundant.  $required_files will check
>  readability of $ippool_rules.
>
>  And if you want to add a flag, use of precmd is the right way like
>  the following:
>
> 
>  start_precmd="ippool_start_precmd"
>
>  ippool_start_precmd()
>  {
>   rc_flags="-f ${ippool_rules} ${rc_flags}"
>  }
> 

Thanks for this. Fixed.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r345400 - in head/libexec/rc: . rc.d

2019-03-23 Thread Hiroki Sato
Cy Schubert  wrote
  in <201903220130.x2m1uq0p042...@repo.freebsd.org>:

cy> Author: cy
cy> Date: Fri Mar 22 01:30:51 2019
cy> New Revision: 345400
cy> URL: https://svnweb.freebsd.org/changeset/base/345400
cy>
cy> Log:
cy>   Add rc.d support for ippool(8).
cy>
cy>   I've been using ippool at my site for approximately two years. It's
cy>   about time this was committed.
cy>
cy>   PR:   218433
cy>   MFC after:2 weeks

cy> Added: head/libexec/rc/rc.d/ippool
cy> 
==
cy> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
cy> +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019
(r345400)
cy> @@ -0,0 +1,40 @@
cy> +#!/bin/sh
cy> +#
cy> +# $FreeBSD$
cy> +#
cy> +
cy> +# PROVIDE: ippool
cy> +# REQUIRE: FILESYSTEMS
cy> +# BEFORE:  ipfilter
cy> +# KEYWORD: nojail
cy> +
cy> +. /etc/rc.subr
cy> +
cy> +name="ippool"
cy> +desc="user interface to the IPFilter pools"
cy> +rcvar="ippool_enable"
cy> +load_rc_config $name
cy> +start_cmd="ippool_start"
cy> +stop_cmd="${ippool_program} -F"
cy> +reload_cmd="ippool_reload"
cy> +extra_commands="reload"
cy> +required_files="${ippool_rules}"
cy> +required_modules="ipl:ipfilter"
cy> +
cy> +ippool_start()
cy> +{
cy> +   if [ -r "${ippool_rules}" ]; then
cy> +   echo "Loading IP Pools."
cy> +   ${ippool_program} -f ${ippool_rules} ${ippool_flags}
cy> +   fi

 This conditional is redundant.  $required_files will check
 readability of $ippool_rules.

 And if you want to add a flag, use of precmd is the right way like
 the following:


 start_precmd="ippool_start_precmd"

 ippool_start_precmd()
 {
rc_flags="-f ${ippool_rules} ${rc_flags}"
 }


-- Hiroki


pgpFuxsVkUvCd.pgp
Description: PGP signature


Re: svn commit: r345400 - in head/libexec/rc: . rc.d

2019-03-22 Thread Cy Schubert
In message <201903220517.x2m5hbqg063...@gndrsh.dnsmgr.net>, "Rodney W. 
Grimes"
writes:
> > Author: cy
> > Date: Fri Mar 22 01:30:51 2019
> > New Revision: 345400
> > URL: https://svnweb.freebsd.org/changeset/base/345400
> > 
> > Log:
> >   Add rc.d support for ippool(8).
> >   
> >   I've been using ippool at my site for approximately two years. It's
> >   about time this was committed.
> >   
> >   PR:   218433
> >   MFC after:2 weeks
> > 
> > Added:
> >   head/libexec/rc/rc.d/ippool   (contents, props changed)
> > Modified:
> >   head/libexec/rc/rc.conf
> > 
> > Modified: head/libexec/rc/rc.conf
> > ===
> ===
> > --- head/libexec/rc/rc.conf Thu Mar 21 23:31:10 2019(r345399)
> > +++ head/libexec/rc/rc.conf Fri Mar 22 01:30:51 2019(r345400)
> > @@ -196,6 +196,10 @@ ipfilter_program="/sbin/ipf"   # where the ipfilter pr
> og
> >  ipfilter_rules="/etc/ipf.rules"# rules definition file for ipfilter, s
> ee
> > # /usr/src/contrib/ipfilter/rules for examples
> >  ipfilter_flags=""  # additional flags for ipfilter
> > +ippool_enable="NO" # Set to YES to enable ip filter pools
> > +ippool_program="/sbin/ippool"  # where the ippool program lives
> > +ippool_rules="/etc/ippool.tables"  # rules definition file for ippool
> > +ippool_flags=""# additional flags for ippool
> >  ipnat_enable="NO"  # Set to YES to enable ipnat functionality
> >  ipnat_program="/sbin/ipnat"# where the ipnat program lives
> >  ipnat_rules="/etc/ipnat.rules" # rules definition file for ipnat
> > 
> > Added: head/libexec/rc/rc.d/ippool
> > ===
> ===
> > --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> > +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019(r34540
> 0)
> > @@ -0,0 +1,40 @@
> > +#!/bin/sh
> > +#
> > +# $FreeBSD$
> > +#
> > +
> > +# PROVIDE: ippool
> > +# REQUIRE: FILESYSTEMS
> > +# BEFORE:  ipfilter
> > +# KEYWORD: nojail
> > +
> > +. /etc/rc.subr
> > +
> > +name="ippool"
> > +desc="user interface to the IPFilter pools"
> > +rcvar="ippool_enable"
> > +load_rc_config $name
> > +start_cmd="ippool_start"
> > +stop_cmd="${ippool_program} -F"
> > +reload_cmd="ippool_reload"
> > +extra_commands="reload"
> > +required_files="${ippool_rules}"
> > +required_modules="ipl:ipfilter"
> > +
> > +ippool_start()
> > +{
> > +   if [ -r "${ippool_rules}" ]; then
> > +   echo "Loading IP Pools."
> > +   ${ippool_program} -f ${ippool_rules} ${ippool_flags}
> > +   fi
> > +}
> > +
> > +ippool_reload()
> > +{
> > +   echo "Reloading IP Pools."
> > +   ${ippool_program} -F
> > +   ippool_start
>
> Couldnt this better be expressed
>   ${stop_cmd}
>   ${start_cmd}
>

Yes. I'll fix that.

> > +}
> > +
> > +
> > +run_rc_command "$1"
> > 
> > 
>
> -- 
> Rod Grimes rgri...@freebsd.or
> g
>



-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r345400 - in head/libexec/rc: . rc.d

2019-03-21 Thread Rodney W. Grimes
> Author: cy
> Date: Fri Mar 22 01:30:51 2019
> New Revision: 345400
> URL: https://svnweb.freebsd.org/changeset/base/345400
> 
> Log:
>   Add rc.d support for ippool(8).
>   
>   I've been using ippool at my site for approximately two years. It's
>   about time this was committed.
>   
>   PR: 218433
>   MFC after:  2 weeks
> 
> Added:
>   head/libexec/rc/rc.d/ippool   (contents, props changed)
> Modified:
>   head/libexec/rc/rc.conf
> 
> Modified: head/libexec/rc/rc.conf
> ==
> --- head/libexec/rc/rc.conf   Thu Mar 21 23:31:10 2019(r345399)
> +++ head/libexec/rc/rc.conf   Fri Mar 22 01:30:51 2019(r345400)
> @@ -196,6 +196,10 @@ ipfilter_program="/sbin/ipf" # where the ipfilter 
> prog
>  ipfilter_rules="/etc/ipf.rules"  # rules definition file for ipfilter, 
> see
>   # /usr/src/contrib/ipfilter/rules for examples
>  ipfilter_flags=""# additional flags for ipfilter
> +ippool_enable="NO"   # Set to YES to enable ip filter pools
> +ippool_program="/sbin/ippool"# where the ippool program lives
> +ippool_rules="/etc/ippool.tables"# rules definition file for ippool
> +ippool_flags=""  # additional flags for ippool
>  ipnat_enable="NO"# Set to YES to enable ipnat functionality
>  ipnat_program="/sbin/ipnat"  # where the ipnat program lives
>  ipnat_rules="/etc/ipnat.rules"   # rules definition file for ipnat
> 
> Added: head/libexec/rc/rc.d/ippool
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/libexec/rc/rc.d/ippool   Fri Mar 22 01:30:51 2019
> (r345400)
> @@ -0,0 +1,40 @@
> +#!/bin/sh
> +#
> +# $FreeBSD$
> +#
> +
> +# PROVIDE: ippool
> +# REQUIRE: FILESYSTEMS
> +# BEFORE:  ipfilter
> +# KEYWORD: nojail
> +
> +. /etc/rc.subr
> +
> +name="ippool"
> +desc="user interface to the IPFilter pools"
> +rcvar="ippool_enable"
> +load_rc_config $name
> +start_cmd="ippool_start"
> +stop_cmd="${ippool_program} -F"
> +reload_cmd="ippool_reload"
> +extra_commands="reload"
> +required_files="${ippool_rules}"
> +required_modules="ipl:ipfilter"
> +
> +ippool_start()
> +{
> + if [ -r "${ippool_rules}" ]; then
> + echo "Loading IP Pools."
> + ${ippool_program} -f ${ippool_rules} ${ippool_flags}
> + fi
> +}
> +
> +ippool_reload()
> +{
> + echo "Reloading IP Pools."
> + ${ippool_program} -F
> + ippool_start

Couldnt this better be expressed
${stop_cmd}
${start_cmd}

> +}
> +
> +
> +run_rc_command "$1"
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r345400 - in head/libexec/rc: . rc.d

2019-03-21 Thread Cy Schubert
Author: cy
Date: Fri Mar 22 01:30:51 2019
New Revision: 345400
URL: https://svnweb.freebsd.org/changeset/base/345400

Log:
  Add rc.d support for ippool(8).
  
  I've been using ippool at my site for approximately two years. It's
  about time this was committed.
  
  PR:   218433
  MFC after:2 weeks

Added:
  head/libexec/rc/rc.d/ippool   (contents, props changed)
Modified:
  head/libexec/rc/rc.conf

Modified: head/libexec/rc/rc.conf
==
--- head/libexec/rc/rc.conf Thu Mar 21 23:31:10 2019(r345399)
+++ head/libexec/rc/rc.conf Fri Mar 22 01:30:51 2019(r345400)
@@ -196,6 +196,10 @@ ipfilter_program="/sbin/ipf"   # where the ipfilter 
prog
 ipfilter_rules="/etc/ipf.rules"# rules definition file for ipfilter, 
see
# /usr/src/contrib/ipfilter/rules for examples
 ipfilter_flags=""  # additional flags for ipfilter
+ippool_enable="NO" # Set to YES to enable ip filter pools
+ippool_program="/sbin/ippool"  # where the ippool program lives
+ippool_rules="/etc/ippool.tables"  # rules definition file for ippool
+ippool_flags=""# additional flags for ippool
 ipnat_enable="NO"  # Set to YES to enable ipnat functionality
 ipnat_program="/sbin/ipnat"# where the ipnat program lives
 ipnat_rules="/etc/ipnat.rules" # rules definition file for ipnat

Added: head/libexec/rc/rc.d/ippool
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019(r345400)
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: ippool
+# REQUIRE: FILESYSTEMS
+# BEFORE:  ipfilter
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="ippool"
+desc="user interface to the IPFilter pools"
+rcvar="ippool_enable"
+load_rc_config $name
+start_cmd="ippool_start"
+stop_cmd="${ippool_program} -F"
+reload_cmd="ippool_reload"
+extra_commands="reload"
+required_files="${ippool_rules}"
+required_modules="ipl:ipfilter"
+
+ippool_start()
+{
+   if [ -r "${ippool_rules}" ]; then
+   echo "Loading IP Pools."
+   ${ippool_program} -f ${ippool_rules} ${ippool_flags}
+   fi
+}
+
+ippool_reload()
+{
+   echo "Reloading IP Pools."
+   ${ippool_program} -F
+   ippool_start
+}
+
+
+run_rc_command "$1"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"