Giter VIP home page Giter VIP logo

packages's People

Contributors

2tata avatar 6e006b avatar aiyionprime avatar ambassador86 avatar bdobe avatar belzebub40k avatar blocktrron avatar christf avatar citronalco avatar corny avatar feckert avatar genofire avatar jplitza avatar kokel avatar larsbu avatar lcb01a avatar lemoer avatar mkg20001 avatar mweinelt avatar neocturne avatar ohrensessel avatar penguineer avatar philzen avatar ralfjung avatar rubo77 avatar sargon avatar svenroederer avatar t-8ch avatar t-x avatar tobleminer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packages's Issues

respondd provider for cfg80211 DFS state

It is currently unclear how well the DFS stack currently used in OpenWrt and Linux in general performs, especially with different radio drivers, that each have to reimplement the pulse pattern detection, so the general idea is to collect data to compare different radios and locations, to eventually see the area in which a DFS event took place and check if the devices back each others claims..

Testing could be done with an SDR and https://github.com/TobleMiner/dfs-pulse-tester, if @TobleMiner can confirm it works for that purpose.

cfg80211 can be queried via nl80211 and offers the following state:

  • NL80211_FREQUENCY_ATTR_DFS_STATE is one of usable, available, unavailable, unknown
  • NL80211_FREQUENCY_ATTR_DFS_TIME holds the time, that a channel is in the above state

So the proposed format would be a list of channels containing their respective state and the time they've been in that state.

Basically:

  • loop over all channels
    • drop NL80211_FREQUENCY_ATTR_DISABLED
    • drop NL80211_FREQUENCY_ATTR_INDOOR_ONLY
    • report state and time
{
  "wireless": {
    "dfs": {
      "100": {"state": "available", "for": "35580"},
      "104": {"state": "usable", "for": "35769"},
      ...
    }
  }
}

Improve the flexibility of respondd providers

I really dislike the fact that writing a data for respondd now has to be done in C. This makes the whole process of monitoring a lot more static. It should be a lot easier and faster to add new data to respondd.

The common data sources in providers are:

  • uci
  • ubus call
  • file
  • constant

The idea is now to cover this data in a config file and add some post processing. Maybe we can do this with kind of a domain specific language (DSL) in lua:

The main functionality would be given by this functions:

provide(source, postprocessing_handler, cache_time)
emit(json_path, value)
as(json_path)(value, emit) -- higher order function, simply "emits" its value

Constant:

provide(const('1'), as('/node/software/status-page/apiverison'), 60000)

File:

provide(file('/sys/module/batman_adv/version'),
        as('/node/software/batman-adv/version'), infinity)

UCI value:

provide(uci_option('system.@system[0].hostname'), as('/node/hostname'), 60000)

Custom post processing handler:

provide(uci_option('autoupdater.settings'), function (result, emit)
  emit('/node/software/autoupdater/enabled', result['enabled'])
  emit('/node/software/autoupdater/branch', result['branch'])
end, 60000)

UBus call:

provide(ubus_call('system', 'info'), function (result, emit)
  emit('/statistics/loadavg', result['load'][0])
  emit('/statistics/uptime', result['uptime'])
  emit('/statistics/memory', result['memory'])
end, 60000)

I think the fact that the previous respondd implementation with lua providers caused a lot of memory consumption, was caused by the fact, that a lot of lua modules (uci, ubus, ...) were loaded by the provider modules. Maybe this could be solved by implementing the above mentioned functions in C using the native bindings.

What do you think about this idea?

uci set autoupdater getting into otions instead of list

When i do:
uci set autoupdater.testing.mirror=http://MirrorURL

then cat /etc/config/autoupdater
is see:
config branch 'testing'
........
option name 'testing'
----> option mirror 'http://MirrorURL'

instead of:
list mirror 'http://MirrorURL'

so autoupdater is failing:
/usr/bin/lua: /usr/sbin/autoupdater:301: bad argument #1 to 'remove' (table expected, got string)
stack traceback:
[C]: in function 'remove'
/usr/sbin/autoupdater:301: in main chunk
[C]: ?

when i switch it manually everything works fine. is uci using an old option here?

is this a bug or a feature?

ebtables-tiny: missing `redirect` target

The stripped-down version of ebtables-tiny is unfortunately missing the redirect target (for the broute table). Is there an easy switch (config option) to build gluon with the original ebtables version instead of tiny? Or could you please include the redirect extension (ebt_redirect.c) in the tiny package as well? Thanks!

autoupdater: segfault when sending ctrl+c during hanging request

root@ma42-cpe:~# autoupdater 
Retrieving manifest from http://autoupdater-broken.mkg20001.io/broken/experimental.manifest ...
^Cautoupdater: warning: manifest http://autoupdater-broken.mkg20001.io/broken/experimental.manifest only carried 0 valid signatures, 1 are required
Retrieving manifest from http://1.1.1.1/404/experimental.manifest ...
Segmentation fault

reproduce:

config branch 'experimental'
	list mirror 'http://autoupdater-broken.mkg20001.io/broken'
	list mirror 'http://1.1.1.1/404'
	option good_signatures '1'
	option name 'experimental'
	list pubkey '5b755c0064558fe7a6c809a086d57ede9b89b07b25d95e1efe3cfe048b176621'

autoupdater-broken is simply 8.8.8.8 behind cloudflare (really any ip that blackholes port 80)

when autoupdater is fetching this hanging request and the fetching is interrupted with ctrl+c, it just goes on fetching the next url, but apparently without cleaning up properly

(note that it must fetch autoupdater-broken first, then 1.1.1.1 for the crash to occur. also the request must go as far as establishing a connection and sending the GET there)

also I don't think it should even do anything except cleanup after ctrl+c

autoupdater: if selected branch is not in selectbox, show empty selection

If a node has a value for branch in the config that is not in the list of autoupdater mirrors from site.conf, then the selectbox is mislieadingly showing the first option as selected.

In that case, it should either show an empty selection or better, show the stored selection as new added option to the selectbox.

tunneldigger: unnecessary kmod-l2tp-ip dependency?

The Tunneldigger OpenWrt Makefile currently depends on on the kmod packages kmod-l2tp, kmod-l2tp-eth and kmod-l2tp-ip. kmod-l2tp-ip shouldn't be needed, as Tunneldigger uses the UDP L2TP transport and not raw IP.

Am I overlooking something, or can this dependency be removed? I have not tried removing it myself, as I don't have a Tunneldigger setup to test the change.

cc @RalfJung @kaechele

Respondd information for active channels/txpower, batman nexthop and airtime

(Probably related to #67)

We created a package for Freifunk Frankfurt to provide:

  • Configured channels/TX Power for wifi interfaces
  • The batman nexthop
  • Wifi airtime

Module: https://github.com/freifunk-ffm/ffffmlib-playground

The module is implemented as a shared library providing the functionality, a lua module using it , three alfred/old-respondd modules and two respondd modules.

We would like to have it integrated into gluon packages proper. For that I have some questions:

  • Is this acceptable for gluon packages?
  • Is this layout acceptable?

Of course I would remove all the ffffm strings.

Cc @oszilloskop, @eberhab

respondd-module-airtime: Don't complain without wifi?

When executed in a VM for example, I see the following in the logs a lot:

respondd[2552]: netlink.c: error on line 28

The netlink.c actually is from respondd-module-airtime, and it's probably caused by the lack of wifi interfaces and thus the lack of netlink answers.

autoupdater: extremely slow image download on HiveAP

I'm currently using autoupdater to update the firmware on an Aerohive HiveAP 330. Which takes ages.
So I've used that time to find out about what's holding it up.
The HiveAP 330 uses a 9600bps console output, so any output takes a long time.

The while loop in recv_image_cb outputs the progress in every iteration:

/** Receives data from uclient and writes it to file */
static void recv_image_cb(struct uclient *cl) {
struct recv_image_ctx *ctx = uclient_get_custom(cl);
char buf[1024];
int len;
while (true) {
len = uclient_read_account(cl, buf, sizeof(buf));
if (len <= 0)
return;
printf(
"\rDownloading image: % 5zi / %zi KiB",
uclient_data(cl)->downloaded / 1024,
uclient_data(cl)->length / 1024
);
fflush(stdout);
if (write(ctx->fd, buf, len) < len) {
fputs("autoupdater: error: downloading firmware image failed: ", stderr);
perror(NULL);
return;
}
ecdsa_sha256_update(&ctx->hash_ctx, buf, len);
}
}

Maybe it would be beneficial if the downloading progress would only get shown, like, every 128th iteration or so?

On a sidenote, it also looks to me like the SHA256 checksum is calculated for every iteration as well? Is this necessary? Wouldn't it be sufficient to calculate it once the download is completed?

ecdsa_sha256_update(&ctx->hash_ctx, buf, len);

Okay, it finally finished downloading, took about 20 minutes for the 44MB image...

EDIT:
using # autoupdater >/dev/null it took merely a couple seconds to download the image. So it definitely is related to terminal output.

respondd does not mark the "primary0" mac as the "MainIF/MAC"

the main batman-adv-mac "primary0" is not listed/marked explicitly.
Since this primary0 is the one you need to now to use features like "batctl tp", it's a guessing-game to identify the right mac from the "mixed list".
(propably it's the one ending on "b" or "3", but that's just a guess, it would be better to have it clearly identified on the datagrams provided by respondd.)

respondd-module-airtime: Allocation checks missing

Next to the checks missing as noted in #157 it seems like there are a few more allocation checks missing.

In the C standard, a NULL pointer dereference is undefined. While on Linux it usually just kills the program with a SIGSEGV, it seems that a NULL pointer dereference together with compiler optimizations can cause more serious issues. Read Tim Armstrong's reply here for instance (which references/summarizes an LLVM blog post):

https://www.quora.com/What-actually-happens-when-dereferencing-a-NULL-pointer

Currently unchecked allocation examples:

respondd-module-airtime crashes without rx_time/tx_time

The DIR-860L with mediatek wifi does not offer rx/tx time:

$ iw dev wlan0 survey dump
Survey data from wlan0
  frequency:      5180 MHz [in use]
  channel active time:    4320701 ms
  channel busy time:    1316279 ms

The airtime module expects these fields an crashes:

root@device:/etc/init.d# dmesg | grep SEG                                                                                              
[  152.200000] do_page_fault(): sending SIGSEGV to respondd for invalid read access from 00000004                                            
[  212.200000] do_page_fault(): sending SIGSEGV to respondd for invalid read access from 00000004                                            
[  272.200000] do_page_fault(): sending SIGSEGV to respondd for invalid read access from 00000004                                            
[  332.200000] do_page_fault(): sending SIGSEGV to respondd for invalid read access from 00000004                                            
[  392.200000] do_page_fault(): sending SIGSEGV to respondd for invalid read access from 00000004                                            
[  452.790000] do_page_fault(): sending SIGSEGV to respondd for invalid read access from 00000004                                            
[230475.420000] do_page_fault(): sending SIGSEGV to respondd for invalid read access from 00000004                                           
root@device:/etc/init.d# logread | grep "kern.info"                                                                                    
Mon Jan 30 20:53:13 2017 kern.info kernel: [230475.420000]                                                                                   
Mon Jan 30 20:53:13 2017 kern.info kernel: [230475.420000] do_page_fault(): sending SIGSEGV to respondd for invalid read access from 00000004
Mon Jan 30 20:53:13 2017 kern.info kernel: [230475.440000] epc = 76f1ebf5 in airtime.so[76f1e000+11000]                                      
Mon Jan 30 20:53:13 2017 kern.info kernel: [230475.450000] ra  = 76f1ebeb in airtime.so[76f1e000+11000]                                      

autoupdater: Firmware version 1.7.0 not considered newer than 1.7.0~rc1

It used to be the case that (following Debian's handling of version numbers) firmware version 1.7.0 was considered newer than 1.7.0~rc1. However, with the latest gluon 2018.1.3, that does not seem to work any more: We have rolled out 1.7.0~rc1 on our beta branch, and now we built 1.7.0, but even when doing a force update check the autoupdater just says "No new firmware available."

autoupdater: manifest enforded update by negative priority

I had a quick review on the new implementation of the autoupdater, I am not sure if this behavior is present in the older lua implementation. When a negative priority is presented in the manifest [1] the probability mechanism implement in [2] is basically deactivated, except for the case when diff itself is negative.

[1] https://github.com/freifunk-gluon/packages/blob/master/admin/autoupdater/src/manifest.c#L113
[2] https://github.com/freifunk-gluon/packages/blob/master/admin/autoupdater/src/autoupdater.c#L155

Manually testing respondd

I am trying to troubleshoot my Gluon node not appearing on the Freifunk map. This is a rather common problem, especially after some recent changes to Gluon.

In the process, I wanted to check that respondd is working properly. So I wanted to test it from the command line. I got as far as this:

printf "GET nodeinfo" | socat STDIO UDP6-DATAGRAM:[fe80::5054:ff:fe12:3456]:1001

The trouble is, the data returned is compressed. How can I decompress it with command-line tools? "gunzip -d" does not work. Some people suggest using "openssl zlib -d" or some other such tool, but I could not find anything readily available on Gluon.

I would like to improve respondd's documentation with the information collected here.

wgpeerselector: add wgkex support

As discussed in the gluon meetup today, we want to allow using wgpeerselector in combination with wgkex.

The only (big) missing piece is an HTTPS request to the broker as done here.

I would suggest to add the request here (after the NTP check):

if not time_synchronized then
-- WireGuard requires time to be monotonic (always increasing). If
-- there was a handshake with a peer once, where we had a higher time
-- than our current time, this peer will not accept our handshakes
-- until our current time rises above the we had time when the peer had
-- the last handshake with us. This usually happens on devices without
-- real time clock, like embedded routers. When we rebooted and therefore
-- reset our time, the time is lower and handshakes with our last peer
-- will fail. Therefore we try to synchronize time by calling ntp.
--
-- Another possibility, if a boot counter is implemented is outlined here:
-- https://lists.zx2c4.com/pipermail/wireguard/2019-February/003850.html
time_synchronized = self:sync_ntp()
end
if #self.queued_peers < 1 then
self:queue_all_peers()

However, the wgkex broker currently expects requests that include {"domain": "'"$SEGMENT"'", "public_key": "'"$PUBLICKEY"'"} in the http body. From the context of the wgpeerselector this information is not tangible. As of now, the wgpeerselector does not know about "domains", as it does not contain gluon code. So this problem needs to be addressed in some way.

@goligo wants to take a look at this. I am open to discuss this here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.