[fix] Offline clients

I constantly asked GL team to do something about this, because all my clients have constant MAC randomization, it causes client section overfill and glitches. In rare cases (if you connect to router 15 devices which flip-flop mac each hour) it will cause inability to connect to router.

But nobody did nothing.

So here am I, I wrote init script to fix it. Probably it is sledgehammer approach, but at least after reboot it will fix behavior. At least not full reset.

#!/bin/sh /etc/rc.common
# put /etc/oui-tertf in RAM
START=8
STOP=95
NAME=ouitertf-ram
LOGTAG=$NAME

log() { logger -t "$LOGTAG" -- "$1"; }

is_mounted() { grep -q " /etc/oui-tertf " /proc/mounts; }

mount_if_needed() {
  is_mounted && { log "already mounted"; return 0; }

  mkdir -p /tmp/oui-tertf /etc/oui-tertf
  chmod 0755 /tmp/oui-tertf
  : >/tmp/oui-tertf/client.db 2>/dev/null || true

  if mount --bind /tmp/oui-tertf /etc/oui-tertf; then
    log "mounted /tmp/oui-tertf -> /etc/oui-tertf"
    return 0
  fi

  log "mount failed"
  return 1
}

start() {
  log "start"
  mount_if_needed
}

stop() {
  log "stop"
  is_mounted || { log "not mounted"; return 0; }
  if umount -l /etc/oui-tertf; then
    log "unmounted /etc/oui-tertf"
  else
    log "umount failed (ignored)"
  fi
}

But better have option to disable recording fully.

3 Likes

Hi

Thank you for sharing the script.

We are aware of this issue and have begun working on a fix.

However, due to the complexity of the solution—which requires simultaneous modifications to both the UI and backend—it may take some time to resolve.

We appreciate your understanding and patience.

If you want to completely disable this feature, including the display of online devices, you can SSH into the router and run:

/etc/init.d/gl_clients disable
/etc/init.d/gl_clients stop
3 Likes

@will.qiu

I was able to reproduce issue too.

Router starts behaving when you change mac address approximately 40-60 times.

Yeah, it is huge amount, but... User can have many devices (personaly I have 3 computers, 2 tablets and 4 phones which swaps MAC on each reconnecting, and it is only me)

Also it make router vulnerable to DOS (attacker can use Alpha and flood pool with fake clients).

Possible solution:

  1. I think router should NOT remember offline clients by default UNLESS user select specific one to for example limit or interact with it via this menu.
  2. There should be a notice that client can bypass restrictions by altering MAC and that this is not bulletproof. So that person won't be misleaded.

Also, here is my fixes to your script

According to blue-merle project it better use 9-99 not 8-95.

#!/bin/sh /etc/rc.common
START=9
STOP=99
NAME=ouitertf-ram
 
is_mounted() {
  grep -q " /etc/oui-tertf " /proc/mounts
}
 
mount_if_needed() {
  is_mounted && return 0
 
  mkdir -p /tmp/oui-tertf
  chmod 0755 /tmp/oui-tertf
 
  touch /tmp/oui-tertf/client.db
 
  mkdir -p /etc/oui-tertf
  mount --bind /tmp/oui-tertf /etc/oui-tertf
  return 0
}
 
start() {
  mount_if_needed
}
 
stop() {
  if is_mounted; then
    umount -l /etc/oui-tertf || true
  fi
}

Also I added touch command to avoid errors "no such file". It will create empty one.

We already included this clarification in the interface notice, as shown here.
It informs users that MAC-based controls can be bypassed and are not fully reliable.