-
Notifications
You must be signed in to change notification settings - Fork 52
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
ifup-routes: print warning when ADDRESS0 entry is missing #475
ifup-routes: print warning when ADDRESS0 entry is missing #475
Conversation
When static routes are added via route-<interface> file, the ifup-routes script will skip adding routes if entries not starting with ADDRESS0. Good to print a warning so that users are aware of this.
@@ -14,6 +14,13 @@ | |||
handle_file () { | |||
. $1 | |||
routenum=0 | |||
|
|||
# print a warning if ADDRESS is not starting at ADDRESS0 | |||
if [ "x$(eval echo '$'ADDRESS$routenum)x" == "xx" ]; then |
Check warning
Code scanning / shellcheck
Avoid x-prefix in comparisons as it no longer serves a purpose. Warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
@@ -14,6 +14,13 @@ MATCH='^[[:space:]]*(\#.*)?$' | |||
handle_file () { | |||
. $1 | |||
routenum=0 | |||
|
|||
# print a warning if ADDRESS is not starting at ADDRESS0 | |||
if [ "x$(eval echo '$'ADDRESS$routenum)x" == "xx" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks, fine but two small nitpicks for the future. Since the routenum is always 0, the whole eval shenanigan is unnecessary. Simple [ -z "$ADDRESS0" ] would be much nicer.
# print a warning if ADDRESS is not starting at ADDRESS0 | ||
if [ "x$(eval echo '$'ADDRESS$routenum)x" == "xx" ]; then | ||
net_log $"Route entries are not sequentially ordered. Skipping $1 file" warning | ||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THis can potentially change the behaviour.
Hi all, Thanks for the review and for accepting the patch. regards |
When static routes are added via route- file, the ifup-routes script will skip adding routes if entries not starting with ADDRESS0.
Good to print a warning so that users are aware of this.