Skip to content
Open
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 @@ -153,5 +153,7 @@ const olsrview = view.extend({

return L.Class.extend({
olsrview: olsrview,
etx_color: etx_color,
snr_colors: snr_colors,

});
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 @@ -25,7 +25,7 @@ return olsr.olsrview.extend({
if (a.proto === b.proto) {
return a.genmask < b.genmask;
} else {
return a.proto < b.proto;
return a.proto < b.proto ? -1 : a.proto > b.proto ? 1 : 0;
}
}
let modifiedData;
Expand Down Expand Up @@ -173,7 +173,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 @@ -90,7 +90,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 @@ -81,7 +81,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 @@ -20,7 +20,7 @@ return olsr.olsrview.extend({
if (a.proto === b.proto) {
return a.linkCost < b.linkCost;
} else {
return a.proto < b.proto;
return a.proto < b.proto ? -1 : a.proto > b.proto ? 1 : 0;
}
}

Expand Down Expand Up @@ -171,11 +171,11 @@ return olsr.olsrview.extend({
const rv = [];
for (let link of neigh_res) {
link.linkCost = (link.linkCost).toFixed(3) || 0;
if (link.linkCost === 4194304) {
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);
const snr_color = olsr.snr_colors(link.snr);
Comment thread
gratux marked this conversation as resolved.
let defaultgw_color = '';
if (link.defaultgw === 1) {
defaultgw_color = '#ffff99';
Expand Down Expand Up @@ -299,8 +299,8 @@ return olsr.olsrview.extend({
link.linkCost = 0;
}

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

if (link.snr === 0) {
link.snr = '?';
Expand Down Expand Up @@ -449,7 +449,7 @@ return olsr.olsrview.extend({
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 @@ -25,7 +25,7 @@ return olsr.olsrview.extend({
if (a.proto === b.proto) {
return a.rtpMetricCost < b.rtpMetricCost;
} else {
return a.proto < b.proto;
return a.proto < b.proto ? -1 : a.proto > b.proto ? 1 : 0;
}
}
let modifiedData;
Expand Down Expand Up @@ -105,7 +105,7 @@ return olsr.olsrview.extend({
interface: route.networkInterface,
metric: route.metric,
etx: ETX,
color: etx_color(parseFloat(ETX)),
color: olsr.etx_color(parseFloat(ETX)),
});
}

Expand Down Expand Up @@ -172,7 +172,7 @@ return olsr.olsrview.extend({

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 @@ 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
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 @@ -22,7 +22,7 @@ return olsr.olsrview.extend({
if (a.proto === b.proto) {
return a.tcEdgeCost < b.tcEdgeCost;
} else {
return a.proto < b.proto;
return a.proto < b.proto ? -1 : a.proto > b.proto ? 1 : 0;
}
}

Expand Down 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
Loading