Giter Site home page Giter Site logo

dynamicprefixvici's People

Contributors

driesmp avatar pepijndeboever avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

dynamicprefixvici's Issues

Make the added pool more flexible with command like arguments

Right now, we take the prefix as is and add it to Strongswan, we should make it a command line arguments to specify the sla-id, the sla-size and prefix size.

Let's say we get a prefix fd00::1/56 as example, we should be able to specify eg; -sla-id 1,-sla-length 8, and -prefix-length 120.
Which results in the following prefix being added; fd00:0000:0000:0001::1/120.

Another example: sla-id 2, sla-length 4 results with prefix-length 64 in, fd00:0000:0000:0020::1/64. Similar code is available in dhcpcd to add the prefix on interfaces with these variables.

https://www.daemon-systems.org/man/dhcpcd.conf.5.html (see ia_pd section for logic)

getopt() seems the best here. sla-id can have a default value of 0, sla-size also has 0 as default value and prefix size has a default value of 97 (this is the max Strongswan supports).

Clean up included headers

I just noticed that we included some headers for the sla logic, but this was deleted.
Can we delete some headers?

Do something with the parsed return message

Right now we just print the message to the console, does it make sense for example to exit(1) when "success: no"?
It doesn't have a lot of value to print it to the console except exit accordingly when it did not succeed.

Make the name of env variables variable

Right now, "new_dhcp6_ia_pd1_prefix1" and "old_dhcp6_ia_pd1_prefix1" is hardcoded, it should be overwritable by specifying it as a command line argument, like "-old-prefixname" and "-new-prefixname" to make it more suitable for others to use it. The old and new prefix name has a default value equal to the current hardcoded one. getopt() seems the best here.

Make the added pool name variable

Right now, "global-ipv6" is hardcoded, it should probably be specified as a command line argument, like "-poolname global-ipv6" to make it more suitable for others to use it. The pool name should not have a default value, it should always be specified. (required). getopt() seems the best here.

Make the program work for IPv4 added pools

Because of the CheckAddress function, we currently don't allow IPv4 pools to be added.
It should still be possible to do so, even though I do not require that functionality myself.

My opinion is to just get rid of the sla logic all together, its making the program more complicated than it should be.
So basically reverting the commit that added the functionality.

Parse return message from vici

Currently the return message from vici is not prossesed, so it is unsure whether or not the address pool is succesfully updated.

Drop environment variable logic

Lets hard specify the prefix to use on the CLI, so we can drop all the not defined logical or old and new not being the same.

We can adjust poolname to the -n flag, and prefix to the -p flag, we always add the pool when the program is being run (no logic, no checks). We can easily extract the env variable in a shell script to pass it along dynamicprerfixvici to add it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.