Commit graph

55 commits

Author SHA1 Message Date
Pranav Jerry 888fdf3856
removed all print() calls from network.py
Updated CHANGELOG.md. We (another word for 'me') can push after moving
naxalnet.service out of service/. I am told the unit file is having a
rather dull time coping with per lonely life.
2021-12-01 21:27:27 +05:30
Pranav Jerry fc1f3d4216
another fix for #25
Or, to be more precise, a fix for the fix preceding the current fix for
issue #25 that just didn't fix things right. If your head spins, see the
previous commit, or call an ambulance (that is, if you are privileged
enough to access a phone and know your local helpline number)
2021-11-29 14:47:59 +05:30
Pranav Jerry 5e58df0b71
temporary fix for #25
Uses multithreading.Process instead of GLib.timeout_add()

The moment I finished writing this part, I found out the only problem
with my previous commit was that I had setup the timeout _after_ calling
the blocking function wait_for_change instead of before it.

Although this version (with Process) works, I'm reverting to the
previous version and swapping the two lines (which I had tested and
found to work)

And in case you have read upto the previous line you should also know I
fixed some code in the README

TL;DR: I have proven once again I am an idiot
2021-11-29 14:36:59 +05:30
Pranav Jerry d7a84d8ccc
replaced GObject with GLib in network.py
See the previous commit. And the one preceding that. And the one before
that. Keep going until /dev/brain0 gets symlinked to /dev/urandom
2021-11-16 22:00:00 +05:30
Pranav Jerry 183ce16eca
added timeout
This doesn't work yet
2021-11-14 19:57:35 +05:30
Pranav Jerry caeb042612
implemented NetworkLoop call in scripts.py
See any_interface_is_routable()
2021-11-14 19:46:04 +05:30
Pranav Jerry cd44357496
updated version
I accidentally pushed the previous commit to master instead of this
branch. This should revert things
2021-11-14 19:32:34 +05:30
Pranav Jerry a5ba99ca2a
Version 0.5.1
Fixed issue #21
2021-10-22 13:28:16 +05:30
Pranav Jerry 26a907d907
updated readme, changelog
prepare to merge to master
2021-10-22 13:20:09 +05:30
Pranav Jerry 704fe646f8
renamed systemd-networkd/ to network/
Nothing big. And naxalnet needs a new maintainer or I will keep screwing
up things.
2021-10-22 13:09:15 +05:30
Pranav Jerry aa079c7c29
reverted the changes
Instead, removed the wpa_supplicant "conflicts" line from naxalnet.service
2021-10-22 13:05:37 +05:30
Pranav Jerry 295fde3f0b
added override service for wpa_supplicant
This probably isn't working like we want
2021-10-22 12:54:52 +05:30
Pranav Jerry 270db3cf90
added hack to fix #21 2021-10-22 12:06:17 +05:30
Pranav Jerry 6fbebc51bb
almost fixed things 2021-10-22 11:58:41 +05:30
Pranav Jerry 1f8be50dd6
moved systemd service to a dir
This is to add another service file alongside naxalnet.service
2021-10-22 11:11:11 +05:30
Pranav Jerry 5dd90d349e
prepare for version 0.5.0
Now that this version is being released, I have no ambitions left on
this program and I would happily accept a new maintainer to take over
this project (Let's see if anyone ever reads this message)
2021-10-10 20:43:34 +05:30
Pranav Jerry de63113098
ready to merge
Updated __version__ to 0.4.0a6
2021-10-09 15:20:57 +05:30
Pranav Jerry 61a96ea3b3
updated documentation and some other changes
Made messages printed in Makefile more understandable. Removed full path
of naxalnet from the systemd service. Now you can start naxalnet even if
it is installed in /usr/local/bin, if systemd allows (I have not tested
it). Many comments were made to respect the 80 chars per line rule.
And, of course, added some political commentary to insult the global
superpower (superpower in terms of money, military and something else I
forgot). And removed MANIFEST.in, which probably haven't changed anything.
2021-10-02 14:13:53 +05:30
Pranav Jerry a7304a986b
turn off all wifi devices at exit
This makes things easier to maintain, or so I hope.

Added more comments in files in systemd-networkd, made CHANGELOG.md
better, and updated the README.
2021-09-29 15:14:13 +05:30
Pranav Jerry a061852a59
commented out a line causing trouble
And added a  bit more logging
2021-09-28 15:58:31 +05:30
Pranav Jerry 5bde1faeba
temporary hack to fix #19
Probably s/temporary/permanent/ if someone doesn't take over this
"project" soon.
2021-09-28 12:37:11 +05:30
Pranav Jerry 87612fac2c
delete interface during cleanup
Read the previous commit for some unhelpful remarks.
2021-09-27 22:48:13 +05:30
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 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 8f905ed970
prepared *.net{work,dev} files to work with str.format() 2021-09-26 13:31:36 +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 5eb55c19a2
changed version to 0.3.0a3
Ready for merge!
2021-09-10 20:23:06 +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 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 97b1f46535
updated CHANGELOG and version in __init__.py
Ready for merge
2021-09-05 13:47:54 +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 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 feb362b149
Version 0.3.0
Let's assume I haven't forgotten anything.
2021-08-19 12:51: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 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 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
Pranav Jerry fe146b7a0d
added implementation of --print-wifi
And added it to the README.
Cleaned up the docstring in naxalnet/__main__.py
2021-08-13 12:30:30 +05:30
Pranav Jerry dfd521f9b9
added new args and support for conf files
Tidied up code, added more documentation, and the version now confirms
to some PEP standard. Because of the way configuration and arguments are
implemented, ALL the keys in configuration files should have an argument
that can change its value.

Verbose option was commented out, since it is not implemented. An
argument --print-wifi, which should print out WiFi ssid and password is
not implemented at the moment. Also, the README should be updated to
show the new changes. By the way I just remembered I didn't update the
CHANGELOG; I'll do it in the next commit. 😁
2021-08-13 10:35:13 +05:30
Pranav Jerry 2e4149d943
moved device setup into a single function
By the way, --verbose is not implemented yet. We will need to wait until
systemd journal or some other form of logging is implemented.
2021-08-05 12:11:31 +05:30