Commit Graph

179 Commits

Author SHA1 Message Date
Pranav Jerry 2e4c3a70a4
cleanup before exit
This was previously done by the systemd service. But since we allowed
changing the name of bat0 and bridge0, we can't expect systemd to still
do that job. Commented out some lines in the systemd service and made it
send SIGINT instead of the default SIGTERM to kill naxalnet. I
accidentally used to increment a2, a3, a4, ... in the __version__
instead of dev1, dev2, &c. a few commits back. Removed some print()
lines lurking somewhere in the code. The cleanup is still not completed.
We still have to delete the interfaces bridge0 and bat0, or whatever
name the user gives it. Just out of boredom, I added some description to
some network configuration, though so I doubt if anyone will understand
it more because of that.
2021-09-27 22:30:07 +05:30
Pranav Jerry d0389e5638
set gateway mode automatically
Added arg and config option to manually set gw_mode.
When gateway_mode is auto, a temporary config will be added, and after a
ten sec delay, naxalnet will check if systemd-networkd shows a
'routable' connection. If the connection is routable, gw_mode will be
set to server; or client otherwise.
2021-09-27 12:43:09 +05:30
Pranav Jerry 8ba8d6af6c
cleaned up code 2021-09-27 11:43:50 +05:30
Pranav Jerry 761618aff4
added new args and config options
This will allow changing name of batman and bridge interface.
But deleting them after stopping naxalnet will not work at the moment.
2021-09-27 11:27:44 +05:30
Pranav Jerry 798cd3e988
fixed bug in previous commit
Added function to get glob as sorted list. This fixes the errors
reported by systemd-networkd
2021-09-27 11:03:27 +05:30
Pranav Jerry a81449b898
changed how network config is done
We now use NetworkD() to configure systemd-networkd.
Path.glob doesn't return things in alphabetical order, which is needed
to configure networkd without any error. Need a fix for that.
2021-09-27 10:00:59 +05:30
Pranav Jerry ab3252683a
added func for parsing and writing networkd config 2021-09-26 13:57:40 +05:30
Pranav Jerry 8f905ed970
prepared *.net{work,dev} files to work with str.format() 2021-09-26 13:31:36 +05:30
Pranav Jerry 25ac54dfad
removed arguments added in previous commit
Too much configs and args make debugging harder. The class networkd will
be used to add config files to the networkd runtime dir after formatting
the file with str.format().
2021-09-26 13:25:35 +05:30
Pranav Jerry 25a5bdee30
added network.py and some other changes
This will be used to control systemd-networkd via d-bus and runtime
configs and make things easier in implementing B.A.T.M.A.N. gateway support
2021-09-25 15:04:29 +05:30
Pranav Jerry 9171b942db
added temporary network config file
This will be used to check if the machine has internet access.
2021-09-24 12:42:13 +05:30
Pranav Jerry ea283a3247
Duplicate mesh.07-bridge.network history in check.01-eth.network history. 2021-09-24 12:38:46 +05:30
Pranav Jerry 8137b5067b
made error messages more readable
Not a big commit, so pushed directly to master
2021-09-21 22:43:41 +05:30
Pranav Jerry 5f7c59d4b8
Modified CHANGELOG.md for releasing new version 2021-09-20 12:28:59 +05:30
Pranav Jerry c8f032a3d0
couple of changes, see full commit message
* make will now build every time naxalnet/__init__.py is changed.
* Changed content related to online classes in README.md. It seems online
  classes are a luxury even in urban areas in some parts of India.
* Added argument -V as alias for --verbose
2021-09-11 22:42:08 +05:30
Pranav Jerry 74a061507f Merge pull request 'Convert into daemon' (#17) from daemon into master
Reviewed-on: pranav/naxalnet#17
2021-09-10 14:59:01 +00:00
Pranav Jerry 5eb55c19a2
changed version to 0.3.0a3
Ready for merge!
2021-09-10 20:23:06 +05:30
Pranav Jerry 2a8930ce00
remove ipfs url from README.md
I don't use IPFS anymore. If anyone if willing to maintain a copy of
this repo on ipfs, send me an email.

Small change in CHANGELOG, and edited comments in systemd service.
And added a docstring to setup.py so the editor won't complain of
missing docstring anymore.
2021-09-10 11:42:18 +05:30
Pranav Jerry f9c969d233
updated README.md
Now that naxalnet is a daemon, there was some things which didn't make
sense anymore. So they were removed.
2021-09-08 15:52:14 +05:30
Pranav Jerry c638de4c9c
updated README, added pyproject.toml 2021-09-08 11:57:10 +05:30
Pranav Jerry ca1e721c9e
fixed logging issue and another bug
There was a problem with indentation which made the line starting adhoc
not being run at all.
Updated CHANGELOG
Moved some things to other places
log.py is back! It isn't needed, but it doesn't do any harm anyway.
2021-09-07 18:45:11 +05:30
Pranav Jerry 68b53ccad1
implemented daemon
naxalnet is now a daemon! When run from systemd, it checks for new
devices or removal of devices and reloads the wifi configuration.
Updated the systemd service and changed Type to notify. Unfortunately,
there is some problem with logging. The messages from naxalnet.iwd could
not be found in the systemd journal or while running without --systemd.
2021-09-07 11:19:14 +05:30
Pranav Jerry 6fff558405
many changes, see full commit message
- Renamed here_be_dragons() to main().
- Added daemon.py (doesn't do anything yet).
- Added GPL disclaimer to all python files and removed the shebang #!
  from all files.
- args is now defined outside any function in scripts.py
- Changed arguments of some functions in scripts.py
2021-09-06 21:54:24 +05:30
Pranav Jerry 0bcd31b6e3
removed log.py 2021-09-06 15:00:34 +05:30
Pranav Jerry 2d9aee4d3a
added --systemd and --verbose arguments
When run without --systemd, naxalnet will log to stderr.
Otherwise, it will log to systemd journal.

log.py is no longer needed.
2021-09-06 14:57:54 +05:30
Pranav Jerry a3e9b45050
more logging messages and code cleanup
Removed log messages from config.py
2021-09-06 12:23:07 +05:30
Pranav Jerry 33156e6a8d Merge pull request 'logging' (#16) from logging into master
Reviewed-on: pranav/naxalnet#16

See CHANGELOG and issue #13 for details
2021-09-05 08:33:32 +00:00
Pranav Jerry 4d9de4d3c3
updated changelog again 2021-09-05 14:00:11 +05:30
Pranav Jerry 97b1f46535
updated CHANGELOG and version in __init__.py
Ready for merge
2021-09-05 13:47:54 +05:30
Pranav Jerry ee341d6967
updated README.md
Made the requirements more clear
2021-09-04 20:00:00 +05:30
Pranav Jerry 3774076e03
updated README
Added new dependency python-systemd
2021-09-04 18:37:30 +05:30
Pranav Jerry 87c5d48144
added more logging info 2021-09-04 14:24:53 +05:30
Pranav Jerry e4a7fa5d3f
renamed systemd-networkd config files 2021-09-04 12:59:26 +05:30
Pranav Jerry 4db6d9457f
improved README, more logging 2021-09-04 11:53:08 +05:30
Pranav Jerry 4ea53e5a35
implemented logging
- New dependency -- python-systemd for logging to journal
- Changed service file to start after networkd
- New submodule which contains "logger" for use by all other submodules
- Removed bus argument from Device and Adapter classes
2021-08-25 15:52:46 +05:30
Pranav Jerry 09ea47e609
fixed typo in README.md 2021-08-23 10:52:08 +05:30
Pranav Jerry d8dcf10b76
changed version in CHANGELOG.md
As usual, I screwed up at the right time.
2021-08-19 13:08:31 +05:30
Pranav Jerry feb362b149
Version 0.3.0
Let's assume I haven't forgotten anything.
2021-08-19 12:51:18 +05:30
Pranav Jerry 1a6dbc4bcb
Merge branch 'args-and-config'
See CHANGELOG.md for details
2021-08-19 12:49:18 +05:30
Pranav Jerry 9f8a5b3d0d
updated CHANGELOG and version
Ready for merge
2021-08-19 12:48:02 +05:30
Pranav Jerry fdbbca686d
removed license from package description
Fixed MANIFEST.in and changed data_files in setup.cfg
2021-08-19 12:36:40 +05:30
Pranav Jerry be8de69b73
updated README and Makefile
Added uninstall as dependency for purge in Makefile.
Changed pkexec and pkcon to sudo and apt and dnf
2021-08-19 12:03:20 +05:30
Pranav Jerry 7e0fe5ef4c
many changes -- see full commit message
The config file is now installed as /etc/naxalnet/naxalnet.conf.example
by default.
make uninstall now does not ask for confirmation. Added rule purge in
Makefile.
Updated the README.
Changed order of stop commands in service file.
Updated setup.cfg and docstrings.
2021-08-18 17:33:46 +05:30
Pranav Jerry 274f08cded
added install instructions for fedora and ubuntu
May not work, I have not tested it.
2021-08-18 15:34:07 +05:30
Pranav Jerry d1ec77dc69
clean up runtime files when stopped
This only applies to the systemd service
2021-08-17 09:49:16 +05:30
Pranav Jerry cf54edf9b9
updated README
Changed order of services to stop in section Stopping the service. This
is because while stopping naxalnet, the ExecStopPost line says to delete
two interfaces. But just before it is run, networkd is stopped. Running
the command will again start networkd, which is not what we need.
2021-08-16 21:32:57 +05:30
Pranav Jerry e99b3222e1
simplified systemd-networkd reload in naxalnet.service 2021-08-16 21:29:27 +05:30
Pranav Jerry d18160c46c
disabled buffering in python
Buffering makes the systemd journal not show the logs at the right time.
And changed the systemd service file so that the new batman and bridge
interfaces are deleted when naxalnet.service is stopped. Also simplified
the Stopping section in the README because of this change.
2021-08-16 18:56:17 +05:30
Pranav Jerry 397269823d
almost ready for merge
* Improved CHANGELOG, README, HACKING
* Added naxalnet.conf containing default values. This will be installed
along with the package.
2021-08-15 15:02:28 +05:30
Pranav Jerry d7a9edc1e8
many changes -- read full commit
* Improved docstrings, README
* Added argument --version and its implementation
* Added "uninstall" rule to Makefile and added it in the README
* Updated CHANGELOG
* Cleaned up code

I've probably forgot something so we can't merge to master yet.
And we still have to add installation instructions for ubuntu and fedora
2021-08-14 22:00:07 +05:30