-
Notifications
You must be signed in to change notification settings - Fork 324
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
gluon-status-page, gluon-mesh-batman-adv: make statuspage mesh-protoc… #1366
gluon-status-page, gluon-mesh-batman-adv: make statuspage mesh-protoc… #1366
Conversation
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.
In addition to the noted changes, please also add an entry
packages 'status-page & (mesh-batman-adv-14 | mesh-batman-adv-15)' \
'gluon-status-page-mesh-batman-adv'
to package/features, so that enabling the status-page and mesh-batman-adv-... features automatically selects the gluon-status-page-mesh-batman-adv package.
@@ -33,3 +33,4 @@ LDLIBS += $(LIBBATADV_LDLIBS) | |||
|
|||
respondd.so: respondd.c | |||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared -fPIC -D_GNU_SOURCE -o $@ $^ $(LDLIBS) -lgluonutil -liwinfo -luci | |||
|
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.
It seems this line was added accidentally?
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.
yeah.. done.
define Package/gluon-status-page-mesh-batman-adv | ||
TITLE:=Batman-data provider for gluon-status-page | ||
SECTION:=gluon | ||
CATEGORY:=Gluon |
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.
The above two lines can be dropped since 994c949
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.
done
@@ -6,6 +6,6 @@ badrequest() { | |||
exit 1 | |||
} | |||
|
|||
( batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" ) 2>/dev/null || badrequest | |||
( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device"| grep -qxF "$QUERY_STRING" ) 2>/dev/null || badrequest |
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.
Hmm, I think the complexity of this command is high enough that we should encapsulate the whole thing up to the ||
in a small script provided by gluon-core. Something like gluon-is-meshif
. I guess the grep
could also be replaced by an extension of the jsonfilter expression.
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.
agreed - how about we create gluon-get-mesh-ifs that contains everything up to the Igrep. This would be usable in a more universal way than when incorporating the grep for a specific interface....
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.
Fine with me.
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.
done
|
||
neighbours-batadv: neighbours-batadv.c | ||
$(CC) $(CFLAGS) $(CFLAGS_JSONC) $(LDFLAGS) $(LDFLAGS_JSONC) -o $@ $^ $(LDLIBS) | ||
|
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.
Ugh, I hate the amount of boilerplate code in this file... I'll clean this up very soon, in all Makefiles that use libbatadv.
@@ -27,6 +27,8 @@ static struct json_object *get_stations(const struct iwinfo_ops *iw, const char | |||
json_object_object_add(station, "signal", json_object_new_int(entry->signal)); | |||
json_object_object_add(station, "noise", json_object_new_int(entry->noise)); | |||
json_object_object_add(station, "inactive", json_object_new_int(entry->inactive)); | |||
json_object_object_add(station, "rx_rate", json_object_new_int(entry->rx_rate.rate)); | |||
json_object_object_add(station, "tx_rate", json_object_new_int(entry->tx_rate.rate)); |
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 change looks unrelated, and we should not add these values unless the frontend also uses them.
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.
in general I agree but since we are splitting backend and frontend here, I left it in the commit. I will remove it now, but I really do like those stats.
SECTION:=gluon | ||
CATEGORY:=Gluon | ||
PROVIDES:=gluon-status-page-data-provider | ||
DEPENDS:=+gluon-status-page +gluon-mesh-batman-adv +libnl-tiny +libbatadv +libjson-c |
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.
gluon-mesh-batman-adv is a virtual package. Remove the + sign prefixing the dependency - never use selecting dependencies with virtual packages!
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.
done.
TITLE:=Batman-data provider for gluon-status-page | ||
SECTION:=gluon | ||
CATEGORY:=Gluon | ||
PROVIDES:=gluon-status-page-data-provider |
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.
I think this PROVIDES is somewhat useless; as long as gluon-status-page-mesh-batman-adv depends on gluon-status-page, the result will be a circular dependency, which should always be avoided.
As the status page does not have a public API anymore, the status-page frontend for a specific mesh protocol will always be provided by the same package the backend comes in. As such, there is no common functionality in different backend packages that would justify a PROVIDES.
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.
Thinking about this again, I'm seeing the problem that now the frontent depends on parts of the backend that are moved to a separate package; I would like to avoid such dependencies.
In consequence, we actually need to move the frontend to a separate package first, before the backend may follow.
@@ -0,0 +1,2 @@ | |||
#!/bin/sh | |||
ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device" |
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.
Maybe name it "gluon-mesh-interfaces"? In any case, it should start with "gluon-".
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.
sure. I like verbs, so I would go with gluon-get-mesh-interfaces ok?
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.
Ok
@@ -10,7 +10,7 @@ start_service () { | |||
procd_set_param stdout 1 | |||
procd_set_param stderr 1 | |||
procd_set_param respawn ${respawn_threshold:-3660} ${respawn_timeout:-5} ${respawn_retry:-0} | |||
interfaces=$(for dev in $( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device");do echo " -m $dev"; done; | |||
interfaces=$(for dev in $(/usr/bin/get-mesh-ifs);do echo " -m $dev"; done; |
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.
Remove the full path here, just use the name of the script.
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.
removed the path here but kept it in the scripts that are called by the statuspage.
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.
Why, do those script not have a proper PATH set?
I've prepared the frontend part in 35ade80. |
rename and rebase is done. |
@@ -6,6 +6,6 @@ badrequest() { | |||
exit 1 | |||
} | |||
|
|||
( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device"| grep -qxF "$QUERY_STRING" ) 2>/dev/null || badrequest | |||
( /usr/bin/gluon-get-mesh-interfaces | grep -qxF "$QUERY_STRING" ) 2>/dev/null || badrequest |
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.
The other absolute paths in these files don't make much sense either, let's not introduce another one.
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.
Sorry about changing my mind again, but I think I would prefer the verb "list" to "get" in the script name.
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.
np. Adjusting now....
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.
done. - for the paths I had to touch the files again anyways. I like list better than get too.
The package/features update is still missing. |
And /lib/gluon/status-page/mesh.lua should be moved into the new package as well. |
…list-mesh-ifs that lists all currently active mesh interfaces
…neighbours-nodeinfo and stations
Thanks, merged. |
…ol-agnostic
this PR will make the staus page backend independent from batctl.
this replaces the backend-part from #1053