Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ return view.extend({
};

ifs.handleAdd = function (ev) {
uci.add('olsrd', 'Interface');
uci
.save()
.then(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ return view.extend({
ifs.template = 'cbi/tblsection';

ifs.handleAdd = function (ev) {
uci.add('olsrd6', 'Interface');
uci
.save()
.then(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'require ui';
'require olsr.common_js as olsr';

return olsr.olsrview.extend({

Check warning on line 10 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/hna.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined

action_hna() {
let self = this;
Expand Down Expand Up @@ -173,7 +173,7 @@
let statusOlsrCommonJs = null;

if (has_v4 && has_v6) {
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('common/common_js.js') });
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('olsr/common_js.js') });
}

const fresult = E([], {}, [h2, divToggleButtons, fieldset, statusOlsrCommonJs]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'require view';
'require olsr.common_js as olsr';

return olsr.olsrview.extend({

Check warning on line 9 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/interfaces.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined

async action_interfaces() {
const [data, has_v4, has_v6, error] = await this.fetch_jsoninfo('interfaces');
Expand Down Expand Up @@ -90,7 +90,7 @@
let statusOlsrCommonJs = null;

if (has_v4 && has_v6) {
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('common/common_js.js') });
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('olsr/common_js.js') });
}

const fresult = E([], {}, [h2, divToggleButtons, fieldset, statusOlsrCommonJs]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'require view';
'require olsr.common_js as olsr';

return olsr.olsrview.extend({

Check warning on line 8 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/mid.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined

action_mid() {
let self = this;
Expand Down Expand Up @@ -81,7 +81,7 @@
let statusOlsrCommonJs = null;

if (has_v4 && has_v6) {
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('common/common_js.js') });
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('olsr/common_js.js') });
}

const fresult = E([], {}, [h2, divToggleButtons, fieldset, statusOlsrCommonJs]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'require view';
'require olsr.common_js as olsr';

return olsr.olsrview.extend({

Check warning on line 9 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/neighbors.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined

async action_neigh() {
try {
Expand Down Expand Up @@ -174,8 +174,8 @@
if (link.linkCost == 4194304) {
link.linkCost = 0;
}
const color = etx_color(link.linkCost);
const snr_color = snr_colors(link.snr);
const color = olsr.etx_color(link.linkCost);

Check warning on line 177 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/neighbors.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined
const snr_color = olsr.snr_colors(link.snr);

Check warning on line 178 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/neighbors.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined
let defaultgw_color = '';
if (link.defaultgw === 1) {
defaultgw_color = '#ffff99';
Expand Down Expand Up @@ -299,8 +299,8 @@
link.linkCost = 0;
}

const color = etx_color(link.linkCost);
const snr_color = snr_colors(link.snr);
const color = olsr.etx_color(link.linkCost);

Check warning on line 302 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/neighbors.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined
const snr_color = olsr.snr_colors(link.snr);

Check warning on line 303 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/neighbors.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined

if (link.snr === 0) {
link.snr = '?';
Expand Down Expand Up @@ -449,7 +449,7 @@
if (has_v4 && has_v6) {
statusOlsrCommonJs = E('script', {
type: 'text/javascript',
src: L.resource('common/common_js.js'),
src: L.resource('olsr/common_js.js'),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'require view';
'require olsr.common_js as olsr';

return olsr.olsrview.extend({

Check warning on line 10 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/routes.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined

action_routes() {
let self = this;
Expand Down Expand Up @@ -105,7 +105,7 @@
interface: route.networkInterface,
metric: route.metric,
etx: ETX,
color: etx_color(parseFloat(ETX)),
color: olsr.etx_color(parseFloat(ETX)),

Check warning on line 108 in applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/routes.js

View workflow job for this annotation

GitHub Actions / eslint

'olsr' is not defined
});
}

Expand Down Expand Up @@ -172,7 +172,7 @@

for (let route of routes_res) {
const ETX = parseInt(route.etx) || 0;
const color = etx_color(ETX);
const color = olsr.etx_color(ETX);

const tr = E('div', { 'class': 'tr cbi-section-table-row cbi-rowstyle-' + i + ' proto-' + route.proto }, [
E('div', { 'class': 'td cbi-section-table-cell left' }, route.destination + '/' + route.genmask),
Expand Down Expand Up @@ -222,7 +222,7 @@
let statusOlsrCommonJs = null;

if (has_v4 && has_v6) {
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('common/common_js.js') });
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('olsr/common_js.js') });
}

const fresult = E([], {}, [h2, divToggleButtons, fieldset, statusOlsrLegend, statusOlsrCommonJs]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ return olsr.olsrview.extend({
let statusOlsrCommonJs = null;

if (has_v4 && has_v6) {
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('common/common_js.js') });
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('olsr/common_js.js') });
}

const fresult = E([], {}, [h2, divToggleButtons, fieldset, statusOlsrCommonJs]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ return olsr.olsrview.extend({

for (let route of routes_res) {
const cost = (parseInt(route.tcEdgeCost) || 0).toFixed(3);
const color = etx_color(parseInt(cost));
const color = olsr.etx_color(parseInt(cost));
const lq = (parseInt(route.linkQuality) || 0).toFixed(3);
const nlq = (parseInt(route.neighborLinkQuality) || 0).toFixed(3);

Expand Down Expand Up @@ -117,7 +117,7 @@ return olsr.olsrview.extend({
let statusOlsrCommonJs = null;

if (has_v4 && has_v6) {
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('common/common_js.js') });
statusOlsrCommonJs = E('script', { 'type': 'text/javascript', 'src': L.resource('olsr/common_js.js') });
}

const fresult = E([], {}, [h2, divToggleButtons, fieldset, statusOlsrLegend, statusOlsrCommonJs]);
Expand Down
27 changes: 20 additions & 7 deletions applications/luci-app-olsr/root/usr/libexec/rpcd/olsrinfo
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ load_hosts() {
json_dump
}

json_stringescape() {
awk '
NR>1 { r = r "\\n" }
{
gsub(/["\\]/, "\\\\&");
gsub(/\t/, "\\t");
gsub(/\r/, "\\r");
r = r $0
}
END { print r }
' | tr -d '\n'
}

case "$1" in
list)
json_init
Expand All @@ -56,13 +69,13 @@ call)
json_get_var v4_port v4_port
json_get_var v6_port v6_port

jsonreq4=$(echo "/${otable}" | nc 127.0.0.1 "${v4_port}" | sed -n '/^[}{ ]/p' 2>/dev/null)
jsonreq6=$(echo "/${otable}" | nc ::1 "${v6_port}" | sed -n '/^[}{ ]/p' 2>/dev/null)

json_init
json_add_string "jsonreq4" "$jsonreq4"
json_add_string "jsonreq6" "$jsonreq6"
json_dump
{
printf '{"jsonreq4":"'
echo "/${otable}" | nc 127.0.0.1 "${v4_port}" | sed -n '/^[}{ ]/p' | json_stringescape
printf '","jsonreq6":"'
echo "/${otable}" | nc ::1 "${v6_port}" | sed -n '/^[}{ ]/p' | json_stringescape
printf '"}\n'
} 2>/dev/null
;;
hasipip)
result=$(ls /etc/modules.d/ | grep -E "[0-9]*-ipip")
Expand Down