Misc

Contents

2015
2019
2020
2021
2022

Dhewm 3 no key patch

Diff below disables the dhewm3 cd key check in case you lost yours:

--- a/neo/framework/BuildDefines.h
+++ b/neo/framework/BuildDefines.h
@@ -79,7 +79,7 @@

 #ifndef ID_ENFORCE_KEY
 #	if !defined( ID_DEDICATED )
-#		define ID_ENFORCE_KEY 1
+#		define ID_ENFORCE_KEY 0
 #	else
 #		define ID_ENFORCE_KEY 0
 #	endif

Fibre Optic Internet

I have always wanted fiber optic internet services at home and I finally got it. In our neighborhood, Telus can provide service. We signed up for the 750 Mbps plan and speeds are about 2/3 of advertised.

With the stock company optical network terminal (ONT) box the performance was 300 Mbps upload and 500 Mbps download.

Next I removed the small form-factor pluggable transciever (SFP) from their ONT and inserted it into my Ubiquiti EdgeRouter 6P. It was barely confirmed in my mind that this would work, but the SFP fit.

With the EdgeRouter 6P the performance was around 400 MBps both ways.

I have only seen one IPv4 address available for dynamic assignment, but it has been stable. IPv6 works too using DHCPv6 prefix delegation.

This package costs $110/month for 6 months and then $180/month after. That price includes two IPTV set top boxes.

One IPTV box uses wireless and I have not figured out how to enable multicast to allow it to work. The wired one required some software configuration on the EdgeRouter, mcast-proxy. mcast-proxy feels better than igmpproxy which I could not get to work.

queue(3) macros

I have been using the queue(3) macros recently to replace a home rolled linked list implementation.

One problem is that these are macros, so do not pass expressions with side effects as parameters!

$ cat main.c
#include <sys/queue.h>

#include <stdio.h>


struct t {
	SIMPLEQ_ENTRY(t)	next;
	char			mumble;
} at;
SIMPLEQ_HEAD(ah, t) head;

struct t *
func(struct t *st)
{
	printf(">>> in func\n");
	return st;
}

int
main(void)
{
	SIMPLEQ_INIT(&head);
	SIMPLEQ_INSERT_TAIL(&head, func(&at), next);
}

$ cc main.c
$ ./a.out
>>> in func
>>> in func
>>> in func

hostapd WPS example

root@ap:~# hostapd_cli
hostapd_cli v2.9
Copyright (c) 2004-2019, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.


Selected interface 'wlan0'

Interactive mode

> wps_get_status
PBC Status: Disabled
Last WPS result: None
>
> <3>AP-STA-CONNECTED e0:5f:45:4b:87:a2

>
> wps_pbc
<3>WPS-PBC-ACTIVE
OK
> <3>WPS-ENROLLEE-SEEN f4:0e:83:0c:b3:2d 28f3e3de-a369-5af0-aad6-1a47f601cd6b 0-00000000-0 0x2688 4 1 [Cisco Client]
<3>STA-OPMODE-N_SS-CHANGED f4:0e:83:0c:b3:2d 3
<3>CTRL-EVENT-EAP-STARTED f4:0e:83:0c:b3:2d
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
<3>WPS-REG-SUCCESS f4:0e:83:0c:b3:2d 28f3e3de-a369-5af0-aad6-1a47f601cd6b
<3>WPS-PBC-DISABLE
<3>WPS-SUCCESS
<3>CTRL-EVENT-EAP-FAILURE f4:0e:83:0c:b3:2d
<3>STA-OPMODE-N_SS-CHANGED f4:0e:83:0c:b3:2d 1
<3>STA-OPMODE-N_SS-CHANGED f4:0e:83:0c:b3:2d 3
<3>AP-STA-CONNECTED f4:0e:83:0c:b3:2d

> wps_get_status
PBC Status: Disabled
Last WPS result: Success
Peer Address: f4:0e:83:0c:b3:2d
>

Make as a test framework

I have seen at least 2 large mature projects use make(1) as their test framework. I do not think this is the right tool for the job because make really wants you to create output files named similar to the input files, which is not really what a test does. Yes you can force it to do what you want, but its painful.

Testing software is inherently complicated, likely more complicated than the implementation itself, so you need at least as much expressive power in the test framework as the implementation.

I would not normally advocate for Perl but as a test language it is almost perfect for that job. All those strange modules on CPAN start to look appealing when you are trying to get your code to trigger rare edge cases.

Do not try to reinvent test reporting either, just use the Test Anything protocol. It has good properties for running tests, like early test exit detection, failure counting, and reporting. There are lots of tools already built around it, too. It was also invented by Perl.

Do not use make(1) for testing frameworks. I am not sure why you are even thinking about it.