<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="feed.xslt.xml"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Blargh</title>
    <description>The blog where I write down random techy things I've found or done.
</description>
    <link>https://blog.habets.se/</link>
    <atom:link href="https://blog.habets.se/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Wed, 28 Oct 2026 13:41:37 +0000</pubDate>
    <lastBuildDate>Wed, 28 Oct 2026 13:41:37 +0000</lastBuildDate>
    <generator>Jekyll v3.2.1</generator>
    
      <item>
        <title>Fixing SCHED_IDLE for real</title>
        <description>&lt;p&gt;I’ve wondered for years why &lt;code class=&quot;highlighter-rouge&quot;&gt;SCHED_IDLE&lt;/code&gt; tasks are allowed to preempt other
tasks. Nobody seems to know, and I’ve not had the time to dig in and understand
the Linux kernel scheduler better. But now I finally have my answer.&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The problem&lt;/h2&gt;

&lt;p&gt;I want to be able to run a CPU-heavy task in the background, without it
stealing any CPU, &lt;em&gt;any at all&lt;/em&gt;, from other processes.&lt;/p&gt;

&lt;p&gt;If you read various documentation, you’d be forgiven if this is as simple as
&lt;code class=&quot;highlighter-rouge&quot;&gt;schedtool -D -e ./my-background-thing&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SCHED_FIFO can be used only with static priorities higher than 0,
which means that when a SCHED_FIFO thread becomes runnable, it
will always immediately preempt any currently running SCHED_OTHER,
SCHED_BATCH, or SCHED_IDLE thread.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;(and similar statements, e.g. from &lt;a href=&quot;https://man7.org/linux/man-pages/man7/sched.7.html&quot;&gt;sched.7&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;But if you try that, you’ll find that it’ll actually preempt other processes,
taking little but nonzero CPU. There’s &lt;a href=&quot;https://github.com/ThomasHabets/idletest/blob/main/idletest.c&quot;&gt;a test program&lt;/a&gt;, if you want to
try it out.&lt;/p&gt;

&lt;p&gt;I literally want it to take zero CPU. And not just against &lt;code class=&quot;highlighter-rouge&quot;&gt;SCHED_FIFO/RR&lt;/code&gt;, but
everything.&lt;/p&gt;

&lt;h2 id=&quot;the-existing-settings&quot;&gt;The existing settings&lt;/h2&gt;

&lt;p&gt;There appear to be two places that minmax guarantees can show up.&lt;/p&gt;

&lt;p&gt;Settings with default values:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo sysctl -a | grep sched_rt_
kernel.sched_rt_period_us = 1000000
kernel.sched_rt_runtime_us = 950000
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If &lt;code class=&quot;highlighter-rouge&quot;&gt;CONFIG_RT_GROUP_SCHED&lt;/code&gt; is enabled in the kernel, then this setting is the
maximum limit how much CPU the real-time (RT) classes (&lt;code class=&quot;highlighter-rouge&quot;&gt;FIFO&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;RR&lt;/code&gt;) can
take, if there are other runnable processes. If &lt;code class=&quot;highlighter-rouge&quot;&gt;CONFIG_RT_GROUP_SCHED&lt;/code&gt; is not
enabled, then it’s a more hazy tunable, with no preemption guarantees.&lt;/p&gt;

&lt;p&gt;You can set &lt;code class=&quot;highlighter-rouge&quot;&gt;kernel.sched_rt_runtime_us&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;1000000&lt;/code&gt;, to remove this limit. (though
again, it’s not actually a limit unless &lt;code class=&quot;highlighter-rouge&quot;&gt;CONFIG_RT_GROUP_SCHED&lt;/code&gt; is enabled)&lt;/p&gt;

&lt;p&gt;Actually, technically &lt;code class=&quot;highlighter-rouge&quot;&gt;-1&lt;/code&gt; removes the limit, and &lt;code class=&quot;highlighter-rouge&quot;&gt;1000000&lt;/code&gt; just sets it to
allow taking all of it. I’m not sure what the difference between unconstrained
and “constrained to 100%” is.&lt;/p&gt;

&lt;p&gt;But that’s not the only limit, so even with &lt;code class=&quot;highlighter-rouge&quot;&gt;CONFIG_RT_GROUP_SCHED&lt;/code&gt;, the
problem is not fixed.&lt;/p&gt;

&lt;p&gt;So that’s the &lt;em&gt;maximum&lt;/em&gt; that a RT process can claim during contention. But it’s
not the &lt;em&gt;minimum&lt;/em&gt; that other process can take.&lt;/p&gt;

&lt;p&gt;The non-RT processes are scheduled by the “fair scheduler”, and it gives a
minimum of 50ms (50 million nanoseconds) per second that deadlined processes
get to make progress in (I think I got the terminology right on that):&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo grep . /sys/kernel/debug/sched/fair_server/cpu0/{runtime,period}
/sys/kernel/debug/sched/fair_server/cpu0/runtime:50000000
/sys/kernel/debug/sched/fair_server/cpu0/period:1000000000
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If you set &lt;code class=&quot;highlighter-rouge&quot;&gt;/sys/kernel/debug/sched/fair_server/cpu0/runtime&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;0&lt;/code&gt;, then
realtime processes will &lt;em&gt;never&lt;/em&gt; be interrupted by lower priority tasks.&lt;/p&gt;

&lt;p&gt;Note that if your kernel is in lockdown mode (from a SecureBoot), you can
neither read nor write this setting.&lt;/p&gt;

&lt;p&gt;But doing this can make things get wonky. My wifi broke while I was testing this
until I killed the test program. Presumably from my test preventing even
interrupt handling from completing. So if running realtime classes without
limits, you may want to ensure those CPUs have no IRQs assigned to them.&lt;/p&gt;

&lt;p&gt;Maybe changing &lt;code class=&quot;highlighter-rouge&quot;&gt;PREEMPT_RT&lt;/code&gt; in the kernel would fix that aspect, but I’ve not
tried it.&lt;/p&gt;

&lt;p&gt;But this is just for realtime processes. This doesn’t prevent &lt;code class=&quot;highlighter-rouge&quot;&gt;SCHED_IDLE&lt;/code&gt; from
preempting the default scheduling class, &lt;code class=&quot;highlighter-rouge&quot;&gt;SCHED_OTHER&lt;/code&gt;. And this is the main
thing I want to do.&lt;/p&gt;

&lt;h2 id=&quot;schedother-vs-schedidle&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;SCHED_OTHER&lt;/code&gt; vs &lt;code class=&quot;highlighter-rouge&quot;&gt;SCHED_IDLE&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/torvalds/linux/blob/v6.12/kernel/sched/sched.h#L2313&quot;&gt;The scheduler weighting for &lt;code class=&quot;highlighter-rouge&quot;&gt;SCHED_IDLE&lt;/code&gt; is not 0. It’s 3&lt;/a&gt;. &lt;a href=&quot;https://github.com/torvalds/linux/blob/v6.12/kernel/sched/sched.h#L500&quot;&gt;The
default weight is 1024&lt;/a&gt;. This means the supposedly IDLE tasks will
always make progress. Another word for “make progress” is “selfishly steal CPU
resources that could go to higher priority things”.&lt;/p&gt;

&lt;p&gt;This is a compile time constant, and you cannot change it at runtime. It’s not
even as simple as changing the constant and recompiling, because the math
doesn’t work (think divide by zero).&lt;/p&gt;

&lt;p&gt;You can also change weights between cgroups, but again not to zero:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ grep . /sys/fs/cgroup/*/*/cpu.weight
/sys/fs/cgroup/system.slice/accounts-daemon.service/cpu.weight:100
/sys/fs/cgroup/system.slice/avahi-daemon.service/cpu.weight:100
/sys/fs/cgroup/system.slice/bluetooth.service/cpu.weight:100
[…]
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If my goal is not to let the realtime classes dominate, but to prevent &lt;code class=&quot;highlighter-rouge&quot;&gt;IDLE&lt;/code&gt;
from taking even a pinky toe, I’ve actually not solved anything at all.&lt;/p&gt;

&lt;h2 id=&quot;solution-patch-the-kernel&quot;&gt;Solution: patch the kernel&lt;/h2&gt;

&lt;p&gt;I’m not a kernel programmer. But I know a robot who is. After having it confirm
my understanding of the various knobs mentioned, I just said `Make a patched
kernel that allows 0 weighting for SCHED_IDLE against SCHED_OTHER.&lt;/p&gt;

&lt;p&gt;It went &lt;em&gt;brrr&lt;/em&gt; for a while, and even wrote scripts to spin up a VM in qemu to
test with, and finally produced a patch that adds a scheduler feature that
ensures &lt;code class=&quot;highlighter-rouge&quot;&gt;IDLE&lt;/code&gt; only gets scheduled if there’s &lt;em&gt;nothing&lt;/em&gt; non-&lt;code class=&quot;highlighter-rouge&quot;&gt;IDLE&lt;/code&gt; running.&lt;/p&gt;

&lt;p&gt;While I have done some minimal kernel coding manually, I’m not competent to
evaluate the scheduler changes. But it &lt;strong&gt;does&lt;/strong&gt; work. When you enable the
feature, the &lt;code class=&quot;highlighter-rouge&quot;&gt;IDLE&lt;/code&gt; thread instantly stops being scheduled.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo IDLE_ZERO_WEIGHT | sudo tee /sys/kernel/debug/sched/features
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This is a patch on top of kernel 6.12.111, with scripts and stuff in &lt;a href=&quot;https://github.com/ThomasHabets/idletest&quot;&gt;this
repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A patched kernel tree in &lt;a href=&quot;https://github.com/ThomasHabets/linux/tree/idletest&quot;&gt;this branch&lt;/a&gt;, and the exact patch is
&lt;a href=&quot;https://github.com/ThomasHabets/idletest/blob/main/kernel-patch/idle-zero-weight.patch&quot;&gt;this file&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;mission-accomplished&quot;&gt;Mission accomplished?&lt;/h2&gt;

&lt;p&gt;Well, in terms of understanding why it was broken, yes.&lt;/p&gt;

&lt;p&gt;But ideally this scheduler feature should be upstreamed. I need to understand
it fully before I’d ask someone else to take a look.&lt;/p&gt;

&lt;p&gt;But if anybody reading this wants to take that on, go for it!&lt;/p&gt;

&lt;p&gt;Maybe one day our &lt;code class=&quot;highlighter-rouge&quot;&gt;SCHED_IDLE&lt;/code&gt; processes will finally live up to their promise.&lt;/p&gt;

&lt;h2 id=&quot;resources&quot;&gt;Resources&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.kernel.org/core-api/real-time/differences.html&quot;&gt;Kernel docs on realtime scheduler config differences&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://lwn.net/Articles/805317/&quot;&gt;Fixing SCHED_IDLE&lt;/a&gt; (it doesn’t)&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- 
https://stackoverflow.com/questions/79821477/if-i-start-two-strictly-cpu-bound-threads-bound-to-the-same-cpu-and-one-is-sche
--&gt;
</description>
        <pubDate>Wed, 28 Oct 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/10/Fixing-SCHED_IDLE-for-real.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/10/Fixing-SCHED_IDLE-for-real.html</guid>
        
        
        <category>programming</category>
        
        <category>unix</category>
        
      </item>
    
      <item>
        <title>HTTP/3 load balancer connection offloading</title>
        <description>&lt;p&gt;In a previous post I described &lt;a href=&quot;/2025/10/The-strange-webserver-hot-potato-sending-file-descriptors.html&quot;&gt;load balancing for TCP-based HTTP with
connection offloading&lt;/a&gt;, and mentioned that HTTP/3 can do even more. By
the power of AI writing an HTTP/3 version of both the load balancer
(sni-router-h3) and the webserver (tarweb-h3), I have experimented enough to
have more to say about how that works.&lt;/p&gt;

&lt;p&gt;To be clear: this post is 100% human-written.&lt;/p&gt;

&lt;p&gt;In this post I will use this terminology:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;client: E.g. a web browser.&lt;/li&gt;
  &lt;li&gt;router: A load balancer / traffic router, that inspects &lt;a href=&quot;https://en.wikipedia.org/wiki/Server_Name_Indication&quot;&gt;SNI&lt;/a&gt; and forwards to
matching backends. Mine’s called &lt;a href=&quot;https://github.com/ThomasHabets/sni-router&quot;&gt;sni-router&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;backend: A webserver. Mine’s called &lt;a href=&quot;https://github.com/ThomasHabets/tarweb&quot;&gt;tarweb&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;first-the-tcp-story&quot;&gt;First, the TCP story&lt;/h2&gt;

&lt;p&gt;While it is possible to use &lt;code class=&quot;highlighter-rouge&quot;&gt;TCP_REPAIR&lt;/code&gt; to transfer an established connection
between machines (from router to backend), it requires some more
infrastructure. The kernel on the chosen backend must be synced up on the
connection state (sequence numbers, etc) that &lt;code class=&quot;highlighter-rouge&quot;&gt;TCP_REPAIR&lt;/code&gt; provides, but that’s
actually just the easy part. It must also be able to send packets to the client
with the original server’s IP address as source, and packets going from the
client to the backend must somehow find their way to the same backend, in a
network-efficient way.&lt;/p&gt;

&lt;p&gt;There are other problems too, like what to do if a client sends a &lt;code class=&quot;highlighter-rouge&quot;&gt;TCP SYN&lt;/code&gt;
with a source port equal to an existing connection. Which connection should
win for the routing state machine?&lt;/p&gt;

&lt;p&gt;Take the example where the load balancer in New York wants the backend to be in
Oslo, because the client is near there.&lt;/p&gt;

&lt;p&gt;For backend-to-client packets, some network hop on the way may drop the packets
due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Reverse-path_forwarding)&quot;&gt;reverse-path forwarding (RPF)&lt;/a&gt;, because it thinks that IP address
should be in New York, and therefore the packets look like spoofing.&lt;/p&gt;

&lt;p&gt;For client-to-backend packets, there’s no way to announce to the Internet the
difference between initial packets that should go to the load balancer, and
those that should go to the backend. The difference is just the client IP
address and port. And the Internet (specifically &lt;a href=&quot;https://en.wikipedia.org/wiki/Border_Gateway_Protocol&quot;&gt;BGP&lt;/a&gt;) does not work that
way.&lt;/p&gt;

&lt;p&gt;If you have a worldwide presence and private fibre network on the scale of
Google or Amazon, this is physically possible. “Be everywhere” and then on
every new connection you can “just” reprogram all your edge router
infrastructure to route packets arbitrarily over your own world wide (physical)
network, to traffic engineer however you want. But this is basically only if
you have your own world wide “internet” that treats “the Internet” as an equal.&lt;/p&gt;

&lt;p&gt;Yes, for client-to-backend you could use &lt;a href=&quot;https://sre.google/workbook/managing-load/&quot;&gt;stabilized
anycast&lt;/a&gt; if you’re merely medium sized, but this can only
solve the problem if the backend and the load balancer should take the same
path. You’ll need all backend locations to also be load balancing locations,
and vice versa, to have it be optimal. And it can break for longer lived
connections in a dynamic world.&lt;/p&gt;

&lt;p&gt;(A full discussion about anycast TCP is out of scope for this post, but though
I could have made a mistake or have been unclear here, and invite you to
correct me on, if you’re thinking “well, actually you can just…” right now, you
can safely assume that I know and I’ve deliberately left it out.)&lt;/p&gt;

&lt;h2 id=&quot;what-http3-enables&quot;&gt;What HTTP/3 enables&lt;/h2&gt;

&lt;p&gt;HTTP/3 is UDP based, and is not picky about “the 4 tuple” (the values of source
and destination IP addresses and ports). Migrating a connection therefore
doesn’t involve BGP peering or other network tricks. HTTP/3 can thus let
the Internet be a simple packet delivering network that just takes the closest
path between smart endpoints. As was always the dream.&lt;/p&gt;

&lt;h3 id=&quot;case-1-a-new-connection&quot;&gt;Case 1: A new connection&lt;/h3&gt;

&lt;p&gt;For a new connection’s TLS handshake, a client will send the SNI. A SNI router
can then make a routing decision, and forward the packet to the backend.&lt;/p&gt;

&lt;p&gt;During this handshake, the router needs to remember the mapping from Connection
ID (CID) to the backend it selected when it saw the SNI.&lt;/p&gt;

&lt;h3 id=&quot;case-2-router-sees-a-packet-from-an-unknown-connection&quot;&gt;Case 2: Router sees a packet from an unknown connection&lt;/h3&gt;

&lt;p&gt;After the handshake is complete, the client and the backend can open new
connections with new CIDs. This is so that a passive evesdropper cannot track
connections, including as they migrate if the client roams somewhere else.
Since the router also never sees the plaintext, it is not aware of the new
connection ID.&lt;/p&gt;

&lt;p&gt;It could fall back to remembering the client host-port pair, but clients can
migrate, and that should not break connections. It can be used if the client
migrates &lt;em&gt;during&lt;/em&gt; the handshake, though.&lt;/p&gt;

&lt;p&gt;Even if it did know about the new Connection ID (which it doesn’t), or
remembered the client IP-port pair (it can’t, because client address
migrations), it shouldn’t need to know about this forever, e.g. across router
restarts.&lt;/p&gt;

&lt;p&gt;This case is solved by &lt;a href=&quot;https://datatracker.ietf.org/doc/html/draft-ietf-quic-load-balancers-22&quot;&gt;QUIC-LB&lt;/a&gt;. Outshort, the backend will put its
“backend ID” into the new Connection ID, and the router can then use that to
make sure it forwards to the same backend, even without keeping any state.&lt;/p&gt;

&lt;p&gt;An entire QUIC Connection ID is at most 160 bits, so there isn’t spare room to
put a whole 128 bit IPv6 address plus 16 bit port in there. The solution is to
have a lookup table from backend ID to backend address:port.&lt;/p&gt;

&lt;p&gt;The Connection ID with the backend ID is then optionally encrypted, so that
attackers can’t control it for whatever nefarious purpose. If we were to stop
here, it could be to prevent attackers from targeting a specific backend. But
handling case 3 nicely, below, forces us to publicly expose backends anyway.&lt;/p&gt;

&lt;p&gt;QUIC-LB is a draft standard, but in my case both router and backend follow the
same standard, and therefore work together.&lt;/p&gt;

&lt;p&gt;For sni-router, the config looks like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;quic_lb: &amp;lt;
        config_id: 0
        key_file: &quot;/etc/sni-router/quic-lb.key&quot;
        servers: &amp;lt;
                server_id: 123 addr: &quot;192.0.2.123:8444&quot;
        &amp;gt;
        servers: &amp;lt;
                server_id: 124 addr: &quot;192.0.2.13:8444&quot;
        &amp;gt;
&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The config ID is there to allow changing the backend list over time, as a
generation number. Though it’s only 3 bits, so few config generations can be
active at the same time.&lt;/p&gt;

&lt;p&gt;But case 2 shouldn’t happen, because…&lt;/p&gt;

&lt;h3 id=&quot;case-3-backend-announced-preferred-address&quot;&gt;Case 3: Backend-announced preferred address&lt;/h3&gt;

&lt;p&gt;During the TLS handshake, which always goes via the router (though the router
only forwards. It doesn’t “speak” TLS), the backend may announce a &lt;a href=&quot;https://www.rfc-editor.org/rfc/rfc9000.html#section-9.6&quot;&gt;“preferred
address”&lt;/a&gt; (a separate one for IPv4 and IPv6), in other words
that backend’s real IP address.&lt;/p&gt;

&lt;p&gt;The client should then stop sending packets to the router, and instead send
directly to the backend.&lt;/p&gt;

&lt;p&gt;From the backend’s point of view, the client just migrated, and it too will
start sending packets directly, bypassing the router.&lt;/p&gt;

&lt;p&gt;The router is now no longer part of the connection.&lt;/p&gt;

&lt;p&gt;Unfortunately it’s not mandatory that clients respect “preferred address”. And
the backend can’t unilaterally send directly to the client on its own, because
&lt;code class=&quot;highlighter-rouge&quot;&gt;If a client receives packets from a new server address when the client has not
initiated a migration to that address, the client SHOULD discard these
packets&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So if the client doesn’t support preferred address, then we fall back to Case
2, and the router has to take the network load of the traffic. At least it
doesn’t have to decrypt anything.&lt;/p&gt;

&lt;p&gt;In my brief test, Chrome does respect “preferred address”, but &lt;code class=&quot;highlighter-rouge&quot;&gt;curl&lt;/code&gt; does not.&lt;/p&gt;

&lt;p&gt;For command line testing, ngtcp2-client has a client that works.&lt;/p&gt;

&lt;h2 id=&quot;does-it-work&quot;&gt;Does it work?&lt;/h2&gt;

&lt;p&gt;Yeah. Outthis tcpdump (on the client) we see a connection setup seen by
running:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gtlsclient good.habets.uk 443 https://good.habets.uk/
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# TLS handshake between client and router.
09:00:12.366608 eth0  Out IP Client.3968 &amp;gt; Router.443: UDP, length 1200
09:00:12.372773 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.372849 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.372895 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.412559 eth0  Out IP Client.3968 &amp;gt; Router.443: UDP, length 1200
09:00:12.413771 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 928
09:00:12.447141 eth0  Out IP Client.3968 &amp;gt; Router.443: UDP, length 364
09:00:12.448748 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 344
09:00:12.448788 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.448804 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.448820 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.448861 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.448879 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.448913 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
09:00:12.448942 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 268
09:00:12.451582 eth0  Out IP Client.3968 &amp;gt; Router.443: UDP, length 1406
09:00:12.452652 eth0  Out IP Client.3968 &amp;gt; Router.443: UDP, length 44
09:00:12.487682 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 44

# Handshake complete. Traffic is now almost entirely directly between the
# client and the backend. I think the remaining packets are just during the
# migration.
#
# Note that the client port changed, because my NAT router thinks this is a
# completely unrelated connection. That's not a problem.
09:00:12.490258 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 1200
09:00:12.490375 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 1200
09:00:12.490537 eth0  Out IP Client.3968 &amp;gt; Router.443: UDP, length 151
09:00:12.490645 eth0  In  IP Backend.8444 &amp;gt; Client.64998: UDP, length 1200
09:00:12.490758 eth0  In  IP Backend.8444 &amp;gt; Client.64998: UDP, length 1200
09:00:12.490908 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 43
09:00:12.522221 eth0  Out IP Client.3968 &amp;gt; Router.443: UDP, length 1444
09:00:12.523153 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 43
09:00:12.526550 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 1406
09:00:12.527011 eth0  In  IP Backend.8444 &amp;gt; Client.64998: UDP, length 1200
09:00:12.527271 eth0  In  IP Router.443 &amp;gt; Client.3968: UDP, length 1200
# Looks like no more packets to/from Router past this point.
09:00:12.527833 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 42
09:00:12.528160 eth0  In  IP Backend.8444 &amp;gt; Client.64998: UDP, length 1200
09:00:12.560274 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 1444
09:00:12.560699 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 1200
09:00:12.560910 eth0  In  IP Backend.8444 &amp;gt; Client.64998: UDP, length 43
09:00:12.566818 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 1200
09:00:12.583812 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 109
09:00:12.584162 eth0  In  IP Backend.8444 &amp;gt; Client.64998: UDP, length 43
09:00:20.007812 eth0  Out IP Client.64998 &amp;gt; Backend.8444: UDP, length 39
09:00:20.010182 eth0  In  IP Backend.8444 &amp;gt; Client.64998: UDP, length 47
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If you run this test yourself against my example setup, don’t be confused by
the router and backend being on the same address, just different ports. They
happen to only have different ports, but it would work equally well if they
were on different machines.&lt;/p&gt;

&lt;p&gt;I have not dug into the exact packets to/from the router post-handshake. My
guess is that it’s probably the client tearing down that part. But remember,
the router does &lt;strong&gt;not&lt;/strong&gt; speak QUIC at all. Anything the client sent to the
router ends up as-is on the backend. And anything the backend replied back to
the router goes untouched back to the client.&lt;/p&gt;

&lt;p&gt;In my setup the backend allows new connections created directly for it. That
can easily be prevented, by having the backend blocking new connections that
don’t come from the router. Clients may be able to spoof the source to appear
to be the router, but then they should not get any replies, so the connection
establishment will fail.&lt;/p&gt;

</description>
        <pubDate>Tue, 27 Oct 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/10/HTTP3-load-balancer-connection-offloading.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/10/HTTP3-load-balancer-connection-offloading.html</guid>
        
        
        <category>network</category>
        
        <category>web</category>
        
        <category>programming</category>
        
      </item>
    
      <item>
        <title>Attention people who think UB is fine</title>
        <description>&lt;p&gt;After &lt;a href=&quot;https://blog.habets.se/2026/05/Everything-in-C-is-undefined-behavior.html&quot;&gt;my post on undefined behavior in
C&lt;/a&gt;
some people insisted that it’s demonstrably fine, we know what the code will
do, and at worst we’ll get a segfault.&lt;/p&gt;

&lt;p&gt;This is false.&lt;/p&gt;

&lt;p&gt;Here’s an example.&lt;/p&gt;

&lt;h2 id=&quot;c-code&quot;&gt;C code&lt;/h2&gt;

&lt;p&gt;(sorry. This is C++, but the equivalent C code produces &lt;em&gt;exactly&lt;/em&gt; the same
assembly output)&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&amp;lt;utility&amp;gt;
&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Let's pretend this is a memory mapped device controlling
// motors and gears and stuff.
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;volatile&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;device_command&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;serve_hot_chocolate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;device_command&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;// Oh no, we spilled some hot chocolate, invoking UB.
&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;//
&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;// The definition of `std::unreachable()` is:
&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;//     Invokes undefined behavior at a given point.
&lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;unreachable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;explode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;device_command&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;example-assembly-output&quot;&gt;Example assembly output&lt;/h2&gt;

&lt;p&gt;With GCC 16.2 with &lt;code class=&quot;highlighter-rouge&quot;&gt;-O1&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-nasm highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;&quot;serve_hot_chocolate()&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;mov&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PTR&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;device_command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[rip],&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&quot;explode()&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;mov&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PTR&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;device_command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[rip],&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;ret&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&quot;device_command&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;zero&lt;/span&gt;   &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Ruh roh. Exploding chocolate! The function &lt;code class=&quot;highlighter-rouge&quot;&gt;explode()&lt;/code&gt; will be executed, even
though it was never called!&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://godbolt.org/z/Y5844eTKe&quot;&gt;godbolt link&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;another-example-dereferencing-a-null-pointer&quot;&gt;Another example: dereferencing a null pointer&lt;/h2&gt;

&lt;p&gt;Some people insisted that dereferencing a null pointer is &lt;em&gt;fine&lt;/em&gt;. It’ll just
try to access address zero! And these people supposedly know what happens when
you try: if nothing is mapped there, you’ll get a segfault.&lt;/p&gt;

&lt;p&gt;Again, not true.&lt;/p&gt;

&lt;p&gt;Let’s say we change &lt;code class=&quot;highlighter-rouge&quot;&gt;std::unreachable()&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;int* ptr = nullptr; *ptr = 99;&lt;/code&gt; in
the previous example. Now we &lt;a href=&quot;https://godbolt.org/z/efqKrzefa&quot;&gt;get this&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-nasm highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;&quot;serve_hot_chocolate()&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;mov&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PTR&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;device_command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[rip],&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;mov&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PTR&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;ud2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Curious, eh? First it writes zero, &lt;strong&gt;not&lt;/strong&gt; 99, to memory address zero. Then it
crashes the program using an invalid instruction. The number 99 never appears
in the generated program. But the null pointer write does. Presumably the null
pointer write is done in order to improve debugger error messages.&lt;/p&gt;

&lt;p&gt;Now let’s check &lt;a href=&quot;https://godbolt.org/z/86M7MWTT8&quot;&gt;clang with godbolt&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-nasm highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;&quot;serve_hot_chocolate()&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;mov&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;dword&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;device_command&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;&quot;explode()&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;mov&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;dword&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;device_command&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;ret&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;&quot;device_command&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;long&lt;/span&gt;   &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Again we get exploding chocolate.&lt;/p&gt;

&lt;h2 id=&quot;lets-do-some-pointer-arithmetic-on-the-null-pointer&quot;&gt;Let’s do some pointer arithmetic on the null pointer&lt;/h2&gt;

&lt;p&gt;Ok, so what happens if we add &lt;code class=&quot;highlighter-rouge&quot;&gt;ptr += 10&lt;/code&gt;. That’s UB for three reasons:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;using a null pointer for anything other than comparison against other pointers,&lt;/li&gt;
  &lt;li&gt;even if an object would be valid at the null pointer (which it’s not),
creating a pointer that points outside that object, or if an array, beyond
one-past the array, is UB,&lt;/li&gt;
  &lt;li&gt;even if that were valid (which it’s not), we then dereference the address.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let’s &lt;a href=&quot;https://godbolt.org/z/8z6hPPsvG&quot;&gt;try it&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-nasm highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;&quot;serve_hot_chocolate&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;mov&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PTR&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;device_command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[rip],&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;mov&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PTR&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;99&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;ret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Wow. &lt;em&gt;Now&lt;/em&gt; it did what someone naively would expect, taking the code at face
value. Lucky.&lt;/p&gt;

&lt;p&gt;Why did GCC (and clang, by the way) not detect that &lt;code class=&quot;highlighter-rouge&quot;&gt;*(ptr + 10) = 99&lt;/code&gt; is
equally UB as &lt;code class=&quot;highlighter-rouge&quot;&gt;*ptr = 99&lt;/code&gt;, and do the same thing?&lt;/p&gt;

&lt;p&gt;Wrong question. No compiler is obligated to “detect” UB at all. Looks to me
like GCC and clang, if we want to anthropomorphize them, saw “oh, null pointer
dereference? Well that can’t happen, so I’ll stop emitting instructions for
this function, to save on the binary size”. Because of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Halting_problem&quot;&gt;halting
problem&lt;/a&gt;, it cannot in the
general case know if the code will ever be executed.&lt;/p&gt;

&lt;h2 id=&quot;so-what-does-ub-do&quot;&gt;So what does UB do?&lt;/h2&gt;

&lt;p&gt;Anything. I have now demonstrated three things UB can do, when UB was triggered
in the same place:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Run whatever happens to be next in memory (exploding chocolate).&lt;/li&gt;
  &lt;li&gt;Store a (for all intents and purposes) &lt;em&gt;random&lt;/em&gt; value at address zero (wrote
zero, not 99), and then deliberately crash.&lt;/li&gt;
  &lt;li&gt;Do what one would naively expect: write the value to the address seen in the
code at face value.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And to think that some people don’t believe in &lt;a href=&quot;https://en.wikipedia.org/wiki/Undefined_behavior&quot;&gt;nasal
demons&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://news.ycombinator.com/item?id=50227814&quot;&gt;Someone submitted this to HN&lt;/a&gt;.&lt;/p&gt;

&lt;!-- https://news.ycombinator.com/item?id=50203996 --&gt;

</description>
        <pubDate>Thu, 22 Oct 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/10/Attention-people-who-think-UB-is-fine.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/10/Attention-people-who-think-UB-is-fine.html</guid>
        
        
        <category>programming</category>
        
      </item>
    
      <item>
        <title>Inspecting RustRadio and GNU Radio streams dynamically</title>
        <description>&lt;p&gt;When building software defined radio flowgraphs it’s common to want to inspect
the live data as it flows through various stages. In GNU Radio, and RustRadio,
the handoff points are very clear. They are the streams between the blocks.&lt;/p&gt;

&lt;p&gt;In GNU Radio you can stop the graph, click a bit in gnuradio-companion, and
have a new time sink (or whatever you need) added, and then start the graph up
again. But it makes for a lot of stopping and starting. There’s also the
drawback that it assumes that the GNU Radio flowgraph is graphical in the first
place, and not running headless on a raspberry pi somewhere.&lt;/p&gt;

&lt;p&gt;And for large graphs, preemptively adding GUI elements for everything you may
possibly want to read at runtime can clutter things up, and waste CPU
processing and rendering data you’re not interested in.&lt;/p&gt;

&lt;p&gt;Another use case is if you have a constantly running RF sniff process using an
SDR, to get a second reader of the same data, to help develop the next version
without shutting down the one already running.&lt;/p&gt;

&lt;p&gt;So clearly, what you want is to be able to connect to the flowgraph over the
network, and start streaming any and all streams in the flowgraph.&lt;/p&gt;

&lt;h2 id=&quot;first-implementation-rustradio&quot;&gt;First implementation: RustRadio&lt;/h2&gt;

&lt;p&gt;I showed a screenshot of this in &lt;a href=&quot;/2026/10/SDR-streaming-IQ-protocol.html&quot;&gt;my previous post&lt;/a&gt;. After adding
the ability to sniff streams it looks about the same, but instead of needing to
tee off every stream that may be interesting, and wasting the CPU resources
when the UI is not connected, I’ve now changed it to sniff the streams by name.&lt;/p&gt;

&lt;p&gt;RustRadio has a pretty easy way to sniff the streams by name using &lt;code class=&quot;highlighter-rouge&quot;&gt;.with_…&lt;/code&gt;,
and add other stream metadata. E.g. this is most of the receiver for my &lt;a href=&quot;https://github.com/ThomasHabets/sparslog&quot;&gt;IKEA
sparsnäs decoder&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;prev&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nd&quot;&gt;blockchain!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nn&quot;&gt;FftFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;nn&quot;&gt;rustradio&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;fir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;low_pass_complex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;samp_rate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;50000.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;10000.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;WindowType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Hamming&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nn&quot;&gt;RationalResampler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;f32_to_usize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;samp_rate_2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;f32_to_usize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;samp_rate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nn&quot;&gt;QuadratureDemod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.with_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;filtered&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.with_sample_rate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;samp_rate_2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nn&quot;&gt;AddConst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opt&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;.offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nn&quot;&gt;ZeroCrossing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.with_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;demodulated&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;nf&quot;&gt;.with_sample_rate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;samp_rate_2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;samp_rate_2&lt;/span&gt; / &lt;span class=&quot;n&quot;&gt;baud&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;mf&quot;&gt;0.1&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nn&quot;&gt;BinarySlicer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.with_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;soft-bits&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.with_sample_rate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;baud&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;?&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;.with_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;bits&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;.with_sample_rate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;baud&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;But I’m not restricted to using a fixed UI. The RustRadio UI crate has an
example UI application that can connect to anything, and lets you show a
waterfall of any I/Q stream.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-stream-taps.png&quot;&gt;&lt;img src=&quot;/static/2026-10-stream-taps.png&quot; alt=&quot;I/Q waterfall with selector&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;second-implementation-gnu-radio&quot;&gt;Second implementation: GNU Radio&lt;/h2&gt;

&lt;p&gt;When I told a friend of mine about this he thought it was &lt;em&gt;very&lt;/em&gt; cool. Then he
got disappointed when I said it was just for RustRadio, not GNU Radio.&lt;/p&gt;

&lt;p&gt;Well, let’s see if an LLM can make it happen. Yup, a few tokens later it works
on GNU Radio too.&lt;/p&gt;

&lt;p&gt;Now, the code is probably not suitable for merging &lt;em&gt;at all&lt;/em&gt;, but it’s just a
demo. It’s fine if it’s throwaway code.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-simple.png&quot;&gt;&lt;img src=&quot;/static/2026-10-simple.png&quot; alt=&quot;Simple GNU radio graph&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note the “IQ Stream Server” block, which can be used for dedicated sinks, and
can also “import” all streams in the whole graph.&lt;/p&gt;

&lt;p&gt;My demo does not let me add the true sample rate, though, so imported streams
get a default fake sample rate.&lt;/p&gt;

&lt;p&gt;I can query the available streams at runtime:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ curl -s http://127.0.0.1:50052/iq/v1/streams | jq  '.[] | .name'
&quot;gr/add_cc/5/0/3&quot;
&quot;gr/analog_sig_source_x_0 [this is the source]/10/0/1&quot;
&quot;gr/blocks_throttle2_0 [throttled]/9/0/2&quot;
&quot;gr/fastnoise_source/6/0/8&quot;
&quot;gr/fir_filter_blk&amp;lt;IN_T,OUT_T,TAP_T&amp;gt;/4/0/5&quot;
&quot;gr/mmse_resampler/3/0/4&quot;
&quot;gr/multiply_cc/8/0/7&quot;
&quot;gr/sig_source/7/0/6&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;And I can use the same example I/Q waterfall UI to plot waterfalls from this graph:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-simple-iq.png&quot;&gt;&lt;img src=&quot;/static/2026-10-simple-iq.png&quot; alt=&quot;Waterfall from the GNU Radio graph&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are more streams in that dropdown than there are blocks. That’s because
the Channel Model block is actually a GNU Radio Python hierarchical block, and
we’re seeing all the underlying blocks’ streams.&lt;/p&gt;

&lt;p&gt;Video demo:&lt;/p&gt;

&lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/qLu-j6A5SMc&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;h2 id=&quot;code&quot;&gt;Code&lt;/h2&gt;

&lt;p&gt;This is built into &lt;a href=&quot;https://github.com/ThomasHabets/rustradio&quot;&gt;RustRadio&lt;/a&gt;, with the WASM-based UI code in
&lt;a href=&quot;https://github.com/ThomasHabets/rustradio-ui&quot;&gt;rustradio UI&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The vibecoded changes to GNU Radio are in &lt;a href=&quot;https://github.com/ThomasHabets/gnuradio/tree/hooks&quot;&gt;this hooks
branch&lt;/a&gt;, and then the IQ
streaming blocks using the hooks in &lt;a href=&quot;https://github.com/ThomasHabets/gr-iqstream/tree/hooks&quot;&gt;the hooks branch of
gr-iqstream&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Tue, 20 Oct 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/10/Inspecting-RustRadio-and-GNURadio-streams-dynamically.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/10/Inspecting-RustRadio-and-GNURadio-streams-dynamically.html</guid>
        
        
        <category>radio</category>
        
        <category>programming</category>
        
        <category>gnuradio</category>
        
        <category>rustradio</category>
        
        <category>sdr</category>
        
      </item>
    
      <item>
        <title>SDR stream I/Q protocol</title>
        <description>&lt;p&gt;While writing some &lt;a href=&quot;https://en.wikipedia.org/wiki/Software-defined_radio&quot;&gt;software defined radio&lt;/a&gt; applications, I have found
myself wanting to run them headless on some raspberry pi or similar, but then
occasionally connect to it and inspect it live.&lt;/p&gt;

&lt;p&gt;I want to stream sample data, and tags data, and drop data on overflow. The
main use case is for a UI, so it should not block the rest of the processing if
the network or UI is slow, or disconnected.&lt;/p&gt;

&lt;p&gt;I also want the protocol to support lossless sources, for example a stream
coming from a SigMF file.&lt;/p&gt;

&lt;p&gt;I’ve been dragging my heels on this, because surely this protocol already
exists. And if I make a new one then nobody else is compatible with it.&lt;/p&gt;

&lt;h2 id=&quot;requirements&quot;&gt;Requirements&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Support drop-on-overflow, and lossless.&lt;/li&gt;
  &lt;li&gt;Support regular TCP, and connections from JS/WASM websockets.&lt;/li&gt;
  &lt;li&gt;Work with &lt;a href=&quot;https://www.gnuradio.org/&quot;&gt;GNU Radio&lt;/a&gt;, and with &lt;a href=&quot;https://github.com/ThomasHabets/rustradio&quot;&gt;RustRadio&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Because websocket messages are delivered via callback, and thus the TCP flow
control does not propagate back to the sending application, the protocol needs
its own flow control.&lt;/li&gt;
  &lt;li&gt;One port per application, but a client can request uploading or downloading
different streams, by name.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;existing-protocols&quot;&gt;Existing protocols&lt;/h2&gt;

&lt;h3 id=&quot;gnu-radio-zeromq&quot;&gt;GNU Radio ZeroMQ&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-zmq.png&quot;&gt;&lt;img src=&quot;/static/2026-10-zmq.png&quot; alt=&quot;ZeroMQ example in GNU Radio&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GNU Radio has &lt;a href=&quot;https://en.wikipedia.org/wiki/ZeroMQ&quot;&gt;ZeroMQ&lt;/a&gt; sink and source blocks, but a UI running in a
browser would not be able to directly connect to it, since only websockets can be
used from JS or WASM. One can set up &lt;a href=&quot;https://github.com/ThomasHabets/huproxy&quot;&gt;a websocket to TCP gateway&lt;/a&gt;, but
it would be nicer to not need to.&lt;/p&gt;

&lt;p&gt;There would also be some complexity about how to handle overflows, and
requiring the user to choose between the &lt;em&gt;three&lt;/em&gt; ZeroMQ socket patterns.&lt;/p&gt;

&lt;p&gt;The serialization is also GNU Radio specific, and doesn’t surface the flow
control and loss policy I’d want.&lt;/p&gt;

&lt;p&gt;And it’s one TCP port per stream, which is not ideal.&lt;/p&gt;

&lt;h3 id=&quot;vita49vita49&quot;&gt;&lt;a href=&quot;https://www.vita.com/page-1855484&quot;&gt;VITA49&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;VITA49 seems to be the most standard protocol for sending RF data. But it has
very limited support for application metadata (in our case, tags). And no flow control.&lt;/p&gt;

&lt;p&gt;It also doesn’t work directly on websockets, but has the same need for a
websocket-to-TCP layer. Hell, it’s not even meant for TCP, so it’d be a bit
nonstandard to even use it as an in-order stream.&lt;/p&gt;

&lt;p&gt;It does have a message type for extensions, so in theory tags can be serialized
in a custom format, put in VITA49, then wrapped in another custom protocol. Ok,
but what was the point of using a “standard”, then? Just for the IQ samples?
Might as well just put serialized floats on a TCP, in that case.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://docs.rs/vita49/latest/vita49/&quot;&gt;vita49 rust crate&lt;/a&gt; also points out that one can’t “just” use
vita49 and think it’s all one big happy standard.&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;V49.2 provides millions of options for data types and packet structures that
are likely impossible to implement as one application program interface (API)
without culling down to required attributes.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;difidifi&quot;&gt;&lt;a href=&quot;https://www.microwavejournal.com/articles/45651-from-analog-if-to-open-digital-rf-engineering-the-difi-ground-segment&quot;&gt;DIFI&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;DIFI builds on VITA49, and adds flow control. But still no arbitrary tag
support, or anything that maps to it.&lt;/p&gt;

&lt;h2 id=&quot;so-i-guess-im-making-yet-another-protocol&quot;&gt;So I guess I’m making yet another protocol&lt;/h2&gt;

&lt;p&gt;Sigh. Well, at least this unblocks what I want to do. If I find a better
protocol in the future, I can just swap out the implementation.&lt;/p&gt;

&lt;p&gt;If this had been 5 years ago I would have worried about throwaway work, if a
better protocol arrives. But because of AI, I’m OK with throwaway work and more
complex proof of concepts.&lt;/p&gt;

&lt;p&gt;I refer to this as “IQ streaming”, but it supports non-complex data too.&lt;/p&gt;

&lt;p&gt;To at least avoid having yet another parser, and only work with messages, I
decided to base the protocol on gRPC. There’s &lt;a href=&quot;https://github.com/ThomasHabets/rustradio/blob/main/doc/iq-streaming.md&quot;&gt;a protocol
description&lt;/a&gt; and &lt;a href=&quot;https://github.com/ThomasHabets/rustradio/blob/main/proto/iq_stream.proto&quot;&gt;a &lt;code class=&quot;highlighter-rouge&quot;&gt;.proto&lt;/code&gt; file&lt;/a&gt;, for other implementations.&lt;/p&gt;

&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;/h2&gt;

&lt;p&gt;Implemented for RustRadio (behind the &lt;code class=&quot;highlighter-rouge&quot;&gt;unstable&lt;/code&gt; feature, in case I want to
change the API), and &lt;a href=&quot;https://github.com/ThomasHabets/gr-iqstream&quot;&gt;for GNU Radio&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I added a few IQ streaming taps to &lt;a href=&quot;https://github.com/ThomasHabets/sparslog&quot;&gt;my electricity monitor “sparslog” written
with RustRadio&lt;/a&gt;, and made a couple of blocks to receive the data in
GNU Radio.&lt;/p&gt;

&lt;p&gt;I also added a RustRadio WASM UI for sparslog.&lt;/p&gt;

&lt;h2 id=&quot;results&quot;&gt;Results&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-iq-grc.png&quot;&gt;&lt;img src=&quot;/static/2026-10-iq-grc.png&quot; alt=&quot;GNU Radio graph&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-iq-gr.png&quot;&gt;&lt;img src=&quot;/static/2026-10-iq-gr.png&quot; alt=&quot;GNU Radio graph running&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-iq-rr.png&quot;&gt;&lt;img src=&quot;/static/2026-10-iq-rr.png&quot; alt=&quot;RustRadio browser (WASM) based UI&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;future-work&quot;&gt;Future work&lt;/h2&gt;

&lt;p&gt;I also want to add other controls, such as ability to change frequency, or
change filter parameters. With a gRPC endpoint, this should be easy.&lt;/p&gt;

</description>
        <pubDate>Thu, 08 Oct 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/10/SDR-streaming-IQ-protocol.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/10/SDR-streaming-IQ-protocol.html</guid>
        
        
        <category>radio</category>
        
        <category>programming</category>
        
        <category>gnuradio</category>
        
        <category>rustradio</category>
        
        <category>sdr</category>
        
      </item>
    
      <item>
        <title>UniBalun dipole setup</title>
        <description>&lt;p&gt;Until now, my HF antennas have mostly been off the shelf. I’ve gone out with an
AlexLoop (hmm, alexloop.com seems to be down. I don’t know if that’s
permanent), and the &lt;a href=&quot;https://elecraft.com/products/ax1-antenna&quot;&gt;Elecraft AX1&lt;/a&gt;.
They’ve both been fine, but have some drawbacks. The AX1 is a bit finicky about
getting its radial(s) good enough, and the AlexLoop is a bit tricky to set up
in a temporary but stable way.&lt;/p&gt;

&lt;p&gt;I have not had a good experience with the half wave G5RV, yet, for some reason.&lt;/p&gt;

&lt;p&gt;So since all HF antennas are compromises, why not try an inverted V dipole? I
had the &lt;a href=&quot;https://www.radio-stuff.com/product-page/dg1jan-unibalun&quot;&gt;UniBalun&lt;/a&gt; recommended to me, so I went with that. There are
some minor things to think about, which is what this blog post is about.&lt;/p&gt;

&lt;p&gt;To become an antenna, I also needed &lt;a href=&quot;https://www.sotabeams.co.uk/antenna-wire-lightweight-100m/&quot;&gt;antenna wire&lt;/a&gt;, and a way to put the
middle of the dipole high up, with the antenna wire extending straight
diagonally down. For a 20m (14MHz) antenna, I cut two 5.2m pieces, expecting to
need to either cut or fold them back a bit, for the right resonance.&lt;/p&gt;

&lt;p&gt;On the UniBalun side I could just crimp an M4 ring to attach the antenna wire,
but on the other end of the wire I needed to be more creative. It needed to be
able to attach to paracord, and also be fairly easily adjustable in how much
should fold back. Even if I were to cut it, I’d probably still want it folded
back a bit, to adjust for anything from exact band location to moisture in the
ground.&lt;/p&gt;

&lt;p&gt;I ended up using a butt splice crimp, without crimping it, as a kind of zipper
to create the attachment loop. I then used a ziptie to make sure the fold is
along the main wire as much as possible.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-ant.png&quot;&gt;&lt;img src=&quot;/static/2026-10-ant.png&quot; alt=&quot;The antenna coiled up&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-fold.png&quot;&gt;&lt;img src=&quot;/static/2026-10-fold.png&quot; alt=&quot;The antenna wire fold&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think an improvement here would be to use a second butt splice crimp instead
of the ziptie, and glue the folded tip to it. That way it can move and be
adjustable, and also straight.&lt;/p&gt;

&lt;p&gt;If wind starts moving it, there’s always gaffa tape.&lt;/p&gt;

&lt;p&gt;I had an extendable window washing pole, so that sorted height. I added a
&lt;a href=&quot;https://www.sotabeams.co.uk/guying-collar-22mm-inner-diameter/&quot;&gt;guying collar&lt;/a&gt; to secure it with paracord, though a hitch knot
appeared to be stable enough too, and is more flexible about how high up you
want the guying wire. The guying collar is the same diameter as the pole. Which
means while I got it on, it ain’t never coming off. I probably should have bought
a slightly bigger guying collar, and secured it with a shelf of tape below it.
But it works.&lt;/p&gt;

&lt;p&gt;My bike’s wheel held the base in place.&lt;/p&gt;

&lt;h2 id=&quot;tuning&quot;&gt;Tuning&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://rigexpert.com/antenna-analyzers/aa-650-zoom/&quot;&gt;My antenna analyzer&lt;/a&gt; has
bluetooth. I thought I’d check that out, to prevent me going back and forth too
much. But the Android app is not compatible with the current Android release.
And the Linux app didn’t seem to work either.&lt;/p&gt;

&lt;p&gt;So I told AI to build one:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;I think I have connected to a rigexpert AA-650 Zoom via bluetooth. The mac
address is 04:91:62:xx:xx:xx. Write a crate and TUI for remotely working the
rigexpert. If you need me to do something from a user with more access then
tell me what commands to run. Use the crate ratatui for the TUI, and for
command line parsing use clap with derive.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;After a few more minor user improvement prompts, I ended up with something
&lt;a href=&quot;https://github.com/ThomasHabets/rigexpert&quot;&gt;pretty usable&lt;/a&gt;. Here’s two example sweeps from my testing today:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-tui.png&quot;&gt;&lt;img src=&quot;/static/2026-10-tui.png&quot; alt=&quot;TUI antenna analyzer&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It saves everything from the session, so I can inspect the return loss and
other graphs after the fact, too.&lt;/p&gt;

&lt;p&gt;I’m treating this tool as any official tool I find online; I didn’t look at the
code at all. I would not have spent the time to actually build this manually. I
would have given up and only used the rigexpert directly. Well, I did use it
directly, too.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-SWR.png&quot;&gt;&lt;img src=&quot;/static/2026-10-SWR.png&quot; alt=&quot;Rigexpert photo&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;so-how-did-it-go&quot;&gt;So how did it go?&lt;/h2&gt;

&lt;p&gt;It went well. The UniBalun is rated for 5W in data modes, so that’s what I ran.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-pskreporter.png&quot;&gt;&lt;img src=&quot;/static/2026-10-pskreporter.png&quot; alt=&quot;PSKReporter showing propagation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not bad at all. &lt;a href=&quot;/2023/07/The-unreasonbale-effectiveness-of-radio.html&quot;&gt;Unreasonably effective&lt;/a&gt;, in fact.&lt;/p&gt;

&lt;p&gt;I also dialled in to &lt;a href=&quot;https://github.com/ThomasHabets/abbs&quot;&gt;my BBS&lt;/a&gt; over the &lt;a href=&quot;https://github.com/Rhizomatica/mercury&quot;&gt;mercury HF modem&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;does-it-look-professional-too&quot;&gt;Does it look professional, too?&lt;/h2&gt;

&lt;p&gt;Nope!&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-10-park.png&quot;&gt;&lt;img src=&quot;/static/2026-10-park.png&quot; alt=&quot;Whole setup&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;antenna-components&quot;&gt;Antenna components&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.radio-stuff.com/product-page/dg1jan-unibalun&quot;&gt;UniBalun&lt;/a&gt; — £9&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.sotabeams.co.uk/antenna-wire-lightweight-100m/&quot;&gt;100m lightweight antenna wire&lt;/a&gt; (just over 10m used) — £14&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.sotabeams.co.uk/guying-collar-22mm-inner-diameter/&quot;&gt;Guying collar&lt;/a&gt; — £3&lt;/li&gt;
  &lt;li&gt;Paracord — less than £1 worth used&lt;/li&gt;
  &lt;li&gt;2x M4 crimps&lt;/li&gt;
  &lt;li&gt;2x (or 4x) AWG 16-40 butt splice crimp&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.screwfix.com/p/apollo-galvanised-outdoor-pegs-300mm-5-pack/878kt&quot;&gt;Tent
stakes&lt;/a&gt;
— £13&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;radio-picnic-checklist&quot;&gt;Radio picnic checklist&lt;/h2&gt;

&lt;p&gt;This is my checklist for going out and playing radio. I don’t bring everything,
only what I’ll need on the day. But I do go through the list every time because
it’s easy to forget something.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;USB hub (my Elecraft requires two USB ports to get audio and CAT), and one of
my two USB-A ports has a yubikey nano in it.&lt;/li&gt;
  &lt;li&gt;HF radio&lt;/li&gt;
  &lt;li&gt;HF radio CAT cable&lt;/li&gt;
  &lt;li&gt;Food&lt;/li&gt;
  &lt;li&gt;External battery&lt;/li&gt;
  &lt;li&gt;Baofeng + AIOC (convenient modem)&lt;/li&gt;
  &lt;li&gt;Other HT&lt;/li&gt;
  &lt;li&gt;Laptop&lt;/li&gt;
  &lt;li&gt;Coffee thermos&lt;/li&gt;
  &lt;li&gt;Picnic blanket&lt;/li&gt;
  &lt;li&gt;Water&lt;/li&gt;
  &lt;li&gt;Set home station frequency &amp;amp; power (if dialing in back home)&lt;/li&gt;
  &lt;li&gt;Sunscreen&lt;/li&gt;
  &lt;li&gt;Headphone cable&lt;/li&gt;
  &lt;li&gt;Arrow antenna&lt;/li&gt;
  &lt;li&gt;AX1 antenna&lt;/li&gt;
  &lt;li&gt;AlexLoop&lt;/li&gt;
  &lt;li&gt;Antenna stand (for AX1 or AlexLoop)&lt;/li&gt;
  &lt;li&gt;Dipole&lt;/li&gt;
  &lt;li&gt;Dipole pole&lt;/li&gt;
  &lt;li&gt;Paracord&lt;/li&gt;
  &lt;li&gt;BNC cable&lt;/li&gt;
  &lt;li&gt;Camping stakes&lt;/li&gt;
  &lt;li&gt;Gaffa tape&lt;/li&gt;
  &lt;li&gt;Zipties&lt;/li&gt;
  &lt;li&gt;Alcogel&lt;/li&gt;
  &lt;li&gt;Paper towels&lt;/li&gt;
  &lt;li&gt;RigExpert&lt;/li&gt;
  &lt;li&gt;Scissors&lt;/li&gt;
  &lt;li&gt;Lighter (for sealing paracord after cutting)&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Tue, 06 Oct 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/10/Unibalun-dipole-setup.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/10/Unibalun-dipole-setup.html</guid>
        
        
        <category>radio</category>
        
      </item>
    
      <item>
        <title>QO-100 GPS locked</title>
        <description>&lt;p&gt;&lt;a href=&quot;https://blog.habets.se/2025/06/QO100-early-success.html&quot;&gt;Previously&lt;/a&gt; I successfully did some receiving and some transmitting over
the amateur radio transponder on the satellite QO-100. That is to say, my FT8
was heard by others (but not me, due to my small dish), and I successfully
decoded FT8 from some others.&lt;/p&gt;

&lt;p&gt;There are three problems with my QO-100 ground station:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;It’s not permanent. It’d need some weather sealing, both for the dish and
other active equipment near it.&lt;/li&gt;
  &lt;li&gt;The dish is too small. It works well enough to prove that the satellite is
there and everything else works, but a permanent install should have a
bigger dish.&lt;/li&gt;
  &lt;li&gt;The frequency stability was not good enough for decoding everything. In
&lt;a href=&quot;https://blog.habets.se/static/2025-06-qo100-ft8-skew.png&quot;&gt;this screenshot&lt;/a&gt; we can see all signals skewing the same way,
which means it’s my receiver that’s skewing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I really appreciate the constant FT8 activity when tuning my station. Sure, I
could look at the band edge beacons, but I like this too. And strangely, I can
not actually find the edge beacons.&lt;/p&gt;

&lt;p&gt;Today is about the third issue: Frequency stability. Because the B200 was GPS
locked last time, the main suspect was the LNB. The &lt;a href=&quot;https://www.passion-radio.com/lnb-pll/lnb-othernet-978.html&quot;&gt;Othernet Bullseye LNB TCXO
from Passion-Radio.com&lt;/a&gt; is a fine LNB, but it’s not GPS locked.&lt;/p&gt;

&lt;p&gt;After blaming weather (either too hot and sunny, or raining), I finally took
the time to test the &lt;a href=&quot;https://dxpatrol.pt/produto/dx-patrol-lnb/&quot;&gt;replacement LNB from DXPatrol&lt;/a&gt;. It requires an
external LO at 25MHz, so for that I use the &lt;a href=&quot;https://dxpatrol.pt/produto/dxpatrol-gpsdo-v3/&quot;&gt;DXPatrol GPSDO V3&lt;/a&gt;. I’ve
&lt;a href=&quot;/2025/06/Setting-clock-source-with-GNU-Radio.html&quot;&gt;previously used it to frequency lock my ICOM IC-9700&lt;/a&gt;, though set to
10MHz as that’s what that radio wants.&lt;/p&gt;

&lt;p&gt;The uplink signal was already generated by the GPS locked B200 at 2.4GHz, so
though it went through amplification, I’m pretty sure its frequency is perfect,
so today was a receive only test.&lt;/p&gt;

&lt;h2 id=&quot;todays-experiment&quot;&gt;Today’s experiment&lt;/h2&gt;

&lt;p&gt;First I connected the known setup with the old LNB, to confirm that I’m
pointing towards the satellite. LNB - Bias-Tee (from 13.6V battery) - B200. I
started my old flowgraph and immediately heard FT8. Hooray!&lt;/p&gt;

&lt;p&gt;FT8 is supposed to be at 40kHz into the NB (narrowband) section, which &lt;a href=&quot;https://amsat-dl.org/en/new-qo-100-band-plan/&quot;&gt;starts
at 10.4895GHz&lt;/a&gt;. I heard FT8 at 58kHz, just like last time, meaning 18kHz
“wrong”. That’s &lt;code class=&quot;highlighter-rouge&quot;&gt;1e6*18e3/10.4895e9=1.7&lt;/code&gt; ppm, which is within the advertised 2
ppm.&lt;/p&gt;

&lt;p&gt;I replaced the LNB with the DXPatrol one, having carefully marked which cable
is signal and which is LO. I configured the GPSDO to output 25MHz and connected
it to the LO port.&lt;/p&gt;

&lt;p&gt;After tweaking my GNU Radio flowgraph, specifically enabling averaging on the
waterfall, and sliding the min/max thresholds, I visually found what appeared
to be the strongest signal, with pauses and a repeating pattern every 15
seconds. A dead giveaway for FT8 or possibly JS8.&lt;/p&gt;

&lt;p&gt;I found it at offset 354kHz. That’s… odd. That’s 30 ppm off frequency. But my
main goal here is not frequency accuracy, but frequency stability. I can
compensate more easily for an offset.&lt;/p&gt;

&lt;p&gt;So I take some recordings, both with the GPS-locked B200 and with a LimeSDR
mini. They both have the signal at 354kHz. Not very surprising that LimeSDR
mini is about as good as a B200. At least within a kHz. I would expect the LNB
part to be the source of the inaccuracy, since a small percentage error will
become a larger frequency offset before downconversion.&lt;/p&gt;

&lt;p&gt;But after I was done outdoors for the day, and looked closer at the recordings,
I noticed that there is clearly also a signal at the expected 40kHz. It’s
weaker, but it’s there. So am I bang on frequency? What does that say about the
stronger FT8 signal at 354kHz? It’s not a nice round number of any frequency
I’m aware of. Is it introduced inside the LNB? Inside the SDR? Digitally from
my GNU Radio flowgraph?&lt;/p&gt;

&lt;p&gt;I have a recording saved to file after only doing frequency translated filter
with a 2x decimation, and I can see the 354kHz FT8 on a waterfall directly from
that. So unlikely to be anything in my demodulation.&lt;/p&gt;

&lt;p&gt;354kHz is part of the “broadcast” section of the band plan. RSGB says they
&lt;a href=&quot;https://rsgb.services/public/gb2rs/gb2rs_broadcast_schedule.pdf&quot;&gt;broadcast on Sundays&lt;/a&gt;, but not until 14:00, and this was before
that.&lt;/p&gt;

&lt;p&gt;Checking &lt;a href=&quot;https://eshail.batc.org.uk/nb/&quot;&gt;a websdr&lt;/a&gt; it does not seem like
354kHz has any FT8. At least now, an hour or so after my recording.&lt;/p&gt;

&lt;h2 id=&quot;possible-sources-of-the-ft8&quot;&gt;Possible sources of the FT8&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Maybe there really was FT8 there at the time. Unlikely since it’s in the
wrong part of the band. If they decode, I can see if 40kHz and 354kHz decode
to the same thing, in which case it’s a ghost copy.&lt;/li&gt;
  &lt;li&gt;An artefact inside the LNB? Maybe.&lt;/li&gt;
  &lt;li&gt;The LNB not being happy with the cleanliness of the GPSDO signal? Maybe.&lt;/li&gt;
  &lt;li&gt;Unrelated ground based contacts? Very unlikely, as the dish is directional,
and the signal goes away if I rotate the LNB to the wrong polarity.&lt;/li&gt;
  &lt;li&gt;Another satellite? No. It’d be on a different frequency, and there is no
other geostationary amateur radio satellite.&lt;/li&gt;
  &lt;li&gt;Artefact inside the Bias-Tee? Seems unlikely, since it’s an RF passive
component. But who knows what could happen at these frequencies.&lt;/li&gt;
  &lt;li&gt;Artefact inside the B200? Unlikely, as the LimeSDR recording shows the same
exact thing.&lt;/li&gt;
  &lt;li&gt;Artefact from QO-100 itself? Unlikely. I don’t see it on the websdr.&lt;/li&gt;
  &lt;li&gt;Dopplered bounce on something? No, it wouldn’t stay there.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;so-do-they-decode&quot;&gt;So do they decode?&lt;/h2&gt;

&lt;p&gt;I started a pipewire loopback, fed it from a GNU Radio flowgraph, and tried to
decode.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pw-loopback -m '[ FL FR ]' --capture-props='media.class=Audio/Sink node.name=ft8_sink'
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Yes, some decode on 354kHz. Germany, Tajikistan, Poland, etc. So definitely not
local. I still see the slant on some signals, so &lt;em&gt;something&lt;/em&gt; is short term
clock drifting. They decode when demodulated as USB, as one would expect.&lt;/p&gt;

&lt;p&gt;Some decode on 40kHz too, where we expect the signal to be. Fewer, and not a
strict superset. But as it’s unlikely several operators would be on two
frequencies, I think this proves that it’s the same signal.&lt;/p&gt;

&lt;p&gt;But I expected more decodes, now that I’m fully GPS locked, and with FT8 at
least showing up &lt;em&gt;exactly&lt;/em&gt; on the expected frequency, it does seem in some
sense “better” than my previous setup.&lt;/p&gt;

&lt;p&gt;So this should leave me with these potential sources of the ghost:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;LNB artefact due to LNB itself.&lt;/li&gt;
  &lt;li&gt;LNB artefact due to GPSDO ref signal.&lt;/li&gt;
  &lt;li&gt;Something funky with my very simple flowgraph of only an FFT filter.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- name: freq_xlating_fft_filter_ccc_0_1
  id: freq_xlating_fft_filter_ccc
  parameters:
    affinity: ''
    alias: ''
    center_freq: ofs       # &amp;lt;-- 100k
    comment: ''
    decim: '2'
    maxoutbuf: '0'
    minoutbuf: '0'
    nthreads: '4'
    samp_delay: '0'
    samp_rate: samp_rate    # &amp;lt;-- 4M
    taps: firdes.low_pass(1,samp_rate,450000,10000)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;That’s the only thing between my UHD Source (or Soapy LimeSDR Source) and the
File Sink.&lt;/p&gt;

&lt;h2 id=&quot;i-aint-afraid-of-no-ghosts&quot;&gt;I ain’t afraid of no ghosts&lt;/h2&gt;

&lt;p&gt;But the ghosts were not the problem I was trying to solve. I wanted un-slanted
FT8. That’s what I think was missing for decodes to work.&lt;/p&gt;

&lt;p&gt;But it still kinda looks slanted. Hard to tell in the weaker 40kHz signal, but
what else could it be? The signals are clear to my ears and visibly on the
spectrum they’re clearly there. My experience with FT8 is that if you can hear
it, then it can &lt;em&gt;definitely&lt;/em&gt; decode it (unless signals overlap). But I see very
few decodes.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-09-ft8-skew.png&quot;&gt;&lt;img src=&quot;/static/2026-09-ft8-skew.png&quot; alt=&quot;Skew at 40kHz&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More visible with the ghost at 354kHz:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-09-ft8-skew-354.png&quot;&gt;&lt;img src=&quot;/static/2026-09-ft8-skew-354.png&quot; alt=&quot;Skew at 354kHz&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My theory is still that the skew is preventing the decodes. Which means that
sadly, changing to a GPS locked LNB did not fix my main problem.&lt;/p&gt;

&lt;h2 id=&quot;future-troubleshooting-steps&quot;&gt;Future troubleshooting steps&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Use various attenuators for the LNB LO signal.&lt;/li&gt;
  &lt;li&gt;Look closer at the recordings.&lt;/li&gt;
  &lt;li&gt;Loop the recordings into wsjtx for decode.&lt;/li&gt;
  &lt;li&gt;Inspect the cleanliness of the GPSDO 25MHz ref signal.&lt;/li&gt;
  &lt;li&gt;Use B200 LO offset instead of manual frequency translation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;a-digital-solution&quot;&gt;A digital solution?&lt;/h2&gt;

&lt;p&gt;A better fix may be to use the satellite’s CW or PSK beacons to frequency lock
in the digital domain. Then the analog frequency imperfection may not matter.
Won’t help with the ghosting, of course.&lt;/p&gt;

&lt;p&gt;Yes, that’d be great. But I don’t see or hear the beacons. The main reason for
this is the size of the dish. I always knew that the dish size was a problem,
but it was a proof of concept. And it was successful. So yeah, maybe it’s time
to buy a larger dish, and figure out an acceptable mounting solution.&lt;/p&gt;

&lt;h2 id=&quot;random-notes&quot;&gt;Random notes&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Use wireless headphones. There will be enough cables and going back and forth
that you do not want to stumble over another cable.&lt;/li&gt;
  &lt;li&gt;The GPS antenna for the B200 needs to be attached with its magnet to a metal
ground plane, or it won’t get a lock. The DXPatrol GPSDO doesn’t need that.&lt;/li&gt;
  &lt;li&gt;The B200 manual says it needs external power, to use GPS reference. It’s
demonstrably worked fine in the past, but could this be a factor?&lt;/li&gt;
  &lt;li&gt;Both LNBs create a 9.75GHz frequency downconversion, thus starting the NB
downlink at 739.5MHz.&lt;/li&gt;
  &lt;li&gt;A calculator for the LNB angle says I should have about 19-20 degrees
rotation, but 10-15 degrees gave a better signal.&lt;/li&gt;
  &lt;li&gt;The new LNB, while seemingly spot on on frequency, delivered a weaker signal.
Perhaps it just needs a bit of jiggling to fit better in the dish?&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Sun, 27 Sep 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/09/QO-100-GPS-locked.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/09/QO-100-GPS-locked.html</guid>
        
        
        <category>radio</category>
        
      </item>
    
      <item>
        <title>The magic of OFDM</title>
        <description>&lt;p&gt;I’ve been playing a bit with &lt;a href=&quot;https://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing&quot;&gt;OFDM&lt;/a&gt; in &lt;a href=&quot;https://en.wikipedia.org/wiki/Software-defined_radio&quot;&gt;software defined radio&lt;/a&gt;
lately. And after watching &lt;a href=&quot;https://youtu.be/M6rwIhG9ZMY&quot;&gt;a video that wasn’t even &lt;em&gt;close&lt;/em&gt; to
correct&lt;/a&gt;, I thought I’d write down my understanding in a blog post. I
wouldn’t call myself an expert, so worst case someone will correct me, and I’m
happy to be corrected.&lt;/p&gt;

&lt;p&gt;In my experiments with OFDM my initial goal is understanding, so e.g. I won’t
blindly use some hierarchical GNU Radio block.&lt;/p&gt;

&lt;h2 id=&quot;iq-and-the-actual-analog-signal&quot;&gt;I/Q and the actual analog signal&lt;/h2&gt;

&lt;p&gt;I think that in order to internalize OFDM, we first need to remind ourselves
how a purely “real” wave becomes a complex number, at a high level.&lt;/p&gt;

&lt;p&gt;The real signal is a value that’s a function of time. Glossing over details,
this is not feasible for most of our signals, as we would need to provide a new
value to the transmitter at a rate twice as high as the highest frequency we
care about. For 2.4GHz experiments, we’d need 4.8 billion samples per second.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/In-phase_and_quadrature_components&quot;&gt;Quadrature&lt;/a&gt; sampling allows us to represent a slice of bandwidth at a
manageable rate. We can then provide the I/Q data to hardware, instructing it to
hold that “until further notice”. If we provide one sample per second, for
example, we can change the phase or amplitude of a pure sine wave (the carrier)
once a second. Between our samples, it continues as-is in that phase and
amplitude.&lt;/p&gt;

&lt;p&gt;“As-is” is here left deliberately vague. I only phrase it this way because it’s
a helpful analogy further down.&lt;/p&gt;

&lt;h2 id=&quot;qpsk&quot;&gt;QPSK&lt;/h2&gt;

&lt;p&gt;Now some background on &lt;a href=&quot;https://en.wikipedia.org/wiki/Phase-shift_keying#Quadrature_phase-shift_keying_(QPSK)&quot;&gt;QPSK&lt;/a&gt;, since that’s the encoding in the
subcarriers in my OFDM experiments. This should apply equally to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quadrature_amplitude_modulation&quot;&gt;QAM&lt;/a&gt;, QAM
being a generalization that allows more bits per symbol.&lt;/p&gt;

&lt;p&gt;At first glance QPSK seems simple. Symbols become &lt;code class=&quot;highlighter-rouge&quot;&gt;+-sqrt(2)/2 +- j*sqrt(2)/2&lt;/code&gt;.
But you can’t really transmit that kind of instant transition without infinite
bandwidth. An individual symbol instead gets turned into a “pulse” towards its
coordinate. A pulse will spread out, but the pulse shape is designed such that
it should have minimal effect where it matters; at the peak of neighboring
pulses (symbols).&lt;/p&gt;

&lt;p&gt;So if the receiver samples at exactly the right point, it’ll get a perfect
symbol with no inter-symbol interference. Of course that’s only strictly true
in theory (because of multipath and various nonlinearities). But minimizing the
symbol interference helps.&lt;/p&gt;

&lt;p&gt;Turning symbols into pulses is called &lt;a href=&quot;https://pysdr.org/content/pulse_shaping&quot;&gt;pulse shaping&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;GNU Radio has &lt;a href=&quot;https://wiki.gnuradio.org/index.php?title=QPSK_Mod_and_Demod&quot;&gt;a nice guide to QPSK&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;ofdm&quot;&gt;OFDM&lt;/h2&gt;

&lt;p&gt;The explanation of OFDM still makes me feel like it shouldn’t work. It’s too
weird of a tool to use. It feels like cheating.&lt;/p&gt;

&lt;p&gt;The idea is that instead of having one high symbol rate with as many
constellation points (and therefore bits per symbol) as you can, you instead
split your data into multiple slower carriers of narrower bandwidth.&lt;/p&gt;

&lt;p&gt;How would you generate all these smaller slower signals? Well, you could create
many virtual transmitters and add them up into one spectrum. That’s one way to
turn many constellation diagrams (series of complex numbers) into one signal.
Then on the receiver side you’d do one band pass filter and translation to
baseband per carrier.&lt;/p&gt;

&lt;p&gt;You know what else takes a complex time domain signal and gives you a set of
discrete complex numbers, one per frequency? An FFT.&lt;/p&gt;

&lt;p&gt;So you just stuff QPSK symbols into (e.g.) 64 FFT bins, and do an inverse FFT?
Well, almost (see below). But the fact that the answer is “yes almost!” is
what’s magic. This is the thing that blew my mind.&lt;/p&gt;

&lt;p&gt;A receiver can then just do a 64 bin FFT, and there you have the I and Q for
your 64 subcarriers.&lt;/p&gt;

&lt;p&gt;This means that both transmitter and receiver will process the incoming I/Q in
chunks. Chunks that are the size of the FFT.&lt;/p&gt;

&lt;p&gt;As a tangent, FFTs can do other magic things too, like &lt;a href=&quot;https://youtu.be/rQkBDMeODHc&quot;&gt;this amazing talk on
whole packet clock recovery&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;what-is-an-ofdm-symbol&quot;&gt;What is an OFDM symbol?&lt;/h3&gt;

&lt;p&gt;Ok, so “OFDM symbol” doesn’t make so much sense. I mean the collection of
symbols being sent at any given point in time across all subcarriers.&lt;/p&gt;

&lt;p&gt;An OFDM “aggregate symbol” is several input symbols, distributed into the FFT
bins / subcarriers.&lt;/p&gt;

&lt;p&gt;Transmitting turns these sets of symbols into&lt;/p&gt;

&lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ofdm_symbol&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;symbols_to_transmit&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.chunks_exact&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sample&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;inverse_fft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ofdm_symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;enqueue_transmit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sample&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;I found it useful to think of OFDM in the time domain within a single “FFT
chunk”. The original I/Q samples had a start time and an end time. Between the
start time and the end time, the true analog signal was a mix of (for example)
64 fixed tones. The individual tones had a particular individual phase and
amplitude.&lt;/p&gt;

&lt;p&gt;Here’s an example of a four-subcarrier OFDM, for three symbol periods:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-09-ofdm.png&quot;&gt;&lt;img src=&quot;/static/2026-09-ofdm.png&quot; alt=&quot;Four subcarrier OFDM&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is where the “hold this until further notice” analogy is relevant. For
a given subcarrier, the frequency is (by definition) fixed. It
doesn’t matter how many cycles a given subcarrier goes through. It just matters
for a given subcarrier, what amplitude and phase it was. Subcarrier 1 has one,
subcarrier 4 potentially has another.&lt;/p&gt;

&lt;p&gt;And yes, this is the same thing as having four independent transmitters. But
because the “transmitters” are just the output of an inverse FFT, they are
exactly synchronized. We generated these four transmitters by cheating!&lt;/p&gt;

&lt;h3 id=&quot;what-about-pulse-shaping&quot;&gt;What about pulse shaping?&lt;/h3&gt;

&lt;p&gt;Taking the illustration above literally, we should not transmit that exactly.
The phase and amplitude transitions are too sharp.&lt;/p&gt;

&lt;p&gt;An input symbol is only part of one FFT, and for the next FFT period we have
another input symbol for that FFT bin.&lt;/p&gt;

&lt;p&gt;So how should we soften that up? Should we pulse shape the subcarrier QPSK
before it goes into the inverse FFT? No, because then that means each symbol
takes multiple FFT chunks, slowing down the transmission.&lt;/p&gt;

&lt;p&gt;Do we pulse shape the whole FFT chunk? Yes, kind of. Fixing this involves
windowed OFDM/WOLA, smoothing out the FFT period transitions, and I’ve not
looked into it yet. Currently my testing just uses rectangular window FFTs.&lt;/p&gt;

&lt;h3 id=&quot;multipath&quot;&gt;Multipath&lt;/h3&gt;

&lt;p&gt;OFDM is good in the presence of multipath for two reasons:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The symbols are slow, and the speed of light is fast. The slower a symbol is
sent, the less the chance a bounced signal from a different symbol has to
interfere.&lt;/li&gt;
  &lt;li&gt;OFDM also encourages adding a “Cyclic Prefix”. Basically extending the
transmitted “OFDM chunk” and discarding the initial part, under the assumption
that it could be polluted with multipath echoes of the previous symbols.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Cyclic Prefix adds another benefit for receivers I’ve not yet internalized.&lt;/p&gt;

&lt;h3 id=&quot;frequency-locking&quot;&gt;Frequency locking&lt;/h3&gt;

&lt;p&gt;Whereas QPSK needs to lock on based on peaks in the signal followed by carrier
recovery, and can therefore easily lock in on small frequency differences
between transmitter and receiver, OFDM doesn’t have the same luxury.&lt;/p&gt;

&lt;p&gt;The pulses are inside the subcarriers, and you can’t extract the subcarriers
until you have the frequency.&lt;/p&gt;

&lt;p&gt;This is usually solved by sacrificing some subcarriers to pilot signals. In my
testing I made the center bin a pure sine wave, and used a feedback loop to
perform a primitive frequency lock based on quadrature demod.&lt;/p&gt;

&lt;p&gt;Using the center bin for Pilot has a potential benefit that some SDRs will
sometimes fail to be quiet there, because that’s their location of the local
oscillator.&lt;/p&gt;

&lt;p&gt;Any residual frequency error will result in cross-subcarrier interference, and
frequency offset (quadrature rotation) inside the subcarrier.&lt;/p&gt;

&lt;p&gt;You can also use a Jacobsen CFO estimator to estimate the frequency error from
the pilot signal FFT bin. My GNU Radio flowgraph uses that only for diagnostic,
not for tuning feedback.&lt;/p&gt;

&lt;p&gt;On the plus side, because the subcarrier is merely the values of the FFT, if
the outer carrier is synchronized, then the inner is too, and you can just
pluck the QPSK symbols directly after Symbol Sync, without a Costas loop or
other subcarrier frequency lock. Well, it’ll likely need to correct for minor
phase errors. In any case the Costas loop sure has an easier job, that it can
do with a smaller bandwidth.&lt;/p&gt;

&lt;p&gt;In my example graph, the default frequency locking is coarse, trading stability
for speed of convergence, and the clocked symbols (under “Clocked”) shows this
instability as a subcarrier frequency offset, correctable with a Costas loop.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-09-ofdm-coarse.webp&quot;&gt;&lt;img src=&quot;/static/2026-09-ofdm-coarse.webp&quot; alt=&quot;Coarse frequency lock&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If I change the &lt;code class=&quot;highlighter-rouge&quot;&gt;coarse_lock_alpha&lt;/code&gt; to a lower value, it becomes stable:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-09-ofdm-fine.webp&quot;&gt;&lt;img src=&quot;/static/2026-09-ofdm-fine.webp&quot; alt=&quot;Fine frequency lock&quot; /&gt;&lt;/a&gt;
(yes, that’s an animation. It’s just very frequency locked)&lt;/p&gt;

&lt;p&gt;In a better implementation, frequency locking should probably switch
to fine locking automatically when the signal is found.&lt;/p&gt;

&lt;h3 id=&quot;timing-synchronization&quot;&gt;Timing synchronization&lt;/h3&gt;

&lt;p&gt;While my GNU Radio experiment does add the Cyclic Prefix, and removes it, it
does not yet actually attempt any timing synchronization. This means that the
start and end of an “FFT chunk” can be wrong. I think this is a likely main
cause of why it’s very sensitive to other subcarriers being assigned random
phase noise:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-09-ofdm-noise.webp&quot;&gt;&lt;img src=&quot;/static/2026-09-ofdm-noise.webp&quot; alt=&quot;Noisy subcarrier&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think this timing synchronization may be best done by having the pilot signal
do… something. Maybe the (or one of) the pilot signal should be BPSK triggered
by FFT chunk transition?&lt;/p&gt;

&lt;p&gt;My helping LLM calls that a “poor substitute for a synchronization preamble or
CP correlation”, so then again maybe not.&lt;/p&gt;

&lt;h3 id=&quot;ofdm-on-the-spectrum&quot;&gt;OFDM on the spectrum&lt;/h3&gt;

&lt;p&gt;This is how my OFDM test looks over the (virtual) air. A pilot in the middle,
silent bins around it, a slow (each symbol repeats 10 times) signal in FFT bin
/ subcarrier 5, and the rest of the carriers full of noise.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/static/2026-09-ofdm-air.png&quot;&gt;&lt;img src=&quot;/static/2026-09-ofdm-air.png&quot; alt=&quot;Waterfall spectrum of OFDM&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;my-test-flowgraph&quot;&gt;My test flowgraph&lt;/h2&gt;

&lt;p&gt;This blog post was written when &lt;a href=&quot;https://github.com/ThomasHabets/mygr-ofdm&quot;&gt;the github repo with my flowgraph&lt;/a&gt; was
at commit 1e8fbd79d465cf94f6407f4677375ac088158619.&lt;/p&gt;

</description>
        <pubDate>Sun, 20 Sep 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/09/The-magic-of-OFDM.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/09/The-magic-of-OFDM.html</guid>
        
        
        <category>sdr</category>
        
        <category>radio</category>
        
      </item>
    
      <item>
        <title>Sway screen recording</title>
        <description>&lt;p&gt;Step by step for doing a screen recording on Sway.&lt;/p&gt;

&lt;p&gt;I want to capture exact 16x9 dimensions, and exactly the the right content. I
do it pretty rarely, but yeah this should be automated.&lt;/p&gt;

&lt;h2 id=&quot;get-the-window-id&quot;&gt;1. Get the window ID&lt;/h2&gt;

&lt;p&gt;Run this command, and move the pointer to the window you want to record.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sleep 2;swaymsg -t get_tree | jq '.. | objects | select(.focused? == true) | {app_id, id, name, window_properties}'
{
  &quot;app_id&quot;: &quot;brave-browser&quot;,
  &quot;id&quot;: 802,
  &quot;name&quot;: &quot;WebUSB RF Survey - Brave&quot;,
  &quot;window_properties&quot;: null
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;make-the-window-floating-in-a-known-place&quot;&gt;2. Make the window floating in a known place&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;swaymsg '[con_id=802] floating enable,move position 200 px 256 px, resize set width 1600 px height 901 px'
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;(yes, 901. This may be because of my 1.3 scaling on that monitor, giving an off
by one pixel due to rounding)&lt;/p&gt;

&lt;h2 id=&quot;get-the-rect-coordinates-post-move&quot;&gt;3. Get the rect coordinates post move&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sleep 2;swaymsg -t get_tree | jq '.. | objects | select(.focused? == true) | .rect'
{
  &quot;x&quot;: 2120,
  &quot;y&quot;: 256,
  &quot;width&quot;: 1600,
  &quot;height&quot;: 900
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;start-recording&quot;&gt;4. Start recording&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wf-recorder -g '2120,257 1600x900' -f output.mp4
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;(yes, 257. Add one. Probably same reason)&lt;/p&gt;

&lt;h2 id=&quot;get-coordinates-of-areas-you-want-to-black-out&quot;&gt;5. Get coordinates of areas you want to black out&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ slurp
2163,333 1514x37
$ slurp
3236,299 450x35
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;black-out-those-areas&quot;&gt;6. Black out those areas&lt;/h2&gt;

&lt;p&gt;Subtract the screen coordinates (2120,256 in this case), multiply by any
scaling (1.3 in this case) and run:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ffmpeg \
        -i output.mp4 \
        -vf &quot;drawbox=x=43:y=98:w=1541:h=37:color=black:t=fill,drawbox=x=1451:y=56:w=450:h=35:color=black:t=fill&quot; \
        -c:v libx264 -crf 16 -preset slow \
        -c:a copy final.mp4 
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</description>
        <pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/09/Sway-screen-recording.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/09/Sway-screen-recording.html</guid>
        
        
        <category>sway</category>
        
      </item>
    
      <item>
        <title>RF survey in the browser</title>
        <description>&lt;p&gt;As &lt;a href=&quot;https://blog.habets.se/2026/08/Broadband-RF-scanner-revisited.html&quot;&gt;I mentioned in a previous
post&lt;/a&gt; I
wanted to make a WASM version of the RF scanner / RF survey tool, so that it
can be run without any drivers or tools installed on the local machine.&lt;/p&gt;

&lt;p&gt;Well, now I have. It’s available at &lt;a href=&quot;https://rf-survey.habets.se/&quot;&gt;https://rf-survey.habets.se/&lt;/a&gt; as a GitHub
page, automatically deploying from &lt;a href=&quot;https://github.com/ThomasHabets/rf-survey-wasm&quot;&gt;the github
repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you don’t have a compatible SDR, then you can at least enjoy the video here.&lt;/p&gt;

&lt;iframe width=&quot;800&quot; height=&quot;450&quot; src=&quot;https://www.youtube.com/embed/Im7Gvu6mHsk&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
</description>
        <pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate>
        <link>https://blog.habets.se/2026/09/RF-survey-in-the-browser.html</link>
        <guid isPermaLink="true">https://blog.habets.se/2026/09/RF-survey-in-the-browser.html</guid>
        
        
        <category>wasm</category>
        
        <category>sdr</category>
        
        <category>radio</category>
        
        <category>programming</category>
        
        <category>wifi</category>
        
      </item>
    
  </channel>
</rss>
