]> git.ipfire.org Git - people/ms/network.git/log
people/ms/network.git
6 years agosecurity-polices: Create a system policy
Michael Tremer [Wed, 19 Jul 2017 19:04:26 +0000 (21:04 +0200)] 
security-polices: Create a system policy

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agosecurity-policies: Show policy after it has been created
Michael Tremer [Wed, 19 Jul 2017 19:04:04 +0000 (21:04 +0200)] 
security-policies: Show policy after it has been created

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agosecurity-policies: Check if default policy exists
Michael Tremer [Wed, 19 Jul 2017 18:53:55 +0000 (20:53 +0200)] 
security-policies: Check if default policy exists

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agocopy: Do not empty $dst when source file cannot be read
Michael Tremer [Wed, 19 Jul 2017 18:50:48 +0000 (20:50 +0200)] 
copy: Do not empty $dst when source file cannot be read

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agosecurity-polcies: Only allow creating one policy at a time
Michael Tremer [Wed, 19 Jul 2017 18:47:01 +0000 (20:47 +0200)] 
security-polcies: Only allow creating one policy at a time

This keeps the function easier and lets it return a better error code
when ever something goes wrong.

I don't expect to do anyone doing this in bulk.

I also changed some of the error messages.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agosecurity-policies: Improve coding style
Michael Tremer [Wed, 19 Jul 2017 18:38:02 +0000 (20:38 +0200)] 
security-policies: Improve coding style

No functional changes.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agocopy: Remove trailing dot from log message
Michael Tremer [Wed, 19 Jul 2017 17:11:54 +0000 (19:11 +0200)] 
copy: Remove trailing dot from log message

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agocopy: Move comment to right spot
Michael Tremer [Wed, 19 Jul 2017 17:11:33 +0000 (19:11 +0200)] 
copy: Move comment to right spot

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agocopy: Make function handle paths with spaces
Michael Tremer [Wed, 19 Jul 2017 17:11:08 +0000 (19:11 +0200)] 
copy: Make function handle paths with spaces

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoAdd vpn security policies to cli
Jonatan Schlag [Mon, 17 Jul 2017 19:05:18 +0000 (21:05 +0200)] 
Add vpn security policies to cli

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agohook: return error codes to previos functions
Jonatan Schlag [Wed, 19 Jul 2017 14:10:22 +0000 (16:10 +0200)] 
hook: return error codes to previos functions

When we call an hook we should not exit with the error code.
Instead we should return the code to the function that called that hook function.
So we candle handle errors better.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: fix zone_new
Jonatan Schlag [Wed, 19 Jul 2017 14:10:21 +0000 (16:10 +0200)] 
zone: fix zone_new

Everytime somethings goes wrong when we call hook_new we wannt to call zone_destroy.
Not only when we get an EXIT_ERROR also when we get an EXIT_CONF_ERROR and so on.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoheader-zone: refactor hook_edit nad hook_new
Jonatan Schlag [Wed, 19 Jul 2017 14:10:20 +0000 (16:10 +0200)] 
header-zone: refactor hook_edit nad hook_new

We now return error codes and break when something important goes wrong.
because of that, we have to split hook_new and hook_edit.
When zone_settins-read fails in hook_edit we cannot go but it would every time we would call it in hook_new.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoipv4-static: create hook_parse_cmdline function
Jonatan Schlag [Wed, 19 Jul 2017 08:52:38 +0000 (10:52 +0200)] 
ipv4-static: create hook_parse_cmdline function

This patch just split the parsing of the cmd line
into a separate function to allowing an edit with the generic hook_edit function.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoipv6-auto: create hook_parse_cmdline function
Jonatan Schlag [Wed, 19 Jul 2017 08:52:37 +0000 (10:52 +0200)] 
ipv6-auto: create hook_parse_cmdline function

This patch just split the parsing of the cmd line
into a separate function to allowing an edit with the generic hook_edit function.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoipv6-static: create hook_parse_cmdline function
Jonatan Schlag [Wed, 19 Jul 2017 08:52:36 +0000 (10:52 +0200)] 
ipv6-static: create hook_parse_cmdline function

This patch just split the parsing of the cmd line
into a separate function to allowing an edit with the generic hook_edit function.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopppoe-server: create hook_parse_cmdline function
Jonatan Schlag [Wed, 19 Jul 2017 08:52:35 +0000 (10:52 +0200)] 
pppoe-server: create hook_parse_cmdline function

This patch just split the parsing of the cmd line
into a separate function to allowing an edit with the generic hook_edit function.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agolist: fix a bug
Jonatan Schlag [Wed, 19 Jul 2017 13:21:51 +0000 (15:21 +0200)] 
list: fix a bug

When the list is called "list" we have a problem because
${list}="list"
and ${!list}="list"
This creates effects nobody wants and which are also not so easy to understand.
To avoid such problems in the future we now throw an assertation when the list is called list.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoconfig: improve config_get_id_from_config and config_get_hook_from_config
Jonatan Schlag [Wed, 19 Jul 2017 08:23:20 +0000 (10:23 +0200)] 
config: improve config_get_id_from_config and config_get_hook_from_config

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoadd new feature vpn security policies
Jonatan Schlag [Mon, 17 Jul 2017 19:05:16 +0000 (21:05 +0200)] 
add new feature vpn security policies

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoconstants: add new constant NETWORK_SHARE_DIR
Jonatan Schlag [Mon, 17 Jul 2017 19:05:17 +0000 (21:05 +0200)] 
constants: add new constant NETWORK_SHARE_DIR

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoutil: add new function copy
Jonatan Schlag [Wed, 19 Jul 2017 08:09:44 +0000 (10:09 +0200)] 
util: add new function copy

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoRemove empty files
Michael Tremer [Thu, 6 Jul 2017 13:58:54 +0000 (15:58 +0200)] 
Remove empty files

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoRemember to start DHCP servers once started
Michael Tremer [Fri, 23 Sep 2016 19:42:44 +0000 (21:42 +0200)] 
Remember to start DHCP servers once started

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoheader-config: add generic hook_edit function
Jonatan Schlag [Mon, 17 Jul 2017 15:24:26 +0000 (17:24 +0200)] 
header-config: add generic hook_edit function

If a hook_parse-cmdline function exists
this functions allows it do edit the hook safely.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoconfig: add new functions
Jonatan Schlag [Mon, 17 Jul 2017 15:24:25 +0000 (17:24 +0200)] 
config: add new functions

This patch add two new functions:
config_get_id_from_config()
config_get_hook_from_config

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodhcp: check the config indide the hook_parse_cmdline() function
Jonatan Schlag [Mon, 17 Jul 2017 15:24:24 +0000 (17:24 +0200)] 
dhcp: check the config indide the hook_parse_cmdline() function

We now check the config inside the hook_parse_cmdline function.
This mae it possible ti use this function in a generic edit function.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoheader-zone fix hook_config_edit()
Jonatan Schlag [Mon, 17 Jul 2017 15:24:23 +0000 (17:24 +0200)] 
header-zone fix hook_config_edit()

This function accepted only two arguments so new cmd coudl be passed.
We accept now more then 2 arguments.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: fix zone_config()
Jonatan Schlag [Mon, 17 Jul 2017 15:24:22 +0000 (17:24 +0200)] 
zone: fix zone_config()

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDrop deprecated listlength function
Michael Tremer [Sat, 15 Jul 2017 00:56:16 +0000 (20:56 -0400)] 
Drop deprecated listlength function

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDrop deprecated listmatch function
Michael Tremer [Sat, 15 Jul 2017 00:55:52 +0000 (20:55 -0400)] 
Drop deprecated listmatch function

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDrop deprecated listsort function
Michael Tremer [Sat, 15 Jul 2017 00:54:27 +0000 (20:54 -0400)] 
Drop deprecated listsort function

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoImport CODING_STYLE
Michael Tremer [Sat, 15 Jul 2017 00:47:46 +0000 (20:47 -0400)] 
Import CODING_STYLE

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoMove license into docs directory
Michael Tremer [Sat, 15 Jul 2017 00:30:51 +0000 (20:30 -0400)] 
Move license into docs directory

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodhcp: remove useless delay setting
Jonatan Schlag [Fri, 14 Jul 2017 13:40:39 +0000 (15:40 +0200)] 
dhcp: remove useless delay setting

Fixes: #11420
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoutil: isbool accept now also true and false
Jonatan Schlag [Thu, 6 Jul 2017 13:28:40 +0000 (15:28 +0200)] 
util: isbool accept now also true and false

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoman: Fix grammar and spelling in color documentation
Michael Tremer [Wed, 12 Jul 2017 22:29:50 +0000 (18:29 -0400)] 
man: Fix grammar and spelling in color documentation

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoman: add documentation for the description command
Jonatan Schlag [Mon, 10 Jul 2017 15:10:42 +0000 (17:10 +0200)] 
man: add documentation for the description command

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoman: add color documentation
Jonatan Schlag [Mon, 10 Jul 2017 15:10:41 +0000 (17:10 +0200)] 
man: add color documentation

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodhcp: merge hooks ipv4-dhcp and ipv6-dhcp
Jonatan Schlag [Tue, 11 Jul 2017 14:43:02 +0000 (16:43 +0200)] 
dhcp: merge hooks ipv4-dhcp and ipv6-dhcp

Fixes: #11404
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: make edit syntax clear
Jonatan Schlag [Tue, 11 Jul 2017 15:05:42 +0000 (17:05 +0200)] 
zone: make edit syntax clear

Fixes: #11422
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: add new command config list
Jonatan Schlag [Mon, 10 Jul 2017 13:33:47 +0000 (15:33 +0200)] 
zone: add new command config list

With the new command
network <zone> config list
a user can get all configured configs with id and hook.

Fixes: #11407
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: Check early if a id is valid
Jonatan Schlag [Wed, 5 Jul 2017 14:19:53 +0000 (16:19 +0200)] 
zone: Check early if a id is valid

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: change edit syntax for config.
Jonatan Schlag [Wed, 5 Jul 2017 14:19:52 +0000 (16:19 +0200)] 
zone: change edit syntax for config.

The syntax to edit a config is now

network zone upl0 config <id> edit

similar to the syntax if a zone is edited.

The cmd variable is setted to the content of ${1},
because we need the content in this variable if the ${id} is not valid, to print a nice error message.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoheader-zone: refactor hook_config_edit
Jonatan Schlag [Wed, 5 Jul 2017 14:19:51 +0000 (16:19 +0200)] 
header-zone: refactor hook_config_edit

With the new id function this function gets a zone name and a id,
but hook_config_cmd needs also the name of the hook.

So this function now calls zone_config_get_hook_from_id to get the hook
and calls then hook_config_cmd with the correct argument order.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoheader-zone: refactor hook_config_destroy
Jonatan Schlag [Wed, 5 Jul 2017 14:19:50 +0000 (16:19 +0200)] 
header-zone: refactor hook_config_destroy

With the new id function this function gets a zone name and a id,
but hook_config_cmd needs also the name of the hook.

So this function now calls zone_config_get_hook_from_id to get the hook
and calls then hook_config_cmd with the correct argument order.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: Introduce id feature
Jonatan Schlag [Wed, 5 Jul 2017 14:19:49 +0000 (16:19 +0200)] 
zone: Introduce id feature

When we write a config for the frist time a unique id is generated and appended to the filename.
So it is possible to identify a config clearly.

The variable config is rename to hook because this function takes now
the name of the hook and the id. The name of the config is no more suitable.
If no id is passed we generate one.
This should only happen when we write the file for the first time.

Fixes: #11405
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: new function zone_config_get_hook_from_id
Jonatan Schlag [Wed, 5 Jul 2017 14:19:48 +0000 (16:19 +0200)] 
zone: new function zone_config_get_hook_from_id

This function is needed to implement the id feature
described in #11405

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: new function zone_config_id_is_valid
Jonatan Schlag [Wed, 5 Jul 2017 14:19:47 +0000 (16:19 +0200)] 
zone: new function zone_config_id_is_valid

This function is needed to implement the id feature
described in #11405

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: new function zone_config_get_new_id
Jonatan Schlag [Wed, 5 Jul 2017 14:19:46 +0000 (16:19 +0200)] 
zone: new function zone_config_get_new_id

This functions is needed to implement the new id feature
described in #11405

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoconfig: remove old hashes
Jonatan Schlag [Wed, 5 Jul 2017 14:02:36 +0000 (16:02 +0200)] 
config: remove old hashes

With the new id feature the old hashes are not necessary anymore.
The ipv6_hash function is dropped because we need this function no more.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agosettings: remove dot from log message
Jonatan Schlag [Wed, 5 Jul 2017 14:02:35 +0000 (16:02 +0200)] 
settings: remove dot from log message

The dots at the end of log messages can be confusing.
Especially behind variables,it is often unclear if the dot was part of the variable or not
which make debugging much harder.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopppoe-server: prevent multiple configs for the same zone
Jonatan Schlag [Tue, 4 Jul 2017 15:46:11 +0000 (17:46 +0200)] 
pppoe-server: prevent multiple configs for the same zone

It is senseless to configure the ppoe-server hook
multiple times for a zone.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoipv6-auto: prevent multiple configs for the same zone
Jonatan Schlag [Tue, 4 Jul 2017 15:46:10 +0000 (17:46 +0200)] 
ipv6-auto: prevent multiple configs for the same zone

It is senseless to configure the ipv6-auto hook
multiple times for a zone.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoipv6-dhcp: prevent multiple configs for the same zone
Jonatan Schlag [Tue, 4 Jul 2017 15:46:09 +0000 (17:46 +0200)] 
ipv6-dhcp: prevent multiple configs for the same zone

It is senseless to configure the ipv6-dhcp hook
multiple times for a zone.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoipv4-dhcp: prevent multiple configs for the same zone
Jonatan Schlag [Tue, 4 Jul 2017 15:46:08 +0000 (17:46 +0200)] 
ipv4-dhcp: prevent multiple configs for the same zone

It is senseless to configure the ipv4-dhcp hook
multiple times for a zone.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agozone: add function to avoid multiple configs which are senseless
Jonatan Schlag [Tue, 4 Jul 2017 15:46:07 +0000 (17:46 +0200)] 
zone: add function to avoid multiple configs which are senseless

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoinetcalc: do not print the default prefix
Jonatan Schlag [Tue, 4 Jul 2017 15:46:06 +0000 (17:46 +0200)] 
inetcalc: do not print the default prefix

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork check if a zone exist before executing commands
Jonatan Schlag [Wed, 21 Jun 2017 07:45:28 +0000 (09:45 +0200)] 
network check if a zone exist before executing commands

We checked if a zone name was valid so
network zone net0 ... fails when theres was no zone net0.
net0 is a valid zone name so we jumped into the wrong if part.
We now check if a zone exist and when now
network zone net0 ...  is called when no zone net0 exists
we print an error message.
This behaviour is similar to network port .., there we do the same thing with port_exists

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoautocompletion: add description support
Jonatan Schlag [Mon, 19 Jun 2017 19:20:50 +0000 (21:20 +0200)] 
autocompletion: add description support

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork: add description commands
Jonatan Schlag [Mon, 19 Jun 2017 19:20:49 +0000 (21:20 +0200)] 
network: add description commands

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agocli: print the description title
Jonatan Schlag [Mon, 19 Jun 2017 19:20:48 +0000 (21:20 +0200)] 
cli: print the description title

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoports/zones: Add higher level function to get the description title
Jonatan Schlag [Mon, 19 Jun 2017 19:20:47 +0000 (21:20 +0200)] 
ports/zones: Add higher level function to get the description title

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoAdd editor functions
Jonatan Schlag [Wed, 21 Jun 2017 12:07:14 +0000 (14:07 +0200)] 
Add editor functions

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoAdd new description functions
Jonatan Schlag [Wed, 21 Jun 2017 12:07:13 +0000 (14:07 +0200)] 
Add new description functions

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agolock: refactoring functions
Jonatan Schlag [Wed, 21 Jun 2017 12:07:12 +0000 (14:07 +0200)] 
lock: refactoring functions

lock_acquire:
Refactor function to set the timeout manually
and to avoid the sleep of 0,25s when the timeout value is zero.

lock_exists:
Provides an easier to check if a lock exists

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoautocompletion: add color commands
Jonatan Schlag [Thu, 15 Jun 2017 16:18:53 +0000 (18:18 +0200)] 
autocompletion: add color commands

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agonetwork: add color commands
Jonatan Schlag [Thu, 15 Jun 2017 16:18:52 +0000 (18:18 +0200)] 
network: add color commands

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agocli: print the color of a zone/port
Jonatan Schlag [Thu, 15 Jun 2017 16:18:51 +0000 (18:18 +0200)] 
cli: print the color of a zone/port

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agocolor: add colors to zone and ports
Jonatan Schlag [Mon, 19 Jun 2017 15:39:31 +0000 (17:39 +0200)] 
color: add colors to zone and ports

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoports: Change ports settings file to /etc/network/${port}/settings
Jonatan Schlag [Thu, 15 Jun 2017 16:18:49 +0000 (18:18 +0200)] 
ports: Change ports settings file to /etc/network/${port}/settings

The configuration of a port was stored in a file called:
/etc/network/${port}
This is bad because it is very hard to add further information
which belong primary not to the configuration to this file.

So we change the settings file to /etc/network/${port}/settings like for the zones.

This make it possible to store other configurations like the color in other files in the directory
/etc/network/${port}.

A workaround to move the config file into the new directory scheme is:
port=p1 && mv /etc/network/ports/${port} /etc/network/ports/${port}-save \
&& mkdir -p /etc/network/ports/${port} \
&& mv /etc/network/ports/${port}-save /etc/network/ports/${port}/settings

where port is the name of the port like p1 or p0.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoutil: new function abs
Jonatan Schlag [Fri, 9 Jun 2017 10:17:27 +0000 (12:17 +0200)] 
util: new function abs

This function return the absolute value of a given number.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoutil: add function mtu_is_valid
Jonatan Schlag [Wed, 7 Jun 2017 06:24:34 +0000 (08:24 +0200)] 
util: add function mtu_is_valid

This function checks if an mtu is valid for a given IP protocol.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agohotplug: Don't handle any events for loopback
Michael Tremer [Tue, 13 Jun 2017 18:28:46 +0000 (19:28 +0100)] 
hotplug: Don't handle any events for loopback

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoports: Don't crash with an assertion error when no hook can be found
Michael Tremer [Tue, 13 Jun 2017 18:26:08 +0000 (19:26 +0100)] 
ports: Don't crash with an assertion error when no hook can be found

This happens when a device has an empty configuration file or
the HOOK variable is not set for an other reason.

In that case the function make the entire program crash.

This patch changes behaviour in that sense that the function
returns with an error which must be evaluated by the calling
function.

Fixes #11400

Reported-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodevice_num_queues(): Read correct file for transmit queues
Michael Tremer [Tue, 13 Jun 2017 18:25:38 +0000 (19:25 +0100)] 
device_num_queues(): Read correct file for transmit queues

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodevice_get_speed(): Break if speed is not readable
Michael Tremer [Tue, 13 Jun 2017 18:24:41 +0000 (19:24 +0100)] 
device_get_speed(): Break if speed is not readable

This is usually the case when a device has no link
(i.e. the speed is unknown).

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoMakefile: Add missing trailing backslash
Michael Tremer [Wed, 7 Jun 2017 18:18:41 +0000 (20:18 +0200)] 
Makefile: Add missing trailing backslash

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodevice: Show queue status
Michael Tremer [Wed, 7 Jun 2017 18:10:16 +0000 (20:10 +0200)] 
device: Show queue status

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agointerrupts: Rename __bitmap_to_processor_id() which returns multiple values
Michael Tremer [Wed, 7 Jun 2017 17:08:59 +0000 (19:08 +0200)] 
interrupts: Rename __bitmap_to_processor_id() which returns multiple values

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodevice: Ignore unknown duplexing
Michael Tremer [Wed, 7 Jun 2017 16:50:17 +0000 (18:50 +0200)] 
device: Ignore unknown duplexing

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodevice: Return speed only if a valid (positive) value
Michael Tremer [Wed, 7 Jun 2017 16:48:40 +0000 (18:48 +0200)] 
device: Return speed only if a valid (positive) value

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoimprove autocompletion of network zone new
Jonatan Schlag [Wed, 7 Jun 2017 06:20:28 +0000 (08:20 +0200)] 
improve autocompletion of network zone new

Fixes: #11386
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoroute: update documentation
Jonatan Schlag [Wed, 7 Jun 2017 06:17:39 +0000 (08:17 +0200)] 
route: update documentation

This patch updates the documentation to follow the change from route to route static.
The network-route manpage is now a generical one wich just list which types of routes we support like static or later dynamic.

In the network-route-static are the explanation for static routes.
This documents represents the previous network-route manpage .

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoroute: rename route to route static
Jonatan Schlag [Wed, 7 Jun 2017 06:17:38 +0000 (08:17 +0200)] 
route: rename route to route static

Fixes: #11374
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoroute: add new cli command reload
Jonatan Schlag [Sun, 4 Jun 2017 14:09:07 +0000 (16:09 +0200)] 
route: add new cli command reload

This new command just call route_apply.
It provide a nice way to take changes of the config file into affect.
Also it helps when the routes are not applied.
This should not happen, but when this command is better then network restart.

Fixes: 11367
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agopppoe-server: improve input validation
Jonatan Schlag [Sat, 3 Jun 2017 11:25:10 +0000 (13:25 +0200)] 
pppoe-server: improve input validation

We now check if the subnet, the mtu and the max-sessions valud is valid.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoip: restructure ip_net_is_valid
Jonatan Schlag [Sat, 3 Jun 2017 11:25:08 +0000 (13:25 +0200)] 
ip: restructure ip_net_is_valid

Insted of checking the network manually we now just calö ipv4_net_is_valid or
ipv6_net_is_valid

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoipv4: new function ipv4_net_is_valid
Jonatan Schlag [Sat, 3 Jun 2017 11:25:07 +0000 (13:25 +0200)] 
ipv4: new function ipv4_net_is_valid

This function checks if a given network is valid IPv4 network

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoip: rename ip_is_network to ip_net_is_valid
Jonatan Schlag [Fri, 2 Jun 2017 09:46:53 +0000 (11:46 +0200)] 
ip: rename ip_is_network to ip_net_is_valid

We rename this function to state clear what the function is actually doing.
The function checks if a network is valid and not if something is a network or not.

Fixes: 11357
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agodevice queues: Fix listing queues
Michael Tremer [Wed, 7 Jun 2017 16:25:24 +0000 (18:25 +0200)] 
device queues: Fix listing queues

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoFix incorrect variable name in SMP affinity handling
Michael Tremer [Wed, 7 Jun 2017 14:39:41 +0000 (16:39 +0200)] 
Fix incorrect variable name in SMP affinity handling

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoman: update the pppoe zone documentation
Jonatan Schlag [Fri, 2 Jun 2017 09:05:51 +0000 (11:05 +0200)] 
man: update the pppoe zone documentation

Fixes: #11375
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoroute: apply static routes on startup and restart
Jonatan Schlag [Fri, 2 Jun 2017 06:30:35 +0000 (08:30 +0200)] 
route: apply static routes on startup and restart

The static routes can only be applied when the network has a valid layer 3  connectivity.
So it is not useful to have a route_init which is called before we have any layer 3  connectivity.
We now call the route_apply every time we set new routes for a zone.
We do this every time we get a new layer 3  connectivity so all routes are applied correctly.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years ago6to4-tunnel: LOCAL_ADDRESS6 needs to be a valid IPv6 network
Jonatan Schlag [Fri, 2 Jun 2017 06:30:34 +0000 (08:30 +0200)] 
6to4-tunnel: LOCAL_ADDRESS6 needs to be a valid IPv6 network

Fixes: #1359
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDrop support for 6rd
Michael Tremer [Fri, 2 Jun 2017 07:55:18 +0000 (09:55 +0200)] 
Drop support for 6rd

This is probably not in wide use any more and I do not want
to support this either. Therefore this is dropped for now.

Fixes #11369

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoDon't try identifying non-existant device when attaching to a zone
Michael Tremer [Wed, 31 May 2017 17:55:15 +0000 (19:55 +0200)] 
Don't try identifying non-existant device when attaching to a zone

This resulted in an error message which is unnecessary.

Fixes #11174

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agotest: Include test-functions in tarball
Michael Tremer [Wed, 31 May 2017 22:16:29 +0000 (23:16 +0100)] 
test: Include test-functions in tarball

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agotest: Add module tests for ip_network_is_subset_of
Michael Tremer [Wed, 31 May 2017 22:11:40 +0000 (23:11 +0100)] 
test: Add module tests for ip_network_is_subset_of

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 years agoinetcalc: Use memcmp to determine which IP address is higher
Michael Tremer [Wed, 31 May 2017 22:10:34 +0000 (23:10 +0100)] 
inetcalc: Use memcmp to determine which IP address is higher

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>