Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and add doc comments to the FreeBSD rc script #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jevonearth
Copy link
Contributor

These changes should remove the need for the FreeBSD port net/rtpproxy to patch the rc script. Adds comment documentation for each rc parameter. No parameters have been renamed, so existing deployments of the FreeBSD port will not break.


run_rc_command "${1}"
run_rc_command "$1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is superfluous. "${1}" is the same as "$1"

Copy link
Contributor Author

@jevonearth jevonearth Oct 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change to make it consistent with what the FreeBSD project ships in official rc scripts, and what is the apparent convention among most ports. It's not a functional change, but it makes the rc script consistent with the observed FreeBSD convention.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, arguably it's FreeBSD script that is inconsistent, so EWONTFIX. I prefer using ${} for all variables and not make exception for ${N}. I'd suggest to email port maintainer instead once we clean everything else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..by which I mean that once we've merged all functional changes I don't think there should be much resistance from maintainer for dropping out rc.d script from ports and replacing it with one supplied with the package regardless ${1} vs. $1. Making the proposed change in our repository would kinda imply that $1 is somehow better than ${1}, which it is not. Most people just use the former because it's shorter, I don't think there is any official style guide that prefers one over another esp in vendor-supplied scripts.

command=${prefix}/bin/rtpproxy
pidfile=/var/run/rtpproxy.pid


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line.


command_args="-l ${rtpproxy_laddr} -p /var/run/rtpproxy.pid"
command_args="-u ${rtpproxy_usr}:${rtpproxy_grp} -A ${rtpproxy_paddr} -F -l ${rtpproxy_laddr} \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if `-A 0.0.0.0' would do any good. Address after -A is taken as a string verbatim and injected into responses without any further checks. Have you tested with all default values? I'd suggest something like the following:

${rtpproxy_paddr:-""}
if [ ! -z "${rtpproxy_paddr}" ]
then
command_args="${command_args} -A ${rtpproxy_paddr}"
fi

I also pretty sure that running rtpproxy with "-l 0.0.0.0" is not the same as running rtpproxy without "-l" altogether, so that the same logic might be needed for that one too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to investigate. I did some basic testing, but not enough. This approach was actually taken from the rc patch file shipped with the public net/rtpproxy port.

Thanks!


command_args="-l ${rtpproxy_laddr} -p /var/run/rtpproxy.pid"
command_args="-u ${rtpproxy_usr}:${rtpproxy_grp} -A ${rtpproxy_paddr} -F -l ${rtpproxy_laddr} \
-s ${rtpproxy_ctrl_socket} -d INFO -p /var/run/rtpproxy.pid ${rtpproxy_args}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/var/run/rtpproxy.pid -> "${pidfile}"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, will change.

@sobomax
Copy link
Member

sobomax commented Oct 31, 2016

P.S. I'd also suggest you to check our startup script in the softswicth to see what other options we are setting up and make provisions for those. So at some point we can possibly drop that and replace it with a stock one. Also good to have those documented and readily available for anyone to consider. Some of those options are:

-n set b2bua notification socket for disconnect-on-timeout notifications
-L set max. number of file descriptors that we are going to use
-m set min. UDP port number that we are allowed to use
-M set max. UDP port number that we are allowed to use

@sobomax sobomax force-pushed the master branch 6 times, most recently from 55700ad to 2131bec Compare January 13, 2023 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants