<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Goran Mekić</title>
    <link>https://meka.rs/</link>
    <description>Recent content on Goran Mekić</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 15 Jul 2025 00:35:00 +0000</lastBuildDate>
    <atom:link href="https://meka.rs/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Neural and Impulse Blending</title>
      <link>https://meka.rs/blog/2025/07/15/neural-and-impulse-blending/</link>
      <pubDate>Tue, 15 Jul 2025 00:35:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2025/07/15/neural-and-impulse-blending/</guid>
      <description>&lt;p&gt;The idea of blending is to make two amplifiers and mix them into a single sound. The reason people&#xA;do that is because different amplifiers have slightly different sound which combined together sounds&#xA;better than any single one of them. It&amp;rsquo;s the same like having a single voice vs choir. With sounds&#xA;it is simple: you just mix them. With neural amp modeler, there are few more steps. First you have&#xA;to &lt;a href=&#34;https://meka.rs/blog/2025/04/15/neural-amp-modeling/&#34;&gt;capture the sweep&lt;/a&gt;. Then you have to mix the captures&#xA;into a single track. To do it properly, you need to normalize the captures and lower the track&amp;rsquo;s&#xA;volume to -5dB, because when two tracks combine the resulting volume will be bigger. If you mix more&#xA;than two tracks, you have to lower their volumes even more. Once you mix the captures into a single&#xA;clip, normalize it. After that all you have to do is create NAM profile out of that clip.&lt;/p&gt;&#xA;&lt;p&gt;Mixing impulse responses is even easier. You &lt;a href=&#34;https://meka.rs/blog/2025/05/11/impulse-response/&#34;&gt;create the impulses&lt;/a&gt;,&#xA;mix them into a single clip and that&amp;rsquo;s it. You have to watch out for the volume, that it doesn&amp;rsquo;t&#xA;clip and normalize it in the end. Enjoy your sound!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Impulse Response Sweep</title>
      <link>https://meka.rs/blog/2025/05/12/impulse-response-sweep/</link>
      <pubDate>Mon, 12 May 2025 08:55:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2025/05/12/impulse-response-sweep/</guid>
      <description>&lt;p&gt;There is another way to capture IR, and it is using sweep frequency sound. That&#xA;means that the file containing the sweep will have 20Hz to 20kHz frequencies,&#xA;starting with low and increasing the frequency. The idea is to capture how the&#xA;system, in this case power amp, guitar cabinet and microphone, respond to&#xA;different frequencies and create IR based on that. For that purpose you can use&#xA;Carla and LSP Profiler. I like to use mono version, but the stereo version is&#xA;available if you need it. You need to start Carla and add LSP Profiler as a&#xA;plugin. In patch bay of Carla connect it like the following picture.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://meka.rs/images/carla.webp&#34; alt=&#34;Carla&#34;&gt;&lt;/img&gt;&lt;/p&gt;&#xA;&lt;p&gt;In program like QJackCTL connect Carla&amp;rsquo;s IO to the hardware IO. As for the&#xA;hardware setup and connections, consult the&#xA;&lt;a href=&#34;https://meka.rs/blog/2025/05/11/impulse-response/&#34;&gt;previous post about impulse resposes&lt;/a&gt;.&#xA;First we need to calibrate the LSP Profiler. That means setting the right sound&#xA;levels and latency.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://meka.rs/images/profiler.webp&#34; alt=&#34;LSP Profiler&#34;&gt;&lt;/img&gt;&lt;/p&gt;&#xA;&lt;p&gt;Turn the volume down on your power amp before you enable &lt;code&gt;Calibrator&lt;/code&gt;, as it&#xA;sends loud signal, then enable it and turn the volume gradually up until you&#xA;get around -3dB. When satisfied with the levels, disable it. Click &lt;code&gt;Measure&lt;/code&gt;&#xA;in the &lt;code&gt;Latency Detector&lt;/code&gt;. It will send pulses of sound to figure out what is&#xA;the round trip time for the sound. In the &lt;code&gt;Test Signal&lt;/code&gt;, increase &lt;code&gt;Coarse Tuning&lt;/code&gt; to be as long as possible. When all is set, press &lt;code&gt;Profile&lt;/code&gt; button.&#xA;It will start with a pulse, then few seconds of silence, then sweep sound&#xA;through 20-20000Hz range. Once the LSP Profiler captures the sound from the&#xA;microphone, it will need up to few seconds to make an actual IR profile. When&#xA;that&amp;rsquo;s done, press &lt;code&gt;Save&lt;/code&gt; and create your .wav file.&lt;/p&gt;&#xA;&lt;p&gt;I have to note that quality of such IRs is lower than those I did with Dirac&#xA;pulse. As I am still new to this I assume I&amp;rsquo;m not tuning something right as&#xA;these two techniques should produce the same result.&lt;/p&gt;&#xA;&lt;h3 id=&#34;related-posts&#34;&gt;Related posts&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://meka.rs/blog/2025/05/11/impulse-response/&#34;&gt;Impulse Response&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://meka.rs/blog/2025/04/15/neural-amp-modeling/&#34;&gt;Neural Amp Modeling&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Impulse Response</title>
      <link>https://meka.rs/blog/2025/05/11/impulse-response/</link>
      <pubDate>Sun, 11 May 2025 10:56:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2025/05/11/impulse-response/</guid>
      <description>&lt;p&gt;&lt;strong&gt;DANGER!!! THE FOLLOWING PROCEDURE MIGHT CAUSE DAMAGE TO YOUR EQUIPMENT!!!&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have power amp that has limiter, short circuit protection and overheating&#xA;protection, so I know my gear can handle the procedure, but please don&amp;rsquo;t assume&#xA;that every combination of amp/cab is safe to be used! For example, I have no&#xA;idea how tube amps react to this procedure and you might burn the tubes. Please&#xA;be safe, first!&lt;/p&gt;&#xA;&lt;p&gt;There is also a procedure using sweep frequencies, but I&amp;rsquo;ll describe that in&#xA;another post. That procedure should be safe for any equipment.&lt;/p&gt;&#xA;&lt;h2 id=&#34;dirac-pulse&#34;&gt;Dirac Pulse&lt;/h2&gt;&#xA;&lt;p&gt;Impulse response is used to emulate acoustic characteristic of the system. In&#xA;other words, it can emulate the sound of a guitar cabinet. It can also capture&#xA;reverb of a place, like hallway or church, but I&amp;rsquo;ll just stick to guitar&#xA;cabinet emulation in this post. The core of this technology is in the title as&#xA;we will record how system, in our case power amp, cabinet and microphone,&#xA;responds when we feed it just a single impulse. That pulse is also called&#xA;&amp;ldquo;Dirac pulse&amp;rdquo;. In the wav file, it would be single sample with full amplitude&#xA;and all samples before and after it are zero. It is said that such pulse&#xA;contains all frequencies with equal amplitude, but the math behind it deserves&#xA;a post on its own. Let&amp;rsquo;s first generate such .wav file in audacity. First we&#xA;need a track to work on.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Tracks -&amp;gt; Add New -&amp;gt; Mono Track&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then we need some samples to work on. It&amp;rsquo;s easiest if we generate 1 second of&#xA;silence and work with that.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Generate -&amp;gt; Silence&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You&amp;rsquo;ll need to zoom in as much as possible on X and Y axis. Now raise first&#xA;sample to the top and leave the rest on laying on zero. The result should look&#xA;like this.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://meka.rs/images/dirac.webp&#34; alt=&#34;Dirac pulse&#34;&gt;&lt;/img&gt;&lt;/p&gt;&#xA;&lt;p&gt;This clip actually has second sample raised and the reason I did that is because&#xA;it is hard to see first sample because of the clip edge. Save the project and&#xA;export as .wav.&lt;/p&gt;&#xA;&lt;h2 id=&#34;capturing-impulse-response&#34;&gt;Capturing Impulse Response&lt;/h2&gt;&#xA;&lt;p&gt;In Ardour we will need two mono tracks. One will have the Dirac pulse we just&#xA;generated, second one will capture the output of the microphone directed at the&#xA;guitar cabinet. With PC I will mark computer + audio interface, just to make it&#xA;shorter.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PC (dirac) -&amp;gt; Power amp -&amp;gt; Cabinet -&amp;gt; Microphone -&amp;gt; PC (impulse response)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This means that dirac track should have its inputs disconnected and output&#xA;connected so it is fed to power amp. The impulse response track should have&#xA;all outputs disconnected and input connected only to the microphone.&lt;/p&gt;&#xA;&lt;p&gt;There is a catch. To suppress pops and clicks that appear between two clips,&#xA;Ardour will add a small fade in to the start of the clip and fade out to the&#xA;end of it. This will &amp;ldquo;eat up&amp;rdquo; our Dirac pulse, so we have to disable that. Zoom&#xA;as much as possible until the curve for fade in/out is visible. Right-click on&#xA;the little square at the end of the curve and click on &lt;code&gt;Deactivate&lt;/code&gt;. You have&#xA;to do that on captures, too.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://meka.rs/images/clip.webp&#34; alt=&#34;Ardour clip&#34;&gt;&lt;/img&gt;&lt;/p&gt;&#xA;&lt;p&gt;Do few test captures to check the levels and then start capturing impulse&#xA;responses. You can export the capture and open it in Audacity for trimming&#xA;start and end if needed. I also like to add very small fade out at the end.&#xA;For aligning the start of the clip I use &lt;code&gt;z&lt;/code&gt; shortcut to find the zero crossing&#xA;in the clip and I delete the samples before that one. That way no delay is&#xA;introduced by impulse response. Save that project and export the .wav file.&#xA;That file is your IR! Congratulations, you just made your first IR!&lt;/p&gt;&#xA;&lt;h3 id=&#34;related-posts&#34;&gt;Related posts&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://meka.rs/blog/2025/05/12/impulse-response-sweep/&#34;&gt;Impulse Response Sweep&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://meka.rs/blog/2025/04/15/neural-amp-modeling/&#34;&gt;Neural Amp Modeling&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Neural Amp Modeling</title>
      <link>https://meka.rs/blog/2025/04/15/neural-amp-modeling/</link>
      <pubDate>Tue, 15 Apr 2025 13:30:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2025/04/15/neural-amp-modeling/</guid>
      <description>&lt;h2 id=&#34;re-amping&#34;&gt;Re-amping&lt;/h2&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s say you&amp;rsquo;re a guitar player and want to record your track of a song.&#xA;Typically you would enter the studio with your guitar, amp and cabinet and&#xA;record what&amp;rsquo;s needed. But let&amp;rsquo;s say you decide to record your guitar without&#xA;any processing by pedals or amps, glue the good takes together and then&#xA;process that track with pedals and amps. That process is called re-amping.&lt;/p&gt;&#xA;&lt;p&gt;Now let&amp;rsquo;s say you want that guitar track processed by a plugin, not hardware.&#xA;The process of recording would be almost the same, but the process of getting&#xA;the plugin to sound like an amp is quite a challenge. Today if we want to&#xA;emulate the whole rig, it is best if it&amp;rsquo;s done in two parts: NAM and IR. IR is&#xA;much older, and it stands for Impulse Response. NAM stands for Neural Amp&#xA;Modeler and it&amp;rsquo;s just a few years old. IR is used to capture the sonic&#xA;characteristic of reverb and guitar cabinets, the most. It can do other things,&#xA;but for now let&amp;rsquo;s just say that IR in our case is used to emulate guitar&#xA;cabinets. NAM in our case is used to capture and emulate preamp. It can also&#xA;capture full rig but you can&amp;rsquo;t use any effects that are time based, like&#xA;reverb or delay. The reason why I like NAM for preamp and IR for cabinet is&#xA;because that way I can use IR cabinets captured over past two decades. As NAM&#xA;is relatively new, it still doesn&amp;rsquo;t have such a huge ecosystem.&lt;/p&gt;&#xA;&lt;h2 id=&#34;preamp-and-nam&#34;&gt;Preamp and NAM&lt;/h2&gt;&#xA;&lt;p&gt;One of the great things that came out of AI hype is &lt;a href=&#34;https://www.neuralampmodeler.com/&#34;&gt;Neural Amp Modeler&lt;/a&gt;,&#xA;or NAM for short. To capture NAM, you have to separate preamp from the rest of&#xA;the gear. As stated before, you can capture NAM of your whole rig, but today I&#xA;want to capture just the preamp. In my case it is Engl E570. It&amp;rsquo;s pretty rare&#xA;so I&amp;rsquo;d like to be able to replace it with a NAM loader pedal (hardware pedal&#xA;that loads NAM and emulates my preamp). If you&amp;rsquo;d like to profile preamp that is&#xA;part of amp head or combo, you&amp;rsquo;ll need to use FX loop. To be precise, you&amp;rsquo;ll&#xA;use Send on the FX loop as that is the preamp&amp;rsquo;s output. What is needed for that&#xA;beside preamp is audio interface, computer and re-amp box. My choice of&#xA;operating system is FreeBSD, but once you have JACK configured, the rest is the&#xA;same as Linux. On the mentioned computer I will use JACK and Ardour to capture&#xA;the sound of preamp. Computer is connected to audio interface via USB, and in&#xA;my case it is Presonus AudioBox 1818VSL. It has line level outputs, which is&#xA;almost exclusively the case on audio interfaces, so I can&amp;rsquo;t just plug it&amp;rsquo;s&#xA;output to the preamp&amp;rsquo;s input. The impedance and signal level of line output do&#xA;not match those of the guitar input on the preamp. To convert line to guitar&#xA;level, I am using Radial Engineering EXTC-Stereo. It has inputs and outputs on&#xA;one side, which are connected to the audio interface, and send and receive on&#xA;the other side, which are connected to the preamp. To be precise, audio&#xA;interface output is connected to EXTC, send of EXTC is connected to preamp&#xA;input and preamp output is connected to audio interface (line in). If I call&#xA;computer + audio interface just PC to make it short, this would be the&#xA;&amp;ldquo;diagram&amp;rdquo; of connections&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PC -&amp;gt; EXTC -&amp;gt; preamp -&amp;gt; PC&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;What we want is to send a signal from the PC, process it with the preamp and&#xA;send it back to PC for analysis. To do that, create Ardour session at 48kHz and&#xA;create two tracks with names &amp;ldquo;sweep&amp;rdquo; and &amp;ldquo;capture&amp;rdquo;. Both tracks need to be mono.&#xA;Connect sweep&amp;rsquo;s JACK output to the output on the interface which is connected to&#xA;reamp box. Connect capture&amp;rsquo;s JACK input to the input on the interface which is&#xA;connected to the preamp. That way you can record the output of preamp in capture&#xA;track and play some signal on the sweep track. Sweep is the term left from IR,&#xA;and I will explain why it&amp;rsquo;s called that in the follow up post. For now all you&#xA;need to know is that it&amp;rsquo;s not &amp;ldquo;normal&amp;rdquo; sound, it is a signal created so that AI&#xA;can learn from it. To be precise, AI will learn from sweep and captured signal&#xA;and it will produce information how to digitally transform the sound so it is&#xA;the same as if we just did the reamp. Input on sweep track needs to be&#xA;disconnected and output on capture track, too. That way we are minimizing causes&#xA;of eventual problems. To get the sweep signal, go to &lt;a href=&#34;https://tone3000.com/capture&#34;&gt;tone3000&lt;/a&gt;&#xA;and download &amp;ldquo;sweep signal&amp;rdquo; from the page (downloaded file will be called&#xA;T3K-sweep-v3.wav). Now all you need to do is arm your capture track and record&#xA;the output of the preamp while the sweep signal is fed to the preamp&amp;rsquo;s input.&#xA;Once that&amp;rsquo;s done, align start and end of sweep and captured clip. Also, set&#xA;session start and end to the clip&amp;rsquo;s start and end. Normalize the captured clip.&#xA;Now we need to export sweep and capture to separate, mono files at 48kHz and&#xA;24bits. To do that, go to&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Session -&amp;gt; Export -&amp;gt; Stem Export&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you don&amp;rsquo;t already have a format for 48kHz (or session rate) at 24bits,&#xA;create one. We need wav files that are in no way further processed. That means&#xA;disable trimming and normalization. In the &lt;code&gt;Time Span&lt;/code&gt; tab select &lt;code&gt;session&lt;/code&gt;&#xA;range and only that one. In the &lt;code&gt;Channels&lt;/code&gt; tab, select sweep and capture track&#xA;and disable &lt;code&gt;Apply track/bus processing&lt;/code&gt;. Now export the track to wav files.&lt;/p&gt;&#xA;&lt;p&gt;Go to &lt;a href=&#34;https://www.tone3000.com/capture?type=dry-wet&#34;&gt;tone3000&amp;rsquo;s capture&lt;/a&gt; and&#xA;upload dry (sweep) and wet (capture) wav files. Follow the form and wait for AI&#xA;to process all epochs (100 by default). Once that&amp;rsquo;s done, you&amp;rsquo;ll have NAM file&#xA;published on Tone3000 platform. Congrats!&lt;/p&gt;&#xA;&lt;h2 id=&#34;tips&#34;&gt;Tips&lt;/h2&gt;&#xA;&lt;p&gt;For better performance I suggest compiling jack from ports with SOSSO library&#xA;enabled. It can dramatically reduce DSP usage in JACK/Ardour.&lt;/p&gt;&#xA;&lt;p&gt;To test your NAM you can use &lt;code&gt;neuralrack-lv2&lt;/code&gt; to load it together with some IR.&#xA;Nice thing is that &lt;a href=&#34;https://www.tone3000.com/search?gear=ir&#34;&gt;tone3000 already has some IRs&lt;/a&gt;,&#xA;so download some and test it in &lt;code&gt;neuralrack-lv2&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;While there is also a way to only &lt;a href=&#34;https://www.tone3000.com/capture&#34;&gt;upload the capture&lt;/a&gt;,&#xA;it never worked for me. The reason is that I couldn&amp;rsquo;t make Ardour produce the&#xA;exact same number of samples in the capture file, that the sweep file has. With&#xA;stem export, tracks are exported to files with the exact same length. Briefly&#xA;talking to Tone3000 support, they told me that input signal should be uploaded&#xA;only if custom signal is used to train the AI. I would love to not waste&#xA;resources by uploading both files, but I always get an error while producing&#xA;the NAM if I upload only the capture.&lt;/p&gt;&#xA;&lt;h2 id=&#34;update&#34;&gt;Update&lt;/h2&gt;&#xA;&lt;p&gt;When creating Ardour session, be sure to select &amp;ldquo;Audio Time&amp;rdquo; not &amp;ldquo;Beat Time&amp;rdquo; for &amp;ldquo;Default&#xA;time domain&amp;rdquo;. That way capture and sweep will have exact same number of samples, and you&#xA;can &lt;a href=&#34;https://www.tone3000.com/capture&#34;&gt;just upload the capture&lt;/a&gt;. I didn&amp;rsquo;t find a way to&#xA;convert existing session from &amp;ldquo;Beat&amp;rdquo; to &amp;ldquo;Audio&amp;rdquo; time.&lt;/p&gt;&#xA;&lt;h3 id=&#34;related-posts&#34;&gt;Related posts&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://meka.rs/blog/2025/05/11/impulse-response/&#34;&gt;Impulse Response&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://meka.rs/blog/2025/05/12/impulse-response-sweep/&#34;&gt;Impulse Response Sweep&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Rust and ioctl</title>
      <link>https://meka.rs/blog/2025/03/18/rust-and-ioctl/</link>
      <pubDate>Tue, 18 Mar 2025 22:23:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2025/03/18/rust-and-ioctl/</guid>
      <description>&lt;p&gt;When I explore new programming language, I like to poke audio. Rust is a new language for me and I&#xA;need a pet project to learn. As I&amp;rsquo;m also using FreeBSD, that means audio device configuration is&#xA;done via &lt;code&gt;ioctl&lt;/code&gt;. Here is the summary of how to handle &lt;code&gt;ioctl&lt;/code&gt; in Rust. Create the project, add&#xA;&lt;code&gt;nix&lt;/code&gt; crate enabling &lt;code&gt;ioctl&lt;/code&gt; feature.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cargo new oss&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd oss&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cargo add --features ioctl nix&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For now I will just exclude &lt;code&gt;AudioInfo&lt;/code&gt; from the code and show you the rest. The following is an&#xA;example of how to handle two &lt;code&gt;ioctl&lt;/code&gt; calls in Rust. One writes integer and one reads structure.&#xA;Ignore for now that logicaly, setting channels before getting information about hardware is wrong.&#xA;I wanted to show &lt;code&gt;i32&lt;/code&gt; version first, struct later.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-rust&#34; data-lang=&#34;rust&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;use&lt;/span&gt; nix::libc;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;use&lt;/span&gt; std::fs;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;use&lt;/span&gt; std::os::fd::AsRawFd;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;SNDCTL_DSP_MAGIC&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;u8&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;P&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;SNDCTL_DSP_CHANNELS&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;u8&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nix::&lt;span style=&#34;color:#a6e22e&#34;&gt;ioctl_readwrite!&lt;/span&gt;(oss_channels, &lt;span style=&#34;color:#66d9ef&#34;&gt;SNDCTL_DSP_MAGIC&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;SNDCTL_DSP_CHANNELS&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;i32&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;SNDCTL_INFO_MAGIC&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;u8&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;X&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;SNDCTL_ENGINEINFO&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;u8&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nix::&lt;span style=&#34;color:#a6e22e&#34;&gt;ioctl_readwrite!&lt;/span&gt;(&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    oss_audio_info,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;SNDCTL_INFO_MAGIC&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;SNDCTL_ENGINEINFO&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    AudioInfo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;fn&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; devpath &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; String::from(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/dev/dsp&amp;#34;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; dsp &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; fs::File::open(devpath).unwrap();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; fd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; dsp.as_raw_fd();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;mut&lt;/span&gt; channels: &lt;span style=&#34;color:#66d9ef&#34;&gt;i32&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;mut&lt;/span&gt; audio_info &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; AudioInfo::new();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;unsafe&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        oss_channels(fd, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;mut&lt;/span&gt; channels).expect(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Failed to set number of channels&amp;#34;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        oss_audio_info(fd, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;mut&lt;/span&gt; audio_info).expect(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Failed to get info on device&amp;#34;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;println!&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;channels = &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, audio_info.max_channels);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;println!&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;rate = &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, audio_info.max_rate);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s just concentrate on the three lines after &lt;code&gt;use&lt;/code&gt; block. How did I know what values to use? For&#xA;start you have to look in &lt;code&gt;/usr/src/sys/sys/soundcard.h&lt;/code&gt; (assuming that&amp;rsquo;s where your FreeBSD source&#xA;tree is). Let&amp;rsquo;s take a look.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SOUND_PCM_WRITE_CHANNELS&#x9;_IOWR(&amp;#39;P&amp;#39;, 6, int)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SNDCTL_DSP_CHANNELS&#x9;SOUND_PCM_WRITE_CHANNELS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As the call is &lt;code&gt;_IOWR&lt;/code&gt; I know I have to use &lt;code&gt;ioctl_readwrite&lt;/code&gt; macro, and it&amp;rsquo;s obvious where &lt;code&gt;P&lt;/code&gt; and&#xA;&lt;code&gt;6&lt;/code&gt; come from. As the third argument to &lt;code&gt;_IOWR&lt;/code&gt; is &lt;code&gt;int&lt;/code&gt; I know I have to use &lt;code&gt;i32&lt;/code&gt; as fourth&#xA;argument to &lt;code&gt;ioctl_readwrite&lt;/code&gt;. Also, the first argument to that macro is the function name that is&#xA;generated and used later in the code.&lt;/p&gt;&#xA;&lt;p&gt;For getting information about underlaying hardware, OSS uses &lt;code&gt;ioctl&lt;/code&gt; with a struct. Let&amp;rsquo;s see how&#xA;it&amp;rsquo;s defined in the FreeBSD source&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SNDCTL_ENGINEINFO&#x9;_IOWR(&amp;#39;X&amp;#39;,12, oss_audioinfo)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;From this I know I have to use &lt;code&gt;ioctl_readwrite&lt;/code&gt;, &lt;code&gt;X&lt;/code&gt; for MAGIC number and &lt;code&gt;12&lt;/code&gt; for the argument.&#xA;The last one is to figure out how to work with the struct &lt;code&gt;oss_audioinfo&lt;/code&gt;. Here&amp;rsquo;s that structure.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;oss_longname_t&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;oss_label_t&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;16&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;oss_devnode_t&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; oss_audioinfo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;&#x9; dev;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; name[&lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  busy;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  pid;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  caps;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  iformats;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  oformats;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;&#x9; magic;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; cmd[&lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  card_number;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  port_number;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  mixer_dev;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  legacy_device;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  enabled;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  flags;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  min_rate;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  max_rate;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  min_channels;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  max_channels;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  binding;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  rate_source;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; handle[&lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;unsigned&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; nrates;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;unsigned&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; rates[&lt;span style=&#34;color:#ae81ff&#34;&gt;20&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;oss_longname_t&lt;/span&gt; song_name;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;oss_label_t&lt;/span&gt; label;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  latency;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;oss_devnode_t&lt;/span&gt; devnode;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  next_play_engine;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  next_rec_engine;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;  filler[&lt;span style=&#34;color:#ae81ff&#34;&gt;184&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} oss_audioinfo;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The trick in Rust is to use &lt;code&gt;#[repr(C)]&lt;/code&gt;, &lt;code&gt;libc::c_int&lt;/code&gt; and other &lt;code&gt;libc::c_*&lt;/code&gt; types. If you put&#xA;this right below &lt;code&gt;use&lt;/code&gt; block, you have the whole code.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-rust&#34; data-lang=&#34;rust&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#[repr(C)]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;AudioInfo&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; dev: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; name: [libc::c_char; &lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; busy: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; pid: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; caps: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; iformats: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; oformats: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; magic: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; cmd: [libc::c_char; &lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; card_number: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; port_number: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; mixer_dev: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; legacy_device: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; enabled: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; flags: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; min_rate: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; max_rate: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; min_channels: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; max_channels: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; binding: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; rate_source: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; handle: [libc::c_char; &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; nrates: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_uint,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; rates: [libc::c_uint; &lt;span style=&#34;color:#ae81ff&#34;&gt;20&lt;/span&gt;],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; song_name: [libc::c_char; &lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; label: [libc::c_char; &lt;span style=&#34;color:#ae81ff&#34;&gt;16&lt;/span&gt;],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; latency: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; devnode: [libc::c_char; &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; next_play_engine: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; next_rec_engine: &lt;span style=&#34;color:#a6e22e&#34;&gt;libc&lt;/span&gt;::c_int,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;pub&lt;/span&gt; filler: [libc::c_int; &lt;span style=&#34;color:#ae81ff&#34;&gt;184&lt;/span&gt;],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Although nobody can give you formula on how to write ioctl code in Rust based on C but there are&#xA;some guidelines. Based on C code, you can tell which macro it uses so here&amp;rsquo;s a rough table.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;C&lt;/th&gt;&#xA;          &lt;th&gt;Rust&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;_IO&lt;/td&gt;&#xA;          &lt;td&gt;ioctl_none&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;_IOR&lt;/td&gt;&#xA;          &lt;td&gt;ioctl_read&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;_IOW&lt;/td&gt;&#xA;          &lt;td&gt;ioctl_write_*&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;_IOWR&lt;/td&gt;&#xA;          &lt;td&gt;ioctl_readwrite&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For a list of &lt;code&gt;ioctl_write_*&lt;/code&gt; macros and full documentation refer to&#xA;&lt;a href=&#34;https://docs.rs/nix/latest/nix/sys/ioctl&#34;&gt;https://docs.rs/nix/latest/nix/sys/ioctl&lt;/a&gt;. I have to say it is easy to dive into something like this&#xA;when you have &lt;a href=&#34;https://lists.freebsd.org/archives/freebsd-hackers/2024-January/002823.html&#34;&gt;one of the Rust advocates in FreeBSD&lt;/a&gt;&#xA;as a work colleague, as he was really quick to spot my errors and generally guide me to a working&#xA;code as a newbie Rustacean.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Guitar</title>
      <link>https://meka.rs/blog/2024/09/09/new-guitar/</link>
      <pubDate>Mon, 09 Sep 2024 10:55:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2024/09/09/new-guitar/</guid>
      <description>&lt;p&gt;After 3 years in the making, I finally got my new guitar. I got &lt;a href=&#34;https://www.seymourduncan.com/single-product/blackouts-metal&#34;&gt;Seymour Duncan&#xA;Blackouts Metal&lt;/a&gt;&#xA;for it. That pickup is insanely hot and until my new guitar was done, I used it&#xA;in my Les Paul, so pickup is the same in both guitars. Here is a riff from our&#xA;upcoming single with Neural Amp Modeler and Impulse Response instead of guitar&#xA;amplifier, cabinet and microphone.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gibson-les-paul-custom&#34;&gt;Gibson Les Paul Custom&lt;/h2&gt;&#xA;&lt;p&gt;&lt;audio src=&#34;https://meka.rs/audio/lp.ogg&#34; controls&gt;&lt;/audio&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;signature-model&#34;&gt;Signature model&lt;/h2&gt;&#xA;&lt;p&gt;&lt;audio src=&#34;https://meka.rs/audio/viper.ogg&#34; controls&gt;&lt;/audio&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;my-impressions&#34;&gt;My impressions&lt;/h2&gt;&#xA;&lt;p&gt;I love Les Paul Custom for so long and I considered it the best guitar in the&#xA;world. Together with EMG 81/85, it is insane. I can&amp;rsquo;t believe that I&amp;rsquo;m saying&#xA;this, but there is something better than Les Paul, and it&amp;rsquo;s my new guitar. It is&#xA;made by a long time friend of mine and solo guitarist in my band, so he knows&#xA;what picking style I use, what bands I like, what amps I&amp;rsquo;m after. With somebody&#xA;knowing me so well, he couldn&amp;rsquo;t but make a guitar better than Gibson. I love how&#xA;it bites more than Les Paul. It will definitely be my sound on our upcoming&#xA;single and album.&lt;/p&gt;&#xA;&lt;p&gt;Just in case you&amp;rsquo;re wondering how it looks, it is black ESP Viper with &amp;ldquo;LUST&amp;rdquo;&#xA;(the first word of the name of my band) instead of inlays.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://meka.rs/images/guitar-raw.webp&#34; alt=&#34;guitar raw&#34;&gt;&lt;/img&gt;&#xA;&lt;img src=&#34;https://meka.rs/images/guitar-painted.webp&#34; alt=&#34;guitar painted&#34;&gt;&lt;/img&gt;&#xA;&lt;img src=&#34;https://meka.rs/images/meka-pop.webp&#34; alt=&#34;meka &amp; pop&#34;&gt;&lt;/img&gt;&#xA;&lt;img src=&#34;https://meka.rs/images/guitar-playing.webp&#34; alt=&#34;playing new guitar&#34;&gt;&lt;/img&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Ratamahatta</title>
      <link>https://meka.rs/blog/2024/09/02/ratamahatta/</link>
      <pubDate>Mon, 02 Sep 2024 10:17:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2024/09/02/ratamahatta/</guid>
      <description>&lt;p&gt;I always mumbled Ratamahatta without understanding what&amp;rsquo;s it about. I did get&#xA;literal translation from some friends, but I still didn&amp;rsquo;t understand what was&#xA;it about. Nowadays I&amp;rsquo;m lucky that some of my colegues are Brazilians so I could&#xA;ask for the deeper meaning of the words. The colegue in question is&#xA;&lt;a href=&#34;https://www.linkedin.com/in/fernandoseidler/&#34;&gt;Fernando Seidler&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Biboca, garagem, favela&#xA;Biboca, garagem, favela!&#xA;Fubanga, maloca, bocada&#xA;Fubanga, maloca, bocada!&#xA;&#xA;Maloca, bocada, fubanga&#xA;Maloca, bocada, fubanga!&#xA;Favela, garagem, biboca&#xA;Favela, garagem, biboca, porra!&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So, these are words that make reference to slums or simple/dangerous places.&#xA;Biboca is a word for a simple, humble place. Garagem is a garage. Favela is&#xA;slum. Fubanga is a ugly, non-attractive woman. Maloca is a kind of indigenous&#xA;habitation and Bocada is the place where people sell drugs.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Um, dois, três, quatro&#xA;Zé Do Caixão, Zumbi, Lampião&#xA;Zé Do Caixão, Zumbi, Lampião&#xA;Zé Do Caixão, Zumbi, Lampião&#xA;Zé Do Caixão, Zumbi, Lampião&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Those 3 are some people from Brazil. Zé do Caixão is the character of a cult&#xA;terror/bizarre genre. The actor is considered the father of Brazilian terror&#xA;cinema. Zumbi makes reference to &amp;ldquo;Zumbi dos Palmares&amp;rdquo;, a guy who was a leader&#xA;for slaves that ran away from their &amp;ldquo;masters&amp;rdquo; (I really hate the word &amp;ldquo;masters&amp;rdquo;&#xA;in this context) and went to &amp;ldquo;Quilombo dos Palmares&amp;rdquo;, a settlement for escaped&#xA;slaves. And Lampião was a bandit that is almost a myth: for the police he was&#xA;a criminal, for the population at the time, a hero, so much that he received&#xA;the nickname &amp;ldquo;Robin Hood da Caatinga&amp;rdquo;.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Vamos detonar essa porra&#xA;É, porra!&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In a kind of literal translation:&lt;/p&gt;&#xA;&lt;p&gt;&amp;ldquo;Let’s fuck this shit up&lt;br /&gt;&#xA;Yeah, fuck it&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;For the end, here&amp;rsquo;s one formula: Ratamahatta = Ratos(rats) + Manhattan.&lt;/p&gt;&#xA;&lt;p&gt;According to Carlinhos Brown, in an interview with UOL, the song was inspired&#xA;by the rats of New York, that is, these animals do not only inhabit unhealthy&#xA;places. &amp;ldquo;I had this title &amp;lsquo;Ratamahatta&amp;rsquo; in my head and I needed to finish it.&#xA;Max helped me. When I was in Manhattan, I was impressed by their rats. They&#xA;look like the opossums here in Bahia. And opossums here go to the pot! But&#xA;people said that the rats in Manhattan were not good to eat, because they were&#xA;dirtier. That&amp;rsquo;s why the lyrics have the words &amp;ldquo;garagem&amp;rdquo; &amp;ldquo;biboca&amp;rdquo; and &amp;ldquo;favela&amp;rdquo;.&#xA;The rat is not present only in the big cities. It is everywhere. It is at&#xA;fubanga, maloca, bocada. Who is the rat? He is the recycling boss. This is what&#xA;the song means: Talks about a Manhattan rat who goes around the world and&#xA;connects with everybody.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>OpenLDAP</title>
      <link>https://meka.rs/blog/2024/04/14/openldap/</link>
      <pubDate>Sun, 14 Apr 2024 17:43:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2024/04/14/openldap/</guid>
      <description>&lt;p&gt;I wanted to achieve 3 things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ability to enable/disable account and domain&lt;/li&gt;&#xA;&lt;li&gt;Proper groups and membership&lt;/li&gt;&#xA;&lt;li&gt;Authorization for services&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I personally don&amp;rsquo;t like OLC or On-Line Config, as I like to do my things using&#xA;Ansible. So here is the slapd.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include&#x9;&#x9;/usr/local/etc/openldap/schema/core.schema&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include&#x9;&#x9;/usr/local/etc/openldap/schema/cosine.schema&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include&#x9;&#x9;/usr/local/etc/openldap/schema/inetorgperson.schema&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include&#x9;&#x9;/usr/local/etc/openldap/schema/nis.schema&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include&#x9;&#x9;/usr/local/etc/openldap/schema/opendkim.schema&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include&#x9;&#x9;/usr/local/etc/openldap/schema/pmi.schema&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pidfile&#x9;&#x9;/var/run/openldap/slapd.pid&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;argsfile&#x9;/var/run/openldap/slapd.args&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;modulepath&#x9;/usr/local/libexec/openldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;moduleload&#x9;back_mdb&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;moduleload&#x9;memberof&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;overlay&#x9;    &#x9;&#x9;memberof&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;memberof-group-oc&#x9;groupOfUniqueNames&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;memberof-member-ad&#x9;uniqueMember&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;memberof-refint&#x9;&#x9;TRUE&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TLSCACertificateFile /usr/local/etc/openldap/certs/chain.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TLSCertificateFile /usr/local/etc/openldap/certs/fullchain.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TLSCertificateKeyFile /usr/local/etc/openldap/certs/privkey.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;security ssf&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;128&lt;/span&gt; tls&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;access to attrs&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;userPassword&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  by self write&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  by anonymous auth&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;access to *&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  by self write&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  by users read&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  by anonymous auth&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;database&#x9;mdb&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;suffix&#x9;&#x9;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dc=ldap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rootdn&#x9;&#x9;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;cn=root,dc=ldap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;directory&#x9;/var/db/openldap-data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;index&#x9;&#x9;objectClass,mail&#x9;eq&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include&#x9;&#x9;/usr/local/etc/openldap/slapd-secret.conf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include&#x9;&#x9;/usr/local/etc/openldap/slapd-multimaster.conf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And this is the interesting part of the directory:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: domain&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dc: ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;account,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: domain&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dc: account&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: ou&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;meka.rs,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;account,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: organizationalUnit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ou: meka.rs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: uid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;meka,ou&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;meka.rs,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;account,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: pilotPerson&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: posixAccount&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cn: Goran&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sn: Mekić&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;uidNumber: &lt;span style=&#34;color:#ae81ff&#34;&gt;65534&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gidNumber: &lt;span style=&#34;color:#ae81ff&#34;&gt;65534&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;homeDirectory: /var/mail/domains/meka.rs/meka&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mail: meka@meka.rs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;userClass: enabled&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;uid: meka&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;group,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: domain&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dc: group&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: cn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;mail,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;group,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: groupOfUniqueNames&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cn: mail&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;uniqueMember: uid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;meka,ou&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;meka.rs,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;account,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;service,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: domain&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dc: service&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: cn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;postfix,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;service,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: person&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cn: postfix&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sn: service&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;description: SMTP service&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let me ignore enable/disable of domain for a bit. Let&amp;rsquo;s just focus on accounts.&#xA;In &lt;code&gt;slapd.conf&lt;/code&gt;, every line with &lt;code&gt;memberof&lt;/code&gt; string in it is for groups. By&#xA;default, memberof module uses groupOfNames, but I think it is better to use&#xA;groupOfUniqueNames, so it needs some extra configuration. Let&amp;rsquo;s see what it&#xA;provides.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ldapsearch -x -Z -W -D cn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;root,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap memberOf&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;cn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;mail,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;group,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;*&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;memberOf&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;. . .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dn: uid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;meka,ou&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;meka.rs,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;account,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: pilotPerson&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;objectClass: posixAccount&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cn: Goran&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sn: Mekić&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;uidNumber: &lt;span style=&#34;color:#ae81ff&#34;&gt;65534&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gidNumber: &lt;span style=&#34;color:#ae81ff&#34;&gt;65534&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;homeDirectory: /var/mail/domains/meka.rs/meka&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mail: meka@meka.rs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;userClass: enabled&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;uid: meka&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;memberOf: cn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;mail,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;group,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;. . .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So with &lt;code&gt;memberOf&lt;/code&gt; filter, you can easily get members of a group. Notice that&#xA;there&amp;rsquo;s &lt;code&gt;&#39;*&#39; &#39;memberOf&#39;&lt;/code&gt; at the end. That says &amp;ldquo;give me all attributes of an&#xA;object, plus give me &lt;code&gt;memberOf&lt;/code&gt;&amp;rdquo;. If you omit &lt;code&gt;memberOf&lt;/code&gt;, it will not be&#xA;displayed, although you requested all attributes. That is because it is dynamic&#xA;attribute and it is returned only if explicitly requested. But there are few&#xA;cases I found that gave me headache. For example, if you create the group, then&#xA;configure &lt;code&gt;slapd.conf&lt;/code&gt; to use it, it won&amp;rsquo;t work. I guess that something is&#xA;triggered on creation and/or modification of a group that is not triggered in&#xA;this scenario. Another anomaly I found is when I&amp;rsquo;m restoring from backup. For&#xA;some reason, groups are created before accounts, so &lt;code&gt;memberOf&lt;/code&gt; doesn&amp;rsquo;t work.&#xA;Having &lt;code&gt;dc=group,dc=ldap&lt;/code&gt; separated from &lt;code&gt;dc=account,dc=ldap&lt;/code&gt; allows you to&#xA;restore accounts before groups. Also, there is &lt;code&gt;msuser.schema&lt;/code&gt;. I first thought&#xA;that I need to include it to be able to use &lt;code&gt;memberOf&lt;/code&gt;, but that is wrong. When&#xA;I include this file, it defines memberOf and I guess that&amp;rsquo;s why it doesn&amp;rsquo;t work&#xA;the way I wanted.&lt;/p&gt;&#xA;&lt;p&gt;Look closely at &lt;code&gt;ldapsearch&lt;/code&gt; output and notice &lt;code&gt;userClass: enabled&lt;/code&gt;. If extend&#xA;the previously used filter, you get something like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ldapsearch -x -Z -W -D cn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;root,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;userClass&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;enabled&lt;span style=&#34;color:#f92672&#34;&gt;)(&lt;/span&gt;memberOf&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;cn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;mail,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;group,dc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ldap&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;*&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;memberOf&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Output will pretty much be the same, only difference is which accounts will be&#xA;listed.&lt;/p&gt;&#xA;&lt;p&gt;Enabling or disabling domain is partially working. For example, postfix has a&#xA;filter for domains, but dovecot does not, while ejabberd can&amp;rsquo;t use LDAP for list&#xA;of domains. Depending on the capabilities of a service, you might or might not&#xA;achieve this. For example, solution I use for ejabberd is to have group, just&#xA;like for the accounts, but for domains called &lt;code&gt;enabled&lt;/code&gt; and use same &lt;code&gt;memberOf&lt;/code&gt;&#xA;filter to get the list. Then I use that info in Ansible to provision&#xA;configuration file.&lt;/p&gt;&#xA;&lt;p&gt;For authorization of services I chose not to use &lt;code&gt;dc=account,dc=ldap&lt;/code&gt; for base,&#xA;but &lt;code&gt;cn=&amp;lt;service&amp;gt;,dc=service,dc=ldap&lt;/code&gt;. That way services can not interfere with&#xA;user accounts, but beside different base, those are just like normal accounts.&lt;/p&gt;&#xA;&lt;p&gt;For more context on how I use OpenLDAP, take a look at my &lt;a href=&#34;https://github.com/mekanix/comms&#34;&gt;set of services for&#xA;communication&lt;/a&gt; as it might give you a broader&#xA;picture what I&amp;rsquo;m trying to solve.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>DIY Sound</title>
      <link>https://meka.rs/blog/2023/08/12/diy-sound/</link>
      <pubDate>Sat, 12 Aug 2023 10:46:25 +0000</pubDate>
      <guid>https://meka.rs/blog/2023/08/12/diy-sound/</guid>
      <description>&lt;p&gt;Sometimes you just hate what industry has don with the sound and start building&#xA;your own stuff. For one, I didn&amp;rsquo;t like open source DAW alternatives as all of&#xA;them are missing something: Arour&amp;rsquo;s MIDI is terrible for electronic music, loop&#xA;recording is missing in Muse, ZRythm is stereo only and I couldn&amp;rsquo;t find how to&#xA;work with QTractor and DrumGizmo. To learn about audio and DSP, I started work&#xA;on Maolan. Today Maolan is still extremely experimental, but I learned a lot&#xA;and I plan to work on it as free time permits. I could have started with JACK&#xA;as first supported backend, but I decided to go with FreeBSD&amp;rsquo;s OSS and really&#xA;understand what&amp;rsquo;s going on there. Today I&amp;rsquo;m on the verge of understanding it&#xA;all perfectly from user space perspective. I am not as good kernel developer,&#xA;but I do intend to optimize FreeBSD&amp;rsquo;s OSS and other code that is part of audio&#xA;stack. For example, currently USB audio driver has minimal buffer size of 2&#xA;miliseconds. Not bad, but USB docs say it works in 1ms frames with 8 subframes&#xA;which are 125us or microseconds. Lowering that will be piece of cake, but I&amp;rsquo;m&#xA;waiting for 14-STABLE to branch off so I don&amp;rsquo;t sneak in buffer limit which is&#xA;not tested enough. As OSS, at least in FreeBSD, uses double buffer: one user&#xA;facing, one hadware facing, it would be interesting to see what optimizations&#xA;are possible if we would expose controls for hardware facing buffer. You see&#xA;where I&amp;rsquo;m going with this. There&amp;rsquo;s work to be done to make FreeBSD more&#xA;real-time.&lt;/p&gt;&#xA;&lt;p&gt;But software and PC in general is just a half the story. Audio interface and&#xA;hardware audio devices are the other half. Today USB audio is hard to work with&#xA;on any operating system. That 1ms frame of USB makes sure that latency is at&#xA;least 1ms. Using PCIe lowers that, but developing such card is way too hard for&#xA;me. My plan/workaround is to build USB sound card with very high sampling rate.&#xA;I will start with 384kHz and some of-the-shelf solutions to support it. List of&#xA;items I&amp;rsquo;m waiting to arrive:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.akm.com/us/en/products/audio/audio-dac/ak4458vn/&#34;&gt;AK4458VN DAC&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.akm.com/us/en/products/audio/audio-adc/ak5578en/&#34;&gt;AK5578EN ADC&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.ebay.com/p/1839170567?iid=251702918057&#34;&gt;Programming Adapter&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.minidsp.com/products/usb-audio-interface/mchstreamer&#34;&gt;MCHStreamer Kit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you look at AD/DA converters, you&amp;rsquo;ll notice that they can do 32bit @ 768kHz.&#xA;That will be my next step, after all these parts start working together. The&#xA;ultimate goal is to make DIY high end audio interface that has one less digit&#xA;in the price. For example, if I didn&amp;rsquo;t need 2 programming adapters, that would&#xA;be more than 200e less on the price. The reason I&amp;rsquo;m getting it anyway is&#xA;because I can&amp;rsquo;t solder that precisely, yet. I would love to program some MCU&#xA;and USB PHY using NuttX and using more general board instead of MCHStreamer,&#xA;but I&amp;rsquo;m not there yet. In order to get to 768kHz, I have to replace it anyway,&#xA;so I&amp;rsquo;m sure I will get there eventually. If all that work gives latency less&#xA;than 6ms, I finally have real-time using USB. Also, if I have all that, how&#xA;hard will it be to make PCIe alternative? I know it will be much faster, and&#xA;with it I might go to latencies like 2ms which give you freedom to patch things&#xA;any way you want, like microphone into the interface, have it recorded and&#xA;pushed to output which is connected to hardware vocal processor and then again&#xA;back to the interface, and then &amp;hellip; The point is that every time you go through&#xA;sound card you add those 2ms which means you can do it 3 times and still be&#xA;called real-time. And maybe I won&amp;rsquo;t do that but build digital mixer which will&#xA;route sound internally and it won&amp;rsquo;t even need a computer do work. Of course, I&#xA;will have USB interface on it, because I do want to record it in the end.&lt;/p&gt;&#xA;&lt;p&gt;Reading about AD/DA, I stumbled upon DSD format which they say is superior to&#xA;PCM. Let me briefly explain. PCM is what we are usually thought is digital&#xA;sampling. It&amp;rsquo;s how CD works, for example. Every 1/44100 of a second, level of&#xA;signal is measured and it is represented with a number. That&amp;rsquo;s what the name&#xA;stands for: Pulse Code Modulation or PCM for short. DSD works differently. I&#xA;only uses one bit to represent the sample. Weird, right? The idea is that one&#xA;bit is enough to represent if the current sample is higher or lower than&#xA;previous one. Done at a high frequency, for example &amp;gt;10MHz, you can easily see&#xA;that it follows audio signal more accurately. At least that what I read on the&#xA;Internet. Now here&amp;rsquo;s an idea. If I get my sound interface working in DSD mode,&#xA;and write a patch for FreeBSD OSS so it handles DSD natively, and use DSD WAV&#xA;files to record the input, I&amp;rsquo;m hoping to capture audio more accurately. I don&amp;rsquo;t&#xA;know how much difference it will make but today that&amp;rsquo;s the best what the&#xA;industry can offer, yet can&amp;rsquo;t use it as no interface today is built like that.&#xA;I mean, I&amp;rsquo;m not the first to come up with this idea, for start Denoy used same&#xA;AD/DA until the shortage, so the components are field tested, I&amp;rsquo;m not&#xA;interested in revolutionizing anything. What I mean is that the components I&#xA;listed are on the market for years and are being used by audio companies for&#xA;years, so I know I can do it, it&amp;rsquo;s just my first prototype so I can&amp;rsquo;t really&#xA;say how or when.&lt;/p&gt;&#xA;&lt;p&gt;My dear reader, I have a question. Would you support such a project by funding&#xA;it? If no, why? If yes, what amount? To be more precise, would you fund my work&#xA;on everything I just described if I promise that USB audio interface I just&#xA;described will cost around 200e (with current prices) if you exclude shipping,&#xA;you would have to solder it and get parts but you get the whole KiCAD project,&#xA;all code open source and based on NuttX? If you just had &amp;ldquo;yes to all&amp;rdquo; moment,&#xA;let me ask additional question. Once all this is done, would you fund work to&#xA;make it USB 3 compatible? As USB 3 has much higher bandwidth, the interface&#xA;could have much more channels, in or out. I&amp;rsquo;m talking about 32in, 32out, if&#xA;your PC can cope with it.&lt;/p&gt;&#xA;&lt;p&gt;Please let me know what you think. I prefer email as it&amp;rsquo;s easiest to sort and&#xA;archive of all communication channels, but you&amp;rsquo;re free to pick whatever you&#xA;like to contact me.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD PF and Dummynet</title>
      <link>https://meka.rs/blog/2022/11/17/freebsd-pf-and-dummynet/</link>
      <pubDate>Thu, 17 Nov 2022 11:57:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2022/11/17/freebsd-pf-and-dummynet/</guid>
      <description>&lt;p&gt;In 14-CURRENT there is now support for dummynet in PF. That means that you can&#xA;slow down packets based on some criteria. MacOS users probably know how this&#xA;works as that OS got support for PF+dummynet years ago. For example, you can do&#xA;the following in /etc/pf.conf:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;pass in quick inet from 192.168.1.1 to any dnpipe 1&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That way all traffic from 192.168.1.1 will go through dummynet pipe. To create&#xA;and configure the pipe you use:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;dnctl pipe 1 config bw 300KByte/s&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I gave it a really low bandwidth because I want it to be really noticeable if&#xA;packets are going through dummynet or not. You can change the pipe&amp;rsquo;s bandwidth&#xA;by using the same command just changing the numbers. Note that K and B have to&#xA;be upper case. You can, of course, use all the usual suffixes like M and G but&#xA;note that dummynet has a limit on the bandwidth it can configure.&lt;/p&gt;&#xA;&lt;p&gt;To see what is configured you can use:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;dnctl pipe show&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;With dnctl, show is an alias for list, so you will get the same results using&#xA;either.&lt;/p&gt;&#xA;&lt;p&gt;I didn&amp;rsquo;t make it so that packets generated on the machine itself be processed&#xA;by dummynet, but it might be intentional. What does work is VNET so your jails&#xA;can have different PF and dummynet configuration than the host.&lt;/p&gt;&#xA;&lt;p&gt;One annoying thing is that there is no dnctl rc.d service, so you will probably&#xA;write &lt;code&gt;dnctl&lt;/code&gt; commands in something like &lt;code&gt;rc.local&lt;/code&gt; or something. I do plan to&#xA;create rc.d service for myself and when I learn more about dummynet, to publish&#xA;it hoping it will become part of base so we can easily configure it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;update&#34;&gt;Update&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://reviews.freebsd.org/D37451&#34;&gt;dnctl service&lt;/a&gt; is now available. If&#xA;enabled it reads /etc/dnctl.conf which has IPFW-like syntax and when only&#xA;&lt;code&gt;dummynet&lt;/code&gt; module is loaded, it will issue an error on non-dummynet IPFW&#xA;statements.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Dual Stack Firewall</title>
      <link>https://meka.rs/blog/2022/08/16/freebsd-dual-stack-firewall/</link>
      <pubDate>Tue, 16 Aug 2022 11:11:35 +0000</pubDate>
      <guid>https://meka.rs/blog/2022/08/16/freebsd-dual-stack-firewall/</guid>
      <description>&lt;p&gt;The idea is very simple: everything works. But what is &amp;ldquo;everything&amp;rdquo; in this&#xA;case? I want my host and jails to have IPv4 and IPv6 address, register those&#xA;addresses in DNS and all to be accessible in the network and via Internet. To&#xA;make my life easier, I programmed &lt;a href=&#34;https://github.com/cbsd/reggae&#34;&gt;Reggae&lt;/a&gt; to&#xA;initialize rtadvd, jail with isc-dhcpd for IPv4 and IPv6 and DNS, pf with the&#xA;base configuration.&lt;/p&gt;&#xA;&lt;h2 id=&#34;host&#34;&gt;Host&lt;/h2&gt;&#xA;&lt;p&gt;If there were no jails, the configuration would be simple: just use dhcpcd for&#xA;everything. There&amp;rsquo;s not even need for some special firewall rules. To do that,&#xA;you need to run:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pkg install dhcpcd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;dhclient_program=/usr/local/sbin/dhcpcd&amp;#39;&lt;/span&gt; &amp;gt;/etc/rc.conf.d/network&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On next reboot or netif start all your DHCP ifaces will use dhcpcd and it will&#xA;configure DHCPv4, SLAAC and DHCPv6. Admitedly you will have two IPv6 addresses:&#xA;one SLAAC configured and one acquired through DHCPv6. The DHCP addresses will&#xA;be registered in DNS. That&amp;rsquo;s basically it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;jail&#34;&gt;Jail&lt;/h2&gt;&#xA;&lt;p&gt;In the jail itself it is the same as host: install dhcpcd and use it and DHCP&#xA;addresses are registered in DNS. If all you need is some kind of dual stack,&#xA;that&amp;rsquo;s it, but if you need it on a server with jails, stuff gets a little bit&#xA;more complex. First, to achieve that host and jails get the address from the&#xA;same router, you need to bridge your physical interface and epairs.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cloned_interfaces&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bridge0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_bridge0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addm igb0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_bridge0_ipv6&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 fd10:6c79:8ae5:8b91::5 -ifdisabled auto_linklocal&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The example uses &amp;ldquo;private IP range&amp;rdquo; in IPv4 terms, or unique local addresses as&#xA;IPv6 terminology defines them. There are two main problems with this setup:&#xA;DHCPv6 will not work and firewall will do too much. For DHCPv6 the reason it&#xA;doesn&amp;rsquo;t work is that you have to allow dhcpv6-client messages to arrive. You&#xA;didn&amp;rsquo;t need it for host-only setup, but to allow those messages to reach jails,&#xA;you need.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;pass in quick inet6 proto udp from fe80::/10 port dhcpv6-server to fe80::/10 port dhcpv6-client&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When you put egress interface (igb0 in my case) into bridge, it will see all&#xA;traffic for jails, too, so you have to allow packets which are not destined to&#xA;the host. To achieve that, pf offers &lt;self&gt;.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;block in log from any to &amp;lt;self&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That way you are filtering everything for the host, but leave jail traffic&#xA;alone.&lt;/p&gt;&#xA;&lt;h2 id=&#34;router&#34;&gt;Router&lt;/h2&gt;&#xA;&lt;p&gt;Maybe the easiest thing to do is converting Reggae setup into your router. All&#xA;you need to do is add physical interfaces like re1 and wlan0, to your bridge&#xA;and that&amp;rsquo;s it. As all services inside network jail (the one with DHCP and DNS)&#xA;are listening on epair which is part of bridge, no other actions is needed.&lt;/p&gt;&#xA;&lt;h2 id=&#34;reggae&#34;&gt;Reggae&lt;/h2&gt;&#xA;&lt;p&gt;Reggae will initialize your network, services and network jail in dual stack&#xA;mode. You can disable IP version by setting &lt;code&gt;USE_IPV4=no&lt;/code&gt; or &lt;code&gt;USE_IPV6=no&lt;/code&gt;, but&#xA;it will issue an error if you disable both. It will also write /etc/pf.conf if&#xA;one doesn&amp;rsquo;t already exist and setup local_unbound, so you should be all set&#xA;after initializing Reggae the usual way.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD and YubiKey</title>
      <link>https://meka.rs/blog/2022/07/20/freebsd-and-yubikey/</link>
      <pubDate>Wed, 20 Jul 2022 10:27:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2022/07/20/freebsd-and-yubikey/</guid>
      <description>&lt;p&gt;Install and initialize the services as root:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pkg install ccid opensc pcsc-lite&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sysrc pcscd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;service pcscd restart&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Start ssh agent and add provider to it as user:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;eval &lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;ssh-agent&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ssh-add -s /usr/local/lib/opensc-pkcs11.so&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it, SSH should work with YubiKey now.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Linuxulator</title>
      <link>https://meka.rs/blog/2022/07/01/freebsd-linuxulator/</link>
      <pubDate>Fri, 01 Jul 2022 00:21:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2022/07/01/freebsd-linuxulator/</guid>
      <description>&lt;p&gt;As some applications are Linux-only, it is very handy to have linuxulator&#xA;available. In short, I just followed&#xA;&lt;a href=&#34;https://github.com/mrclksr/linux-browser-installer&#34;&gt;linux browser install&lt;/a&gt; and&#xA;added slack and viber with&#xA;&lt;a href=&#34;https://forums.freebsd.org/threads/linuxulator-how-to-install-brave-linux-app-on-freebsd-13-0.78879/&#34;&gt;pulseaudio setup&lt;/a&gt;.&#xA;Although pulseaudio setup contains linux browser install, it is the most&#xA;important part. Once the browser was installed I copied the scripts to make&#xA;slack and viber working. After download of .deb file, chroot to linux directory&#xA;and install it.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &amp;lt;slack&amp;gt;.deb /compat/ubuntu&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chroot /compat/ubuntu /bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dpkg -i &amp;lt;slack&amp;gt;.deb&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt-get install -f&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On host, script is needed in PATH so it can be executed just like a normal&#xA;application, so &lt;code&gt;/usr/bin/slack&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get_pa_sock_path&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  PA_SOCK_PATH&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;sockstat | awk -v me&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;whoami&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt; -F&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;[ \t]+&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;    $1 == me &amp;amp;&amp;amp; $2 == &amp;#34;pulseaudio&amp;#34; &amp;amp;&amp;amp; $6 ~ /native/ {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      print $6;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      exit 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;    }&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get_pa_sock_path&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt; -S &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$PA_SOCK_PATH&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; export PULSE_SERVER&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;unix:$PA_SOCK_PATH&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/compat/ubuntu/bin/slack $@&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, we need to create &lt;code&gt;/bin/slack&lt;/code&gt; inside ubuntu chroot:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/compat/ubuntu/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# chrome wrapper script from patovm04:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# https://forums.freebsd.org/threads/linuxulator-how-to-run-google-chrome-linux-binary-on-freebsd.77559/&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;export SLACK_PATH&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/usr/bin/slack&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;export SLACK_WRAPPER&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;readlink -f &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$0&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;export LD_LIBRARY_PATH&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/steam-utils/lib64/fakeudev&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;export LD_PRELOAD&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/steam-utils/lib64/webfix/webfix.so&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;export LIBGL_DRI3_DISABLE&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exec -a &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$0&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$SLACK_PATH&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; --no-sandbox --no-zygote --test-type --v&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$@&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Final change is to &lt;code&gt;/usr/share/applications/slack.desktop&lt;/code&gt; inside ubuntu chroot:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Desktop Entry&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Name&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;Slack&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;StartupWMClass&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;Slack&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Comment&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;Slack Desktop&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;GenericName&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;Slack Client &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; Linux&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Exec&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/bin/slack %U&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Icon&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/share/pixmaps/slack.png&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Type&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;Application&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;StartupNotify&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Categories&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;GNOME;GTK;Network;InstantMessaging;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;MimeType&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;x-scheme-handler/slack;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Note: Exec line is wrong by default for linuxulator environment. The&#xA;executable needs to be our script &lt;code&gt;/bin/slack&lt;/code&gt;, not the slack binary itself&#xA;&lt;code&gt;/usr/bin/slack&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The trick is to execute &lt;code&gt;pulseaudio --daemonize&lt;/code&gt; on FreeBSD host before&#xA;starting slack. I got audio and webcam working. Of course, viber setup is the&#xA;same.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Dual Stack Jails</title>
      <link>https://meka.rs/blog/2022/01/22/freebsd-dual-stack-jails/</link>
      <pubDate>Sat, 22 Jan 2022 09:35:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2022/01/22/freebsd-dual-stack-jails/</guid>
      <description>&lt;p&gt;There are 3 ways to have IPv6 in VNET jails that I&amp;rsquo;m going to describe. In terms&#xA;of IPv4, those would be:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;private address&lt;/li&gt;&#xA;&lt;li&gt;public address&lt;/li&gt;&#xA;&lt;li&gt;public address behind router&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Private addresses in IPv6 world are called &amp;ldquo;unique local&amp;rdquo;, and they start with&#xA;&amp;ldquo;fd&amp;rdquo; in hexadecimal notation. Please note that there are also site-local&#xA;addresses, but they are deprecated. Something like a MAC address is called &amp;ldquo;link&#xA;local address&amp;rdquo; and they start with &amp;ldquo;fe80&amp;rdquo; in hex. In this example, all addresses&#xA;starting with 2001 are global or in IPv4 notation, they are public. These are&#xA;not the only types of addresses, nor addresses starting with 2001 are the only&#xA;global ones. I&amp;rsquo;m just trying to keep it simple by narrowing it down to 3 types.&lt;/p&gt;&#xA;&lt;h2 id=&#34;jail-setup&#34;&gt;Jail Setup&lt;/h2&gt;&#xA;&lt;p&gt;As CBSD renames jail&amp;rsquo;s end of epair to eth0 writing rules/config is simplified.&#xA;In all jails the setup of /etc/rc.conf is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_eth0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 -ifdisabled accept_rtadv auto_linklocal&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;rtsold_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;CBSD will run DHCP client before running init, so that part is taken care of if&#xA;you choose REALDHCP as address assigning method.&lt;/p&gt;&#xA;&lt;h2 id=&#34;unique-local-addresses&#34;&gt;Unique Local Addresses&lt;/h2&gt;&#xA;&lt;p&gt;I use this setup for development as I don&amp;rsquo;t want everything I do to be public&#xA;all the time. The principles are the same as with IPv4: assign jails private&#xA;addresses and then NAT them to the world. The relevant portion of /etc/rc.conf&#xA;is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_re0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;DHCP&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_re0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 -ifdisabled auto_linklocal accept_rtadv&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_gateway_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_defaultrouter&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fe80::5a9c:fcff:fe10:6c2c%re0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;rtsold_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# CBSD&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_bridge0_name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;cbsd0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 172.16.0.254 netmask 255.255.255.0 description lagg0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0_alias0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 172.16.1.254 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 fd10:6c79:8ae5:8b91::1 -ifdisabled auto_linklocal&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As I use CBSD and Reggae, I like to create dedicated bridge interface for it&#xA;and rename it so it&amp;rsquo;s easier to tell what is what. I also have two IPv4 ranges:&#xA;one for DHCP assigned addresses and one for CBSD generated ones. For IPv6 I have&#xA;one address from the same range jails get their addresses. The configuration of&#xA;/etc/rtadvd.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cbsd0:addr&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd10:6c79:8ae5:8b91::&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For NAT /etc/pf.conf is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-md&#34; data-lang=&#34;md&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Macros and tables&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ext_if = &amp;#34;lagg0&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;table &amp;lt;cbsd&amp;gt; persist&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Options&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set block-policy drop&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set skip on lo0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Normalization&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scrub in all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# NAT&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rdr-anchor &amp;#34;cbsd/*&amp;#34; on $ext_if&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nat on $ext_if inet from &amp;lt;cbsd&amp;gt; to any -&amp;gt; ($ext_if)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nat on $ext_if inet6 from cbsd0:network to any -&amp;gt; ($ext_if:0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Quick rules&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;antispoof quick log for ($ext_if)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Rules&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;block in log on $ext_if&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass out&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto tcp to any port ssh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto { icmp, igmp, icmp6 }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There is a bit more than a bare minimum, but the important lines are those&#xA;starting with &amp;ldquo;nat&amp;rdquo;. First rule is for IPv4 and it will NAT for all addresses&#xA;CBSD/Reggae puts in &lt;cbsd&gt; table. Second rule is for IPv6 and it is important&#xA;to use $ext_if:0 not just $ext_if because it will otherwise try to NAT using&#xA;all IPv6 addresses. In this case it would use the proper address as well as&#xA;link-local one.&lt;/p&gt;&#xA;&lt;h2 id=&#34;global-unicast-address&#34;&gt;Global Unicast Address&lt;/h2&gt;&#xA;&lt;p&gt;This setup should be almost the same as the previous one. Keep in mind that in&#xA;the following setup re0 and cbsd0 must use same prefix, or in IPv4 terms: they&#xA;have to be in the same network. In practice, that means that both interfaces&#xA;must have IPv6 address which starts with &lt;code&gt;2001:aaaa:bbbb:cccc:&lt;/code&gt;. Equally&#xA;important is to not add re0 to cbsd0 bridge as that would make local DHCP server&#xA;running in a jail leak out through re0 towards the rest of the physical network.&lt;/p&gt;&#xA;&lt;p&gt;/etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_re0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;DHCP&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_re0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 -ifdisabled auto_linklocal accept_rtadv&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_gateway_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_defaultrouter&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fe80::5a9c:fcff:fe10:6c2c%re0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;rtsold_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# CBSD&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_bridge0_name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;cbsd0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 172.16.0.254 netmask 255.255.255.0 description lagg0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0_alias0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 172.16.1.254 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 2001:aaaa:bbbb:cccc::1 -ifdisabled auto_linklocal&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;/etc/rtadvd.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cbsd0:addr&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2001:aaaa:bbbb:cccc::&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;/etc/pf.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-md&#34; data-lang=&#34;md&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Macros and tables&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ext_if = &amp;#34;lagg0&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;table &amp;lt;cbsd&amp;gt; persist&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Options&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set block-policy drop&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set skip on lo0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Normalization&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scrub in all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# NAT&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rdr-anchor &amp;#34;cbsd/*&amp;#34; on $ext_if&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nat on $ext_if inet from &amp;lt;cbsd&amp;gt; to any -&amp;gt; ($ext_if)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Quick rules&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;antispoof quick log for ($ext_if)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Rules&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;block in log on $ext_if&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass out&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto tcp to any port ssh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto { icmp, igmp, icmp6 }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;global-unicast-address-behind-router&#34;&gt;Global Unicast Address Behind Router&lt;/h2&gt;&#xA;&lt;p&gt;This setup is mostly for the server behind a router. The idea is to put all&#xA;physical (in this case one) and virtual (in this case epair interfaces) into&#xA;the same bridge. Bridge acts like a switch, so the network will behave like we&#xA;somehow plugged all physical and virtual interfaces into the same switch.&#xA;In practice it means that DHCP and rtadv/rtsol packets will got to/from the&#xA;router, directly. As it is a server, all configuration is static, so there&amp;rsquo;s&#xA;no rtsold/rtadvd present.&lt;/p&gt;&#xA;&lt;p&gt;/etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_igb0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 192.168.111.201 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_igb0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 2001:aaaa:bbbb:cccc::4 -ifdisabled auto_linklocal&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_defaultrouter&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fe80::5a9c:fcff:fe10:6c2c%igb0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;defaultrouter&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;192.168.111.254&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# CBSD&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cloned_interfaces&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bridge0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_bridge0_name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;cbsd0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;description igb0 addm igb0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;/etc/pf.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-md&#34; data-lang=&#34;md&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Macros and tables&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ext_if = &amp;#34;igb0&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dhcp_ports = &amp;#34;{ bootps, bootpc }&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;table &amp;lt;cbsd&amp;gt; persist&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Options&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set block-policy drop&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set skip on lo0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Normalization&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scrub in all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Rules&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;block in log on $ext_if&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass out&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass in from &amp;lt;cbsd&amp;gt; to any&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass in on $ext_if from any to $ext_if:network&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto tcp to any port ssh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto { icmp, igmp, icmp6 }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass in proto udp from any to any port $dhcp_ports&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that in this setup NAT and antispoof are missing while it&amp;rsquo;s essential to&#xA;have &lt;code&gt;pass in on $ext_if from any to $ext_if:network&lt;/code&gt;. NAT is not needed as&#xA;router will do it in this setup and antispoof is not applicable here because it&#xA;practically says &amp;ldquo;any packet with source address from igb0 network coming from&#xA;interface other than igb0 should be blocked&amp;rdquo;. That&amp;rsquo;s the problem because VNET&#xA;jails will have epair interfaces using the same address range and antispoof&#xA;would block those packets as well because they physically pass through igb0 and&#xA;are visible. The extra &lt;code&gt;pass&lt;/code&gt; rule is for the same reason.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2022/01/15/freebsd-dual-stack-network/&#34;&gt;Previous&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Dual Stack Network</title>
      <link>https://meka.rs/blog/2022/01/15/freebsd-dual-stack-network/</link>
      <pubDate>Sat, 15 Jan 2022 22:55:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2022/01/15/freebsd-dual-stack-network/</guid>
      <description>&lt;p&gt;Idea is to build dual stack network, which means working IPv4 and IPv6. Support&#xA;on router and client side is needed for network to work without glitches. For&#xA;example, switching from ethernet to WiFi should be seamless. On top, as my ISP&#xA;is not providing IPv6, I&amp;rsquo;ll show you how tunnels like Hurricane Electric work,&#xA;which in layman terms means &amp;ldquo;how to have public IPv6 addresses on all my devices&#xA;although ISP doesn&amp;rsquo;t provide it&amp;rdquo;. If you have native IPv6 support from your&#xA;provider, that&amp;rsquo;s great and just use it, otherwise you can use&#xA;&lt;a href=&#34;https://tunnelbroker.net/&#34;&gt;Huricane Electric Tunnel Broker&lt;/a&gt; to setup IPv6.&lt;/p&gt;&#xA;&lt;h2 id=&#34;router&#34;&gt;Router&lt;/h2&gt;&#xA;&lt;p&gt;The following is the simplified picture of a network. There is a switch missing&#xA;and WiFi is just one line between laptop and router but it&amp;rsquo;s good enough for&#xA;explaining what will be configured. On the left of the router is IPv4 connection&#xA;that ISP provides, and on the left is IPv6 connection that HE tunnel provides.&#xA;There are few services to keep everyone happy, like DHCP server inside CBSD&#xA;based jail, Router Advertisment daemon (rtadvd) to &amp;ldquo;disperse&amp;rdquo; IPv6 addresses,&#xA;and so on.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-md&#34; data-lang=&#34;md&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;.------.   .--------.   .---------.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;| IPv4 |&amp;lt;-&amp;gt;| Router |&amp;lt;-&amp;gt;| HE IPv6 |&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;.______.   .________.   ._________.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;               /|\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              / | \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;             /  |  \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            /   |   \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;           /    |    \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          /     |     \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; .--------. .---------. .---------.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; | Laptop | | Seerver | | Desktop |&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; |________| |_________| |_________|&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There are are 3 ethernet ports on APU and one WiFi interface. One ethernet port&#xA;is used for connection to ISP, two remaining ports and WiFi are bridged into&#xA;one interface. There are few services on the router to make it work:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Router Advertisment (rtadvd)&lt;/li&gt;&#xA;&lt;li&gt;Host AP daemon (hostapd)&lt;/li&gt;&#xA;&lt;li&gt;DHCP in jail (isc-dhcpd)&lt;/li&gt;&#xA;&lt;li&gt;Unbound for DNS (local_unbound)&lt;/li&gt;&#xA;&lt;li&gt;Firewall (pf)&lt;/li&gt;&#xA;&lt;li&gt;PPP daemon based on netgraph (mpd5)&lt;/li&gt;&#xA;&lt;li&gt;Jail management (cbsd)&lt;/li&gt;&#xA;&lt;li&gt;Protection from ssh brute force (blacklistd)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;/etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Network&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cloned_interfaces&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bridge0 bridge1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_re0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 192.168.100.254 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_re1&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_re2&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_bridge0_name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;cbsd0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_bridge1_name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lan&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_lan&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addm re1 addm re2 addm wlan0 stp re1 stp re2 stp wlan0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_lan_alias0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 192.168.111.254 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_lan_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 2001:aaaa:bbbb:cccc::3 auto_linklocal -ifdisabled&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;wlans_ath0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlan0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_wlan0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 -ifdisabled&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;create_args_wlan0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlanmode hostap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_wlan0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;txpower 50 channel 149 up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;hostapd_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;rtadvd_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gateway_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_gateway_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;local_unbound_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;local_unbound_tls&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;NO&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# HE IPv6 tunnel&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gif_interfaces&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;gif0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gifconfig_gif0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;MyIPv4 HE-IPv4&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_gif0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 2001:aaaa:bbbb:cccc::2 2001:aaaa:bbbb:cccc::1 prefixlen 128&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_defaultrouter&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2001:aaaa:bbbb:cccc::1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Firewall&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;pflog_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;pf_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# CBSD&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 172.16.0.254 netmask 255.255.255.0 description ng0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_cbsd0_alias0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 172.16.1.254 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cbsd_workdir&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/usr/cbsd&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cbsdrsyncd_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cbsdrsyncd_flags&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;--config=/usr/cbsd/etc/rsyncd.conf&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cbsdd_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;rcshutdown_timeout&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;900&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The CBSD portion is present on all machines as I use it to manage my jails, but&#xA;I won&amp;rsquo;t repeat it in every configuration.&lt;/p&gt;&#xA;&lt;p&gt;To turn my WiFi into AP I use hostapd with the following configuration.&lt;/p&gt;&#xA;&lt;p&gt;/etc/hostapd.conf&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;interface&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;wlan0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;debug&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ctrl_interface&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/var/run/hostapd&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ctrl_interface_group&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;wheel&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ssid&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;myssid&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;wpa&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;wpa_passphrase&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Secrit&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;wpa_key_mgmt&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;WPA-PSK&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;wpa_pairwise&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;CCMP&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As my ISP uses PPPoE I have to use mpd5. It performs much faster than PPP&#xA;included in base. I could get about 200Mbit/s with the one from base, while I&#xA;have full 400Mbit/s with mpd5.&lt;/p&gt;&#xA;&lt;p&gt;/usr/local/etc/mpd5/mpd.conf&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-rst&#34; data-lang=&#34;rst&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;default:&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  load mts&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mts:&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  create bundle static B1&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set iface route default&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set iface enable tcpmssfix&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set ipcp ranges 0.0.0.0/0 0.0.0.0/0&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  create link static L1 pppoe&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set link action bundle B1&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set auth authname isp_username@open.telekom.rs&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set auth password isp_password&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set link max-redial 0&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set link keep-alive 10 60&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set pppoe iface re0&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set pppoe service &amp;#34;&amp;#34;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  open&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;/etc/pf.conf&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-md&#34; data-lang=&#34;md&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Macros and tables&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ext_if = &amp;#34;ng0&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;modem_if = &amp;#34;re0&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;modem = 192.168.100.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Options&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set block-policy drop&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set skip on lo0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Normalization&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scrub in all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# NAT&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nat on $ext_if inet from lan:network to any -&amp;gt; ($ext_if)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nat on $modem_if inet from lan:network to any -&amp;gt; ($modem_if)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Quick rules&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;antispoof quick for ($ext_if)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;anchor &amp;#34;blacklistd/*&amp;#34; in on $ext_if&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# Rules&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;block in log on $ext_if&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass out&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto tcp to any port ssh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto { icmp, igmp, icmp6 }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The default prefix is 64, so the configuration is short. Note that you can use&#xA;two forms to assign value to an attribute: attribute#value which is the same as&#xA;attribute=&amp;ldquo;value&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;/etc/rtadvd.conf&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-md&#34; data-lang=&#34;md&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lan:addr=&amp;#34;2001:aaaa:bbbb:cccc::&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In jail DHCP for IPv4 is running with the following configuration in&#xA;/usr/local/etc/dhcpd.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-md&#34; data-lang=&#34;md&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;server-identifier my.domain.tld;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;authoritative;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;log-facility local7;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;omapi-port 7911;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;subnet 172.16.0.0 netmask 255.255.255.0 {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  option domain-name &amp;#34;my.domain.tld&amp;#34;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  option domain-name-servers 172.16.0.254;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  range 172.16.0.1 172.16.0.200;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  option routers 172.16.0.254;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  option broadcast-address 172.16.0.255;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  default-lease-time 3600;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  max-lease-time 7200;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  on commit {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    set clientIP = binary-to-ascii(10, 8, &amp;#34;.&amp;#34;, leased-address);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    set clientHost = pick-first-value(option fqdn.hostname, option host-name, &amp;#34;&amp;#34;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    execute(&amp;#34;/usr/local/bin/dhcpd-hook.sh&amp;#34;, &amp;#34;add&amp;#34;, clientIP, clientHost, &amp;#34;my.domain.tld&amp;#34;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  on release {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    set clientIP = binary-to-ascii(10, 8, &amp;#34;.&amp;#34;, leased-address);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    set clientHost = pick-first-value(option fqdn.hostname, option host-name, &amp;#34;&amp;#34;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    execute(&amp;#34;/usr/local/bin/dhcpd-hook.sh&amp;#34;, &amp;#34;delete&amp;#34;, clientIP, clientHost, &amp;#34;my.domain.tld&amp;#34;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  on expiry {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    set clientIP = binary-to-ascii(10, 8, &amp;#34;.&amp;#34;, leased-address);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    set clientHost = pick-first-value(option fqdn.hostname, option host-name, &amp;#34;&amp;#34;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    execute(&amp;#34;/usr/local/bin/dhcpd-hook.sh&amp;#34;, &amp;#34;delete&amp;#34;, clientIP, clientHost, &amp;#34;my.domain.tld&amp;#34;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The configuration could be much smaller without hooks, but this way you have&#xA;enough information how I register jails in DNS. This part will be detailed on&#xA;&lt;a href=&#34;cbsd.io&#34;&gt;cbsd.io&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;laptop&#34;&gt;Laptop&lt;/h2&gt;&#xA;&lt;p&gt;It&amp;rsquo;s important to set wlan0 MAC address to be the same as your ethernet. In my&#xA;case it is em0. For some reason, rtsold which comes with the FreeBSD base&#xA;doesn&amp;rsquo;t work stable and my current workaround is to add &lt;code&gt;ipv6_defaultrouter&lt;/code&gt;.&#xA;It does kinda defeat the purpose of software called &amp;ldquo;router advertisement&amp;rdquo;, but&#xA;until &lt;a href=&#34;https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261129&#34;&gt;this bug&lt;/a&gt; is&#xA;resolved, it is good enough for me, as I have small number of machines. You&#xA;might think I could use dhcpcd for IPv4 and IPv6, but there&amp;rsquo;s a problem with&#xA;that: no matter how I configure jails, they just can&amp;rsquo;t get IPv6 when I&amp;rsquo;m using&#xA;dhcpcd on the host. More on that in a later post.&lt;/p&gt;&#xA;&lt;p&gt;/etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Network&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cloned_interfaces&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lagg0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;wlans_iwn0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlan0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_wlan0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ether f0:de:bb:aa:c2:2a WPA up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_em0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;create_args_wlan0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;country US regdomain FCC&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_lagg0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;laggproto failover laggport em0 laggport wlan0 DHCP&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_lagg0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 -ifdisabled accept_rtadv auto_linklocal&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gateway_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_gateway_enable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_defaultrouter&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2001:aaaa:bbbb:cccc::3&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id=&#34;server&#34;&gt;Server&lt;/h1&gt;&#xA;&lt;p&gt;On server I like to set static IPv4 and IPv6 addresses.&lt;/p&gt;&#xA;&lt;p&gt;/etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_igb0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 192.168.111.201 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ifconfig_igb0_ipv6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 2001:aaaa:bbbb:cccc::4 -ifdisabled auto_linklocal&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ipv6_defaultrouter&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fe80::5a9c:fcff:fe10:6c2c%igb0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;defaultrouter&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;192.168.111.254&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Not that &amp;ldquo;%igb0&amp;rdquo; means something like &amp;ldquo;search for this link-local address on&#xA;igb0 interface&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2022/01/22/freebsd-dual-stack-jails/&#34;&gt;Next&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD and IPv6 Tunnel</title>
      <link>https://meka.rs/blog/2021/12/19/freebsd-and-ipv6-tunnel/</link>
      <pubDate>Sun, 19 Dec 2021 21:48:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2021/12/19/freebsd-and-ipv6-tunnel/</guid>
      <description>&lt;p&gt;Huricane Electric is one of IPv6 tunnel providers and this post is specifically&#xA;about setting up FreeBSD router with a tunnel and the configuration for IPv6&#xA;autoconfig caller Router Advertisment (RS, on the router) and Router Solisticion&#xA;(RS, on desktop or laptop). If you know how DHCP for IPv4 works, you will find&#xA;it a bit weird how IPv6 works. First, in IPv6 world what is called DHCPv6 is&#xA;closer to what DHCPv4 does than RA/RS. Here, RA/RS setup will be described. The&#xA;end result is that router and clients have access to IPv4 and IPv6 at the same&#xA;time, or in how it&amp;rsquo;s called &amp;ldquo;Dual Stack&amp;rdquo;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;router&#34;&gt;Router&lt;/h3&gt;&#xA;&lt;p&gt;Although Huricane Electric will give you exact commands/config for operating&#xA;system of your choice, I&amp;rsquo;m showing here whole configuration for completeness.&#xA;The address range &lt;code&gt;fd12:c09a:85be:4851::&lt;/code&gt; is just a dummy one, you should use&#xA;the one HE provides.&lt;/p&gt;&#xA;&lt;p&gt;In /etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_re1&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_re2&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_bridge1_name&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lan&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_lan&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addm re1 addm re2 addm wlan0 stp re1 stp re2 stp wlan0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_lan_alias0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 192.168.0.1 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_lan_ipv6&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 fd12:c09a:85be:4851::3 auto_linklocal -ifdisabled&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# HE IPv6 tunnel&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gif_interfaces&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;gif0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gifconfig_gif0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;lt;MyIPv4&amp;gt; &amp;lt;HEIPv4&amp;gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_gif0_ipv6&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 fd12:c09a:85be:4851::2 fd12:c09a:85be:4851::1 prefixlen 128&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ipv6_defaultrouter&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd12:c09a:85be:4851::1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In /etc/rtadvd.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lan:&lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  :addrs#1&lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  :addr&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd12:c09a:85be:4851::&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  :prefixlen#64&lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  :tc&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ether&lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  :rltime#0&lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  :rdnss&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd12:c09a:85be:4851::3&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  :dnssl&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;meka.rs&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In /etc/rc.conf.d/rtadvd:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rtadvd_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rtadvd_interfaces&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lan&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;desktoplaptop&#34;&gt;Desktop/Laptop&lt;/h3&gt;&#xA;&lt;p&gt;In /etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cloned_interfaces&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lagg0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wlans_iwn0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlan0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_wlan0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ether f0:de:f1:64:2c:3b WPA up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_em0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create_args_wlan0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;country US regdomain FCC&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_lagg0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;laggproto failover laggport em0 laggport wlan0 DHCP&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_lagg0_ipv6&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet6 accept_rtadv -ifdisabled&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ipv6_defaultrouter&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd12:c09a:85be:4851::3&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rtsold_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Configuration is based on&#xA;&lt;a href=&#34;https://meka.rs/blog/2016/12/24/freebsd-wifi-and-ethernet-bridging-and-aggregation/&#34;&gt;Router and Laptop on FreeBSD&lt;/a&gt;.&#xA;It can be simplified if you use only wlan, which probably means you don&amp;rsquo;t need&#xA;bridge at all hence you should configure wlan0, for example.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Audio</title>
      <link>https://meka.rs/blog/2021/10/12/freebsd-audio/</link>
      <pubDate>Tue, 12 Oct 2021 10:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2021/10/12/freebsd-audio/</guid>
      <description>&lt;p&gt;I started using FreeBSD in 2016 as a dual-boot with Linux. The reason was that&#xA;at the time Linux provided no support for real-time threads and preemptive&#xA;scheduling but did provide a wider choice of audio applications. Today, as the&#xA;FreeBSD audio ecosystem improved a lot, I am a happy single-OS user.&lt;/p&gt;&#xA;&lt;p&gt;You may ask yourself &amp;ldquo;why is being fast so important to audio&amp;rdquo; and the answer&#xA;is &amp;ldquo;it isn&amp;rsquo;t most of the time&amp;rdquo;. To be more precise, from a listener&amp;rsquo;s&#xA;perspective, it is the same if sound is late 5 seconds or 1 second, as long as&#xA;the period of &amp;ldquo;being late&amp;rdquo; is the same for every sample up to a few&#xA;microseconds. If samples have variable latencies, the original sound will be&#xA;distorted by samples swinging around their precise time. So for playback, it&amp;rsquo;s&#xA;not important to be fast, it&amp;rsquo;s important to be right on time for every sample&#xA;to avoid distortions caused by samples being too early or too late, which is&#xA;commonly called &amp;ldquo;jitter&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, a musician playing through a FreeBSD machine is interested&#xA;in both: speed of processing and precision. We need to have in mind that all&#xA;samples first have to be processed by hardware, then comes the driver and in&#xA;the end user space programs. When every device&amp;rsquo;s output is late compared to&#xA;input, that is called latency. If latency is 5ms and lower, it is impossible&#xA;for most people to tell there&amp;rsquo;s any latency at all. Latency is important to&#xA;musicians because of the feedback: hearing a sound that has 50ms latency can&#xA;confuse the musician to a point where they can not play any more.&lt;/p&gt;&#xA;&lt;p&gt;FreeBSD at the time had really nice real-time support but not so nice audio&#xA;ecosystem and almost non-existing MIDI one. You must be wondering why I&#xA;switched to something half-baked when Linux at the same time had awesome&#xA;audio/MIDI support. It&amp;rsquo;s those jitters.&lt;/p&gt;&#xA;&lt;p&gt;Although I had every program I could wish for on Linux, FreeBSD simply didn&amp;rsquo;t&#xA;have jitters, and it matters a lot! Sometimes jitters would cause sudden and&#xA;loud pops and that made studio recording more challenging. So having FreeBSD&#xA;working perfectly, but unfortunately with not so much app support, was better&#xA;for me than having all the apps I want and no way of being sure the sound will&#xA;be recorded properly.&lt;/p&gt;&#xA;&lt;p&gt;Today we have a different situation thanks to Hans Peter Selasky who wrote&#xA;cuse, virtual_oss, USB stack and snd_uaudio and Yuri who ported around 1500&#xA;applications to FreeBSD, among which is a huge number of audio/MIDI apps. To be&#xA;honest, virtual_oss existed in 2016, but it wasn&amp;rsquo;t as versatile and stable as&#xA;today. The reason why anyone would want virtual_oss is to make audio routing&#xA;easy by having a virtual sound card which knows how to route the signal while&#xA;user space applications are unaware of it and they just use FreeBSD sound(4)&#xA;API. There are numerous other features of virtual_oss that can come handy like&#xA;mixing, compressing and EQ in user space, but audio routing and&#xA;splitting/merging one card to many virtual ones or combining input and output&#xA;from different devices is the most common use case, like having bluetooth&#xA;headphones and USB microphone, so virtual_oss is required more and more outside&#xA;of recording studio and high-end sound setups.&lt;/p&gt;&#xA;&lt;p&gt;One sound system must contain an API to work with audio, MIDI and mixer. Open&#xA;Sound System (or OSS for short) on FreeBSD is no exception to this rule, so&#xA;there are 3 most common devices for every API: /dev/dsp, /dev/midi and&#xA;/dev/mixer. The most basic usage for /dev/dsp is to open(2) it, use ioctl(2) to&#xA;configure sample rate and format and then use read(2) and write(2) for&#xA;recording and playback. It is somewhat similar for /dev/midi, but /dev/mixer is&#xA;all about control and no samples, so it mostly uses ioctl(2) to operate. As&#xA;every system needs metadata, /dev/sndstat is used for OSS. If you &lt;code&gt;cat /dev/sndstat&lt;/code&gt;, you can find some information about your DSP and PCM devices.&#xA;You can use &lt;code&gt;sysctl hw.snd.verbose=2&lt;/code&gt; to get even more information out of&#xA;/dev/sndstat. Parsing this file as text is the only way to get the list of your&#xA;sound devices that works across multiple FreeBSD versions. Ka Ho Ng used this&#xA;technique in patch for cubeb, which is a sound library used by Mozilla, hence&#xA;adding OSS and virtual_oss support to Firefox and other products by Mozilla.&#xA;Today Ka Ho Ng is FreeBSD developer who implemented nvlist(9) based API to&#xA;enumerate devices, or in simple terms: list hardware and virtual sound devices&#xA;using nice API.&lt;/p&gt;&#xA;&lt;p&gt;User space applications and libraries are growing and apps that I would like to&#xA;mention that have been ported to FreeBSD are Ardour, Muse Sequencer, Zrythm,&#xA;Drumgizmo, EQ10Q, Calf and Invada plugins. I use most of those in my studio on&#xA;a regular basis and I have to admit I&amp;rsquo;m impressed how stable they work given&#xA;that most developers did not develop with FreeBSD in mind.&lt;/p&gt;&#xA;&lt;p&gt;Today in a studio, snd_uaudio and ports/packages will cover 99% of everyone&amp;rsquo;s&#xA;needs. Few years back I talked to Benedict Reuschiling and he said &amp;ldquo;we never&#xA;advocated FreeBSD for audio before&amp;rdquo;, so I&amp;rsquo;m sure everyone in the community is&#xA;happy with advancements made in just a few years. I keep mentioning studio&#xA;setups as they are more complex and demanding, but what about laptops and&#xA;desktops whose sole purpose is not audio? That&amp;rsquo;s the beauty of FreeBSD audio&#xA;and virtual_oss: if it works for complex setup, it works even better for simple&#xA;one. All sample rate and format is taken care of per application while&#xA;virtual_oss itself knows how to use real-time threads. Ideally, all that is&#xA;needed is OSS support in applications.&lt;/p&gt;&#xA;&lt;p&gt;For FreeBSD audio and DSP developers the situation is becoming increasingly&#xA;better through newer APIs and more convenient development environments. For&#xA;example, it is already possible to do all your development in jail if that jail&#xA;has access to proper /dev/dspN. To achieve that following /etc/devfs.rules can&#xA;be used:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;audio&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;6&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add include $devfsrules_hide_all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add include $devfsrules_unhide_basic&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add include $devfsrules_unhide_login&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add path &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;dsp*&amp;#39;&lt;/span&gt; unhide mode &lt;span style=&#34;color:#ae81ff&#34;&gt;0666&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add path &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;vdsp*&amp;#39;&lt;/span&gt; unhide mode &lt;span style=&#34;color:#ae81ff&#34;&gt;0666&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add path &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;*midi*&amp;#39;&lt;/span&gt; unhide mode &lt;span style=&#34;color:#ae81ff&#34;&gt;0666&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add path &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;mixer*&amp;#39;&lt;/span&gt; unhide mode &lt;span style=&#34;color:#ae81ff&#34;&gt;0666&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add path &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;sndstat&amp;#39;&lt;/span&gt; unhide mode &lt;span style=&#34;color:#ae81ff&#34;&gt;0666&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That is not new for FreeBSD, but it does bring one interesting use case:&#xA;running tests inside jail. To do just that maybe it means you would hear weird&#xA;sounds on your speakers when all you wanted is an end-to-end test of your audio&#xA;application. Virtual_oss has different backends where hardware DSP is just one&#xA;of them. Another example of backend is dummy, which allows virtual_oss to run&#xA;without connection to any real hardware. To do that you can configure&#xA;/etc/rc.conf in the following way:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;virtual_oss_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;virtual_oss_configs&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dsp dummy&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;virtual_oss_dsp&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;-T /dev/sndstat -S -i 8 -C 18 -c 18 -r 48000 -b 32 -s 768 -f /dev/dsp0 -c 2 -w dsp.wav -d dsp -t dsp.ctl&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;virtual_oss_dummy&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;-T /dev/sndstat -S -i 8 -C 2 -c 2 -r 48000 -b 32 -s 768 -f /dev/null -c 2 -w vdsp.wav -d vdsp -t vdsp.ctl&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There are two configs that are fairly similar. For dsp, one device with 18&#xA;in/out channels is configured as /dev/dsp which have 2 channels. Also, the 2&#xA;channel device is set as /dev/dsp which is the default OSS device, so&#xA;applications which do not handle non-stereo cards will have no problems.&lt;/p&gt;&#xA;&lt;p&gt;For those apps that know how to list sound devices and use channels properly&#xA;/dev/vdsp is at their disposal. One unusual device is /dev/dsp.wav which you&#xA;can use for recording just by using &lt;code&gt;cat /dev/dsp.wav &amp;gt;recording.wav&lt;/code&gt;. To&#xA;control virtual_oss at runtime you can use &lt;code&gt;virtual_oss_ctl -f /dev/vdsp.ctl&lt;/code&gt;.&#xA;The previous example creates one .ctl device file per virtual_oss&#xA;configuration. Second configuration is a dummy and it uses /dev/null as a&#xA;hardware device to achieve most of what dsp config is doing, only simpler. It&#xA;creates only one device and that is /dev/vdsp.dummy which is stereo only. It&#xA;uses the same resampling (-S), real-time priority (-i 8), sample rate (-r&#xA;48000), bit rate (-b 32) and buffer size (-s 768) as dsp config while creating&#xA;similar .wav and .ctl devices.&lt;/p&gt;&#xA;&lt;p&gt;Now you can use /dev/dsp and /dev/vdsp inside or outside of jail to have either&#xA;a real hardware device or purely virtual one. All of those flags can be changed&#xA;at runtime with &lt;code&gt;virtual_oss_cmd&lt;/code&gt;. You can switch to &amp;ldquo;studio mode&amp;rdquo; as I call it&#xA;(smaller buffer size), do your recording/production and then switch to &amp;ldquo;desktop&#xA;mode&amp;rdquo; with larger buffer. Do note that virtual_oss can change buffer size on&#xA;start as most applications using OSS API will read desired buffer size once, on&#xA;initialization. Almost all flags supported by virtual_oss are also changeable&#xA;during runtime via virtual_oss_cmd. Developer or not, all people sometimes need&#xA;to switch their default input/output device so it is really handy in everyday&#xA;use, too. Now if you need ALSA or SNDIO development inside that same jail, it&amp;rsquo;s&#xA;just a matter of installing ports/packages and altering configuration to your&#xA;liking (default sound device, for example).&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s see what studio means in technical terms. Core of every studio is a mixer&#xA;and today&amp;rsquo;s mixers are usually also USB audio interfaces. For live performance&#xA;and monitoring, mixer is where it all happens. For recording and&#xA;(post)processing, the computer is doing it all. The description of the mixer&#xA;and operating one is dependent on the model so I won&amp;rsquo;t cover it here, but the&#xA;recording part is where FreeBSD shines.&lt;/p&gt;&#xA;&lt;p&gt;Besides having architecture that allows for real time threads and less jitters&#xA;(to be honest, using it for years I never saw any jitters at all!), it is&#xA;really nice having storage feature like ZFS to make sure your recordings are&#xA;safe. As with a big number of channels user space mixing and resampling is more&#xA;efficient then the one in the kernel so virtual_oss and OSS provide an ideal&#xA;combination. The core of every recording system is Digital Audio Workstation,&#xA;or DAW for short. In my studio, the DAW of choice is Ardour. It is mature and&#xA;stable and has great integration with JACK. For the set of effects I use Calf,&#xA;Invada and EQ10Q plugins as they provide good implementations of reverbs,&#xA;choruses, equalizers and flangers. My choice of drum sampler is Drumgizmo, but&#xA;it&amp;rsquo;s no wonder being a contributor to the project and port maintainer. Drumgizmo&#xA;is unique in a way that it records and plays samples (drum hits). The idea is to&#xA;replicate a studio recording as close as possible, so its principle is to have,&#xA;for example, a snare drum recorded with all 16 microphones. Although the&#xA;microphone in the kick drum will record the snare hit very faintly, having all&#xA;16 microphones record every hit makes the recording sound like a live studio.&#xA;Recording with a non-main microphone is called bleeding and is controllable in&#xA;Drumgizmo. Bleed and humanizer (randomizing hit strength, timing and position&#xA;on the pad/cymbal) make recording sound very natural. I personally use hardware&#xA;guitar/bass/vocal processor and synth, so I&amp;rsquo;m not experienced with software&#xA;alternatives, but I do know some of my friends really like Geon Kick and&#xA;Yoshimi for electronic music and Guitarix for guitar based music.&lt;/p&gt;&#xA;&lt;p&gt;For me the hardware mixer is doing most of the audio routing and monitoring,&#xA;but for USB audio interfaces that are not stand-alone, software has to do it.&#xA;Usually, one would do routing based on JACK and it is a valid option, but with&#xA;virtual_oss there&amp;rsquo;s another one. Let me give you an example. In the past I used&#xA;USB audio interfaces that are not stand-alone and what I constantly have as a&#xA;requirement that the first input (my guitar) is routed to outputs 9 and 10 (my&#xA;guitar processor). To achieve this, you can add &amp;ldquo;-M i,0,8,0,0,0 -M i,0,9,0,0,0&amp;rdquo;&#xA;to virtual_oss options. Note that channel numbers start with zero. There are&#xA;also interfaces that have separate main output for speakers and headphones. For&#xA;monitoring it is not so great so if you&amp;rsquo;d like to mirror everything that goes&#xA;to speakers (output 1 and 2) to headphones (outputs 7 and 8), you can use &amp;ldquo;-M&#xA;o,0,6,0,0,0 -M o,1,7,0,0,0&amp;rdquo;. The options virtual_oss alone supports give you&#xA;the ability to have EQ, compressor, loop back, HTTP streaming and more, but it&#xA;would be too much for this article to describe it all. Man page contains all&#xA;options and examples of how you can achieve different setups.&lt;/p&gt;&#xA;&lt;p&gt;If you think there&amp;rsquo;s not much that FreeBSD brings to the table in the audio&#xA;world, you&amp;rsquo;re right and wrong at the same time. What the operating system can&#xA;do in terms of audio is provide real time support, efficient resampling and&#xA;good choice of open source DAWs and plugins. But that is true only if you use&#xA;that computer exclusively for music.&lt;/p&gt;&#xA;&lt;p&gt;I believe that general purpose operating systems must be general enough to be&#xA;the choice for any task and that is where FreeBSD shines: with jails,&#xA;firewalls, virtual switches, ZFS, packages that are up to date, security&#xA;updates and all the person would expect from an operating system. FreeBSD&#xA;provides it all while being great for music, so with it power is literally&#xA;under your fingertips.&lt;/p&gt;&#xA;&lt;p&gt;If you think about it, MacOS and Windows are mostly desktop operating systems,&#xA;Linux lacking proper ZFS support/integration hardly makes it good for storage,&#xA;Solaris is too huge for a router and other BSDs probably don&amp;rsquo;t have the number&#xA;of audio ports that FreeBSD has. So to put it short, FreeBSD shines at not&#xA;needing anything particular: no special care needed wherever you run it and&#xA;whatever combination of apps you choose.&lt;/p&gt;&#xA;&lt;p&gt;Call me stubborn, but having one operating system on a router, server, desktop,&#xA;laptop and RPi is a big deal for me, especially if it solves all my problems on&#xA;any hardware I put it on. For reference, my desktop machine in the studio is a&#xA;12 year old i5 PC with 8GB of RAM which I also use for Python/React/C/C++&#xA;development and most of that development is in jails.&lt;/p&gt;&#xA;&lt;p&gt;What I&amp;rsquo;m trying to say is that FreeBSD gives you means to run literally&#xA;everything on one machine while not sacrificing any efficiency.&lt;/p&gt;&#xA;&lt;p&gt;So to put it really short, FreeBSD is great for audio studio not because it&#xA;brings some unseen features, but because it does not collide with anything on&#xA;the system while providing real time support, so the feeling is &amp;ldquo;this is just a&#xA;normal desktop with audio apps&amp;rdquo;. Maybe it doesn&amp;rsquo;t sound too good, but just&#xA;having &amp;ldquo;normal desktop&amp;rdquo; and &amp;ldquo;real time support&amp;rdquo; in one operating system is far&#xA;from usual, and FreeBSD might be the only operating system not explicitly built&#xA;for real time but able to provide that.&lt;/p&gt;&#xA;&lt;p&gt;I have to say, the best quality of FreeBSD is our community. It is so easy to&#xA;get to the right answer with the mailing list like multimedia@ and #freebsd&#xA;channel on libera.chat. My personal experience is that the FreeBSD community is&#xA;open and approachable. There are no distro-specific questions, the handbook is&#xA;for FreeBSD and not just one of the FreeBSD forks/distributions. Developers are&#xA;approachable by people who often are not sure what they need to ask in the&#xA;first place. In one word, getting the proper information feels really easy and&#xA;proper audio setup in a studio is a breeze using this operating system.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note: when using jack configure it to use the real hardware. That means /dev/dsp1&#xA;that is OSS device (in my case with 18 channels) instead of /dev/dsp which is&#xA;virtual_oss device (in my case with 2 channels).&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The work from Ka Ho Ng is in base and jack2 port is available&#xA;(&lt;a href=&#34;https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251125&#34;&gt;bugzilla 251125&lt;/a&gt;)&#xA;mostly thanks to Florian Walpen. My review (&lt;a href=&#34;https://reviews.freebsd.org/D30149&#34;&gt;D30149&lt;/a&gt;)&#xA;added a simple example of OSS development and is just the first of OSS examples&#xA;to follow. One oftenly requested improvement to the handbook is the section&#xA;of sound and audio.  Alfonso Siciliano has great experience with mixer API&#xA;and has contributed mixertui port and has offered help in understanding that&#xA;code for future documentation purposes. Maolan is DAW (digital audio workstation)&#xA;which is FreeBSD specific for now that I&amp;rsquo;m writing as an attempt to learn DSP&#xA;and MIDI development and is the code where most of my experience/documentation&#xA;comes from. While I do appreciate software like jack, I strongly believe that&#xA;FreeBSD should have a DAW with native API supported out of the box, so I&amp;rsquo;m hoping&#xA;that Maolan will improve FreeBSD based studios once it&amp;rsquo;s at least beta. Also,&#xA;making APIs nicer to work with and documentation/examples better is what we as&#xA;FreeBSD community must do if we want developers on other operating systems to be&#xA;more portable and FreeBSD friendly. Over the past few years the community showed&#xA;more interest in that area than I could ever imagine, so I am really grateful&#xA;for being able to use a 12 year old desktop for everything including studio&#xA;recording, web conferencing and development with nothing but FreeBSD and&#xA;ports/packages it provides and no extra repositories.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Ne mogu vise da ćutim</title>
      <link>https://meka.rs/blog/2021/05/02/ne-mogu-vise-da-%C4%87utim/</link>
      <pubDate>Sun, 02 May 2021 16:30:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2021/05/02/ne-mogu-vise-da-%C4%87utim/</guid>
      <description>&lt;p&gt;Ne pišem na srpskom iz prostog razloga: želim da me što više ljudi razume.&#xA;Međutim, ono što me tišti su neki ljudi odavde i ako ikada nabasaju na ovaj&#xA;post želim da ga dobro razumeju. Pošto nemam plan pisanja, možda će biti o&#xA;jednoj, možda o više osoba, ali svakako želim da budem iskren sa sobom i sa&#xA;drugima šta ja o tim osobama mislim i zašto to mislim. Razlog zašto pišem tek&#xA;sada posle godina problema sa tim osobama je što sam mislio da je OK oprostiti,&#xA;ali psiha me je dovela do grčenja mišića (da budem precizan, grče mi se listovi)&#xA;te ne vidim drugi izlaz nego da to pustim iz sebe. Pa da počnem &amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;Skoro sve osobe o kojima bih ovde želeo da pišem su profesori. To je tužno.&#xA;Samo kad pomislim koga mi kao društvo puštamo da se šeta među decom/omladinom&#xA;je bolesno, u najmanju ruku. Ali sada ne želim da pričam o društvu, želim da&#xA;pričam o jednoj specifičnoj osobi. Ta osoba je&#xA;&lt;a href=&#34;https://perun.pmf.uns.ac.rs/wiki/mirjana-ivanovic&#34;&gt;Mirjana Ivanović&lt;/a&gt;. Ukratko,&#xA;žena je glupa i bezobrazna i izdržati fakultet sa njom je bilo katastrofalno.&#xA;Ako obratite pažnju na temu njenog magistarskog (što je ujedno i predmet koji&#xA;je predavala i to očajno) je konstrukcija kompajlera. Postoje 2 razloga zašto&#xA;mi nije ogadila taj predmet: skripta iz koje smo učili nije njena i ja sam bio&#xA;očaran time kako kompajler radi. Za one koji nisu toliko sreće imali da ih&#xA;kompajleri toliko privlače, Mira je bez sumnje ubila makar i tračak nade u tim&#xA;ljudima da ona priča nešto pametno. Iz tog predmeta mi je dala 9 jer &amp;ldquo;nije to&#xA;to&amp;rdquo;. Zapravo, pre nego što mi je ponudila 9 bilo je par sranja koje je&#xA;napravila. Prvo mi je postavila pitanje koje ne postoji u skripti (iz koje ona&#xA;predaje i podsećam, na predmetu koji je magistrirala). Drugo, dok sam pričao&#xA;na tabli šta znam, u jednom momentu sam stao jer je pričala sa kolegom koji je&#xA;bio na tabli pre mene. Kako sam pomislio da me ne čuje i ne prati, odlučio sam&#xA;da sačekam, na šta je ona rekla &amp;ldquo;žene mogu da rade 3 stvari u isto vreme, a ja&#xA;evo slušam vas, slušam kolegu i upisujem mu ocenu&amp;rdquo;. Koje proseravanje, nisam&#xA;mogao da poverujem, jer ako neko priča nešto na pola metra od vas, a neko drugi&#xA;na 5 metara, vi onog drugog ne čujete zbog decibela ne zbog intelekta. Ne znam&#xA;šta mi je bilo, ali ja sam u tom momentu počeo da se smejem ko budala, jer taj&#xA;komentar drugo ništa nije ni zaslužio. Kad me je pitala šta je smešno rekao sam&#xA;da njen muž kad nam predaje neku baš tešku lekciju kaže &amp;ldquo;ova je baš muška&amp;rdquo;.&#xA;Možda ćete pomisliti da nisam baš morao tako da reagujem, ali em sam rekao&#xA;apslutnu istinu, em je ta moja izjava usledila nakon jedno 6 godina njenog&#xA;izdrkavanja. Te naredi asistentu da poobara studente tako da nema više od 5oro&#xA;na ispitu, te moram da se raspravljam sa njom da &amp;ldquo;jne&amp;rdquo; u asembleru znači &amp;ldquo;jump&#xA;if not equal&amp;rdquo; jer kako je ona objasnila, &amp;ldquo;jne&amp;rdquo; je suprotno od onoga što jeste,&#xA;te imamo ceo semestar predavanje o Modula-2 (jebem ti kompajler i koji izabraše,&#xA;tuljani glupi) na kome saznamo da ništa od toga neće biti na ispitu, nego da&#xA;ćemo odrađivati neke časove (odrađivanje na fakultetu, eeeee bre!) na kojima će&#xA;biti zadaci za ispit. Tih časova je bilo 2. Slovima: dva!!! Onda nam je&#xA;objašnjavala kako treba čovek da se požrtvuje za firmu i ako je tvom detetu&#xA;rođendan da treba da ga iskuliraš ako firmi treba prekovremeno. Ne samo to,&#xA;nego je godinu dana pre toga pričala kako sa profesorom koji piše raspored su&#xA;se ona i muž dogovorili da je raspored takav da uvek jedan od roditelja može&#xA;biti sa decom. Ljudi su pisali radove koje je ona kao zadnja kučka predavala&#xA;kao svoje ne potpisavši nikog od tih ljudi. To je jedna glupa, licemerna,&#xA;nadasve bezobrazna i plitka osoba. Sada kada mi ne predaješ više ništa, Miro&#xA;majku i oca krvave ti jebem za ona obaranja &amp;ldquo;fali ti zarez&amp;rdquo;. Želim ti da ti&#xA;zafali deci na svakom koraku uz nečije debilno objašnjenje &amp;ldquo;zato što ja tako&#xA;kažem&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;Drugi po redu je &lt;a href=&#34;https://people.dmi.uns.ac.rs/~djura/&#34;&gt;Đura Paunić&lt;/a&gt;. Kako je&#xA;premator, valjda je odjebao više sa fakulteta pa ga nešto i nema po sajtu&#xA;previše. Zapravo ima&#xA;&lt;a href=&#34;https://www.pmf.uns.ac.rs/wp-content/uploads/2017/03/MDS31-1.pdf&#34;&gt;nekih pomena&lt;/a&gt;&#xA;njegovih govana, kao što je knjiga prepuna grešaka koju nikad u svojoj karijeri&#xA;nije ispravio ne bi li ljudi bili primorani da dolaze na predavanja da bi čuli&#xA;ispravke njegovih brljotina. A predavanje go kurac: prepisuje iz knjige na&#xA;tablu. Ispit koji se zove &amp;ldquo;Strukture podataka i algoritmi&amp;rdquo; iliti &amp;ldquo;najbitnije&#xA;što jedan programer može znati&amp;rdquo; sam pisao na papiru i čak i kad sam ga položio&#xA;nisam stigao da napišem sve što znam. Razlog za to je što su zadaci iz doba&#xA;Tjuringa i ništa iz te knjige se ne koristi više na taj način a student treba u&#xA;svakom momentu da drži u glavi 9 pokazivača i da zna gde pokazuju. Ako ste ikad&#xA;išta programirali, znate da je to nemoguće. Naravno, kao i smrdljiva Mira, Đura&#xA;je imao praksu &amp;ldquo;nemoj da mi je previše studenata prošlo&amp;rdquo;. Eksplicitno sam pitao&#xA;njegove asistente da li je on ikada programirao i svi do jednog su rekli&#xA;&amp;ldquo;apsolutno ne&amp;rdquo;. To znači da je matora izdrkotina pričala neke budalaštine koje&#xA;smo mi trebali da naučimo napamet. Pride, još me je njegov asistent, Pešović,&#xA;čiji link isto ne mogu da nađem, oborio na &amp;ldquo;nije kao u knjizi&amp;rdquo;. Upljuvah se ja&#xA;da objasnim kako je moj algoritam i brži i manje memorije zauzima i daje tačan&#xA;rezultat. Na kraju sam ga oterao u pičku materinu i kad me je pitao šta sam&#xA;rekao &amp;ldquo;to što si čuo&amp;rdquo;. Kontao sam u tom trenutku a evo i 20 godina kasnije kako&#xA;ja kod tog debilka ionako nikad neću položiti, pa što da mu se ne najebem majke.&#xA;Kada sam pao i drugi put taj ispit koji jebeno znam, rekao sam sebi da ako ne&#xA;položim treći put, idem sa nožem na fakultet, stavljam ga Đuri pod grkljan i&#xA;ako ne napiše ceo ispit za 3 sata, svinja će da bude preklana! Kako nisam u&#xA;zatvoru, očigledno je da sam iz treće položio taj ispit. Đura je govno koje ni&#xA;jednom studentu informatike neće nedostajati. Ako pak nađete takvog studenta,&#xA;znate da ste našli isto govno kao i on sam što je, jer ko još može imati dobro&#xA;mišljenje o profesoru koji ne zna da programira i predaje najbitniji&#xA;programerski predmet osim jebeni licemer i dupelizac.&lt;/p&gt;&#xA;&lt;p&gt;Ovo su samo neki od profesora koji su mi zadavali noćne more godinama i da&#xA;želim da se zna kakvi su. Danas da im ide auto u sustret da ih pogazi, skoro pa&#xA;sam siguran da bih ćutao! Nikada ne bih ubio nekog, ali ne mogu da vidim&#xA;situaciju u kojoj bih ovima nešto pomogao ikada.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Upgrade Bootloader</title>
      <link>https://meka.rs/blog/2021/04/16/freebsd-upgrade-bootloader/</link>
      <pubDate>Fri, 16 Apr 2021 14:23:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2021/04/16/freebsd-upgrade-bootloader/</guid>
      <description>&lt;p&gt;&lt;strong&gt;WARNING: Not tested on dual boot machines and probably doesn&amp;rsquo;t work&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The recommended partitioning layout is to support BIOS and UEFI. The following&#xA;is GPT partitioning (could be MBR in this simple example). Notice that the&#xA;first two partitions are EFI and BIOS boot partitions. The EFI partition is&#xA;nothing more than a FAT partition in most cases.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gpart show&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;gt;       &lt;span style=&#34;color:#ae81ff&#34;&gt;40&lt;/span&gt;  &lt;span style=&#34;color:#ae81ff&#34;&gt;500118112&lt;/span&gt;  ada0  GPT  &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;238G&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;         &lt;span style=&#34;color:#ae81ff&#34;&gt;40&lt;/span&gt;     &lt;span style=&#34;color:#ae81ff&#34;&gt;532480&lt;/span&gt;     &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;  efi  &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;260M&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#ae81ff&#34;&gt;532520&lt;/span&gt;       &lt;span style=&#34;color:#ae81ff&#34;&gt;1024&lt;/span&gt;     &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;  freebsd-boot  &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;512K&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#ae81ff&#34;&gt;533544&lt;/span&gt;        &lt;span style=&#34;color:#ae81ff&#34;&gt;984&lt;/span&gt;        - free -  &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;492K&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#ae81ff&#34;&gt;534528&lt;/span&gt;    &lt;span style=&#34;color:#ae81ff&#34;&gt;4194304&lt;/span&gt;     &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;  freebsd-swap  &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;2.0G&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ae81ff&#34;&gt;4728832&lt;/span&gt;  &lt;span style=&#34;color:#ae81ff&#34;&gt;495388672&lt;/span&gt;     &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;  freebsd-zfs  &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;236G&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#ae81ff&#34;&gt;500117504&lt;/span&gt;        &lt;span style=&#34;color:#ae81ff&#34;&gt;648&lt;/span&gt;        - free -  &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;324K&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To see current UEFI settings like which disk/partition/file is configured for&#xA;booting, run the following:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;efibootmgr -v&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;BootCurrent: &lt;span style=&#34;color:#ae81ff&#34;&gt;0019&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Timeout    : &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; seconds&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;BootOrder  : 0019, 000A, 000C, 0006, 0007, 0008, 0009, 000B, 000D, 000E, 000F, 0010, 0011, 0012, &lt;span style=&#34;color:#ae81ff&#34;&gt;0013&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+Boot0019* FreeBSD HD&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;1,GPT,0a7e1ccc-8826-11eb-b711-f0def164c22a,0x28,0x82000&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;/File&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\e&lt;/span&gt;fi&lt;span style=&#34;color:#ae81ff&#34;&gt;\f&lt;/span&gt;reebsd&lt;span style=&#34;color:#ae81ff&#34;&gt;\l&lt;/span&gt;oader.efi&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                      ada0p1:/efi/freebsd/loader.efi &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;null&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# A LOT OF LINES REMOVED&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Write disk (pmbr) and second partition (gptzfsboot) boot codes. If you&amp;rsquo;re using&#xA;UFS instead of ZFS, change gptzfsboot to gptboot.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; ada0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# if not mounted, mount efi partition under /boot/efi&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# in my case, that&amp;#39;s adaop1, as efibootmgr reported&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp /boot/loader.efi /boot/efi/efi/freebsd/loader.efi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Serbia vs Internet</title>
      <link>https://meka.rs/blog/2020/12/09/serbia-vs-internet/</link>
      <pubDate>Wed, 09 Dec 2020 12:20:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2020/12/09/serbia-vs-internet/</guid>
      <description>&lt;p&gt;Dear reader,&lt;/p&gt;&#xA;&lt;p&gt;I really wish that you&amp;rsquo;re somewhere nice and you read this story with &amp;ldquo;in a&#xA;land far away&amp;rdquo; at the beginning, wondering how strange we are. I really wish&#xA;that place exists, because if we&amp;rsquo;re all and I mean ALL dealing with this, we&#xA;screwed up as a global IT community.&lt;/p&gt;&#xA;&lt;p&gt;This story starts 2.5 weeks ago when we decided to switch the Internet package we&#xA;use. New one has 2 times download and 4 times upload compared to the old one, and&#xA;why not. Also, we decided to take static IP so I don&amp;rsquo;t have to juggle dynamic&#xA;DNS. It&amp;rsquo;s Monday, and we have to go to their office. It&amp;rsquo;s corona time, and we&#xA;have to GO TO THE OFFICE!!! It&amp;rsquo;s even worse. We had to wait outside, it&amp;rsquo;s&#xA;almost December at that time and I&amp;rsquo;m on northern hemisphere, so it&amp;rsquo;s fucking&#xA;cold! We knew that it takes forever for any Serbian ISP to do anything, so my&#xA;wife called, first, explaining what we want to do, so they wrote it down and&#xA;said &amp;ldquo;just go to our office, show them your ID and it&amp;rsquo;s all done once you&#xA;sign&amp;rdquo;.  Ha! We fell for that again!? But yeah, it was shorter than without the&#xA;preparation. The system didn&amp;rsquo;t work well, so it took eons to finish those&#xA;papers. At the end the clerk said &amp;ldquo;I&amp;rsquo;ll send you an SMS once it&amp;rsquo;s done, so you&#xA;don&amp;rsquo;t have to wait&amp;rdquo;. OK, so it took half eternity to do that and a few hours&#xA;later we had a faster Internet. The fact is that with &lt;a href=&#34;https://mts.rs/&#34;&gt;MTS&lt;/a&gt; you&#xA;never know the speed of the Internet you&amp;rsquo;re signing for, because there is one&#xA;speed declared on their site, one on their pamphlet and one printed out in&#xA;their office. Of course, I&amp;rsquo;m talking about the same package! But OK, after&#xA;speedtest you know what you have, and it&amp;rsquo;s 400/150MBit/s.&lt;/p&gt;&#xA;&lt;p&gt;Now that was the easy part. Yeah, freezing my ass off was the easy part! Until&#xA;tomorrow morning we didn&amp;rsquo;t get static IP no matter what I reset or reboot. I&#xA;wrote them on the chat on their site and 30 minutes later, I have no Internet&#xA;connection. The IP can not get more static than this, that&amp;rsquo;s for sure! I have&#xA;no idea how many times we called, wrote to them, cried on twitter and whatnot.&#xA;First support call came on Friday! I mean, by Friday you can have a heart&#xA;operation, and it&amp;rsquo;s 4 days that it takes for MTS to even call (and ask for the&#xA;imposibilionth time &amp;ldquo;what are the symptoms?&amp;rdquo;). Naturally, I didn&amp;rsquo;t wait for&#xA;them to do something, I had better things to do. First, I noticed that when I&#xA;restart their modem with factory settings, I can ping an IP for a short period&#xA;after it boots. OK, so it means it connects, I have some connection, it fetches&#xA;config from ISP server or wherever, loads it and all connections die. Now I know&#xA;it&amp;rsquo;s not something physically broken, which would take a hell to freeze over&#xA;before some ISP&amp;rsquo;s operator decided to go outside. Now all I need is admin&#xA;user/pass to fix the modem config. Luckily, most providers here don&amp;rsquo;t practice&#xA;security, so admin pass is&#xA;&lt;a href=&#34;https://www.google.com/search?hl=en&amp;amp;q=mts%20password%20HG8245H&#34;&gt;all over the Internet&lt;/a&gt;.&#xA;As a security expert I should be advocating for this to change, but HELL NO! How&#xA;am I going to fix their screw ups if they change all the passwords?&lt;/p&gt;&#xA;&lt;p&gt;The Internet is back, and I notice their device can be configured in bridged mode.&#xA;In the same WEB interface you have user/pass fields pre-filled, and you can see&#xA;it&amp;rsquo;s PPPoE connection. Fine! Inspecting the pass element in the browser gave me what I&#xA;thought is the password. Better looking at it, it had only numbers and letters&#xA;A to F. Damn! I hoped it&amp;rsquo;s not hash, but here we are. One thousand calls later&#xA;I&amp;rsquo;m talking to a guy who can actually give me a user/pass for PPPoE. In the meantime,&#xA;waiting for them to find somebody who knows what I&amp;rsquo;m talking about I&#xA;configured ppp.conf in FreeBSD. I know it&amp;rsquo;s a good config because the error I&#xA;get is &amp;ldquo;wrong password&amp;rdquo;. Here is the part of that conversation:&lt;/p&gt;&#xA;&lt;pre&gt;&#xA;me: I need a PPPoE username and password&#xA;him: Username is &amp;lt;username&amp;gt;&#xA;me: ... and?&#xA;him: That&#39;s it.&#xA;me: If I give you a username for Facebook, can you login?&#xA;me: There has to be more!&#xA;him: Well, write this down (and he dictates my static IP)&#xA;me: I already have that data, I need the password.&#xA;him: telekom/telekom on 192.168.1.1&#xA;me: That&#39;s your router and user/pass for it. I need a PPPoE password.&#xA;me: P-P-P-O-E!!!&#xA;him: I&#39;ll have to call you back.&#xA;&#xA;him: Your password is &amp;lt;curse in Serbian&amp;gt;&#xA;me: I&#39;m sure somebody was listening to my talks!&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;By the way, he didn&amp;rsquo;t provide the whole username, because it&amp;rsquo;s in the form of&#xA;&amp;lt;user&amp;gt;@open.telekom.rs (or something similar), but I didn&amp;rsquo;t care, it&amp;rsquo;s&#xA;written in the WEB interface of an ISP device. Bridge mode, here I come! But damn, my&#xA;speed is 40/40MBit/s. Looking around I found net/mpd5 and it got me to 200/150.&#xA;OK, that&amp;rsquo;s nice! I read somewhere that igb has problems with PPPoE (something&#xA;about not using all card&amp;rsquo;s queues). Luckily I have APU1 to replace that APU2.&#xA;With APU1 now I have full speed. Hell yeah! But it&amp;rsquo;s not perfect, as AES-NI&#xA;support in hardware came with APU2, so all VPNs will be slow. As a remedy for&#xA;that, I can forward port to a home server and have a VPN concentrator there, but&#xA;it&amp;rsquo;s not perfect.&lt;/p&gt;&#xA;&lt;p&gt;Now we come to the fun part. One more reason why we need static IP is because&#xA;IPv6 is a myth: everybody&amp;rsquo;s talking about it, but it can not be spotted in the&#xA;wild. You know how your ISP is all nice and sweet when they need to push new&#xA;technology or they just started giving some service? That&amp;rsquo;s when you need to&#xA;strike! That&amp;rsquo;s a rare chance to get to somebody technical really fast and then&#xA;ask real questions. Needles to say, when MTS started offering fibre optics,&#xA;they started sending sales personnel to persuade people to switch their ISP. I&#xA;asked them for IPv6 and the sales guy didn&amp;rsquo;t know, of course. So in a few days he&#xA;came with a technical guy, we sat down and I asked a lot of questions, but once&#xA;I got to IPv6, he said he has no idea what that is, but he has a number of the&#xA;guy who probably knows about it. He called and gave me the phone. Needles to&#xA;say, the third guy in a row has no idea what I&amp;rsquo;m talking about, so the answer&#xA;is probably &amp;ldquo;no IPv6 address for you&amp;rdquo;. There was literally nobody else to call&#xA;and ask for IPv6.&lt;/p&gt;&#xA;&lt;p&gt;No IPv6 means I can use &lt;a href=&#34;https://tunnelbroker.net/&#34;&gt;HE tunnel&lt;/a&gt; to get IPv6 over&#xA;IPv4, and at least start learning about the technology and stack and whatnot.&#xA;Once we had static IP, I realized DMZ is not going to work for that tunnel, so&#xA;I needed to set the ISP device as a bridge, hence the above hassle. The tunnel broker&#xA;is really nice as it gives you exact commands to type in your terminal as root&#xA;for every operating system there is, so it&amp;rsquo;s the next best thing to having an&#xA;actual IPv6.&lt;/p&gt;&#xA;&lt;p&gt;I have APU1 currently working, APU2 that gave me headache and APU4 laying on my&#xA;table waiting for me to configure it and try if it gives me full Internet speed&#xA;while being able to utilize hardware AES-NI. One of these days, I&amp;rsquo;ll be on the&#xA;Internet like it&amp;rsquo;s a normal thing in the 21st century.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Freenit Framework</title>
      <link>https://meka.rs/blog/2020/10/04/freenit-framework/</link>
      <pubDate>Sun, 04 Oct 2020 00:36:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2020/10/04/freenit-framework/</guid>
      <description>&lt;p&gt;For few years I worked on a startkit to get me faster results, then I started&#xA;teaching using it, and now it&amp;rsquo;s a framework. So let me tell you a story.&lt;/p&gt;&#xA;&lt;p&gt;Backend is written in Python and uses Flask and SmoREST, while frontend is&#xA;composed of React, Material-UI and Axios. What I tried to achieve is&#xA;&amp;ldquo;deployment easy / development portable&amp;rdquo; rule. Yeah, it&amp;rsquo;s quite some rule, and I&#xA;have to tell you, it was not always easy. The nice thing that came out of it is&#xA;that devops repo for Freenit has support for &amp;ldquo;plain old&amp;rdquo; POSIX compliant&#xA;scripts to initialize a project and start development. Those scripts are also&#xA;used in Docker, CBSD/Reggae jail and Vagrant, which are all preconfigured. As I&#xA;use FreeBSD, I made Freenit port/package available, and as I use it in&#xA;production I always keep the version updated. I also have a config of uWSGI&#xA;that is automatically disabled in development, enabled in production.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://meka.rs/images/freenit-demo.gif&#34; alt=&#34;Designer&#34;&gt;&#xA;This year we streamed course on development using Freenit, and to make&#xA;introduction to development easier, I created &lt;a href=&#34;designer.meka.rs&#34;&gt;designer&lt;/a&gt; and&#xA;I started working on &lt;a href=&#34;frontend.meka.rs&#34;&gt;frontend documentation&lt;/a&gt;. Backend is&#xA;kinda self-documented through Swagger and nice patterns that&#xA;SmoREST/Marshmallow/Webargs enable. The &amp;ldquo;big thing&amp;rdquo; about designer is that it&amp;rsquo;s&#xA;a drag n drop web design solution which uses JSON to save the work, but gives&#xA;developer an opportunity to export it to React code with theme, styles and&#xA;HTML/Material-UI components. The motive for this software is that I hate the&#xA;fact that WEB designer and developer have to create the look from scratch, just&#xA;using different tools/languages. This way, code is generated from design, and&#xA;while it is not perfect, it is intentionally done so. What I mean is that the&#xA;goal was to have saved and export file contain everything while being just&#xA;json or js file. Naturally, I expect frontend developer to tidy up the code,&#xA;split it into multiple files and so on. Other than that, generated code is&#xA;decent, looked from developer&amp;rsquo;s perspective.&lt;/p&gt;&#xA;&lt;p&gt;The course we streamed was about:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=S7ZaCP1j5Qk&amp;amp;list=PLpeJ1COhO5alSO2NsZtvJz0bXUwiziIe0&#34;&gt;Freenit backend&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=uv11vOKHkMI&amp;amp;list=PLpeJ1COhO5alT0K6n0P95wZmHT9vYtvzc&#34;&gt;Freenit frontend&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=ulJE9SWCGII&amp;amp;list=PLpeJ1COhO5ans6FiAN6WjJsMZFG8ChZj9&#34;&gt;FreeBSD DevOps&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=4yGq1b6xoJE&amp;amp;list=PLpeJ1COhO5alXSy6Ecskh6d7ddvaBdg_g&#34;&gt;Kotlin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=gByyga_5mPw&amp;amp;list=PLpeJ1COhO5aneha988XS5ny6hMQ105g4a&#34;&gt;C++&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;As this was the first year we streamed the course, we decided to do it in our&#xA;native, Serbian, but next batch of courses will be in English, as we already&#xA;have plans to record more.&lt;/p&gt;&#xA;&lt;p&gt;One of my plans was to have everything upgradable with &amp;ldquo;pkg upgrade&amp;rdquo; if&#xA;possible. As I&amp;rsquo;m developer of Freenit and maintainer of it&amp;rsquo;s port in FreeBSD, I&#xA;know those are in sync. As a matter of fact, I know quite a lot of Python&#xA;packages I use are in sync with FreeBSD ports. Most of that is due to&#xA;responsive maintainers of those ports. I did some of that porting and the&#xA;following picture is a tree of ports (represented by their bug ID) I had to&#xA;port to have Freenit in ports.&lt;/p&gt;&#xA;&lt;a href=&#34;https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242817&#34; target=&#34;_blank&#34;&gt;&#xA;  &lt;img src=&#34;https://meka.rs/images/freenit.png&#34; /&gt;&#xA;&lt;/a&gt;&#xA;&lt;p&gt;For development of the Freenit backend I use pip, but for development of any&#xA;product/service based on it I use FreeBSD&amp;rsquo;s pkg. The reason is that I want to&#xA;fail fast and discover changes in libraries ideally the day they are published&#xA;to pip, but use more stable packages for production. To get there, I had great&#xA;help from the FreeBSD community creating that port, especially from Koobs.&#xA;Although he does not agree on using FreeBSD&amp;rsquo;s pkg for Python packages in&#xA;production, we both understand why the other guy does things the way he does. I&#xA;really like the freedom the combination of this OS and language provides as you&#xA;can really find what &amp;ldquo;best way to hosting&amp;rdquo; is for you and your needs.&lt;/p&gt;&#xA;&lt;p&gt;Primarily, I&amp;rsquo;m system administrator. I do know C/C++/Python/JavaScript to a good&#xA;degree, but I most enjoy doing sys admin stuff. What I really like about it is&#xA;automation, and you might notice it in my coding as well. For example, I created&#xA;&lt;a href=&#34;https://github.com/mekanix/dotfiles/tree/master/UltiSnips&#34;&gt;UltiSnips snippets&lt;/a&gt;&#xA;for most commonly used Freenit (and other) constructs, so I can have a page done&#xA;with designer, exported to React, added backend integration through snippet,&#xA;write backend model/endpoint/migration with snippets or tools and developed&#xA;inside CBSD/Reggae, which is also used to publish the code. One feature I&amp;rsquo;m&#xA;currently working on is a uniform setup for Python jails so that deployment&#xA;based on Freenit can be unified, too. What you need is just &lt;code&gt;USE_FREENIT=YES&lt;/code&gt; in&#xA;your project/backend and you magically get build and publish functionalities.&lt;/p&gt;&#xA;&lt;p&gt;Security is a long topic to add to already lengthy post. Also, it deserves a&#xA;post on it&amp;rsquo;s own as it&amp;rsquo;s one of the really tricky topics in development of any&#xA;kind. Needles to say, I have an opinion how it should be done in Freenit, so&#xA;stay tuned for a new one!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>OpenLDAP Multimaster</title>
      <link>https://meka.rs/blog/2020/03/25/openldap-multimaster/</link>
      <pubDate>Wed, 25 Mar 2020 23:41:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2020/03/25/openldap-multimaster/</guid>
      <description>&lt;p&gt;One thing I can tell you about email servers is that I&amp;rsquo;m really dumb to set it&#xA;up properly. I&amp;rsquo;m mail admin since 2006 and 14 years later I still don&amp;rsquo;t know&#xA;how to do it. I mean, yeah, I do run a mail server and it does work, but it&amp;rsquo;s&#xA;far from satisfying, but that&amp;rsquo;s not what I want to talk about in this post. I&#xA;want to talk about one part of email server: OpenLDAP.&lt;/p&gt;&#xA;&lt;p&gt;You can think of OpenLDAP, or just ldap for short, as a lightweight database&#xA;for users and groups. The reason I chose ldap over SQL is that it&amp;rsquo;s less&#xA;resource hungry while being really flexible. One drawback is that it&amp;rsquo;s&#xA;complicated as hell. Not the software or configuration itself, but errors are&#xA;usually misleading (at least to me). On top of that, although I knew OpenLDAP&#xA;supports N-way multimaster, I never found any decent documentation on how to&#xA;actually configure a cluster. So in short, this is the configuration that works&#xA;on my server:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ServerID        &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldap://ldap3.domain.tld&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;moduleload      syncprov&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;overlay         syncprov&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;syncprov-checkpoint     &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;syncprov-sessionlog     &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;syncrepl        rid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;31&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                provider&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldap://ldap1.domain.tld&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                type&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;refreshAndPersist&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                schemachecking&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;on&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                retry&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;5 10 30 +&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                searchbase&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dc=ldap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                bindmethod&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;simple&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                binddn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;cn=root,dc=ldap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                credentials&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;verysecret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                starttls&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;yes&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                tls_cacert&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/etc/ssl/cert.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                tls_cert&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/etc/openldap/certs/fullchain.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                tls_key&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/etc/openldap/certs/privkey.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;syncrepl        rid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                provider&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldap://ldap2.domain.tld&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                type&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;refreshAndPersist&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                schemachecking&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;on&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                retry&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;5 10 30 +&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                searchbase&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dc=ldap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                bindmethod&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;simple&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                binddn&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;cn=root,dc=ldap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                credentials&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;verysecret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                starttls&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;yes&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                tls_cacert&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/etc/ssl/cert.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                tls_cert&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/etc/openldap/certs/fullchain.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                tls_key&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/etc/openldap/certs/privkey.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;MirrorMode on&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Of course, it is in FreeBSD jail and it uses letsencrypt certificates. There&#xA;are few things you should note about above config. First, there are 3 ldap&#xA;servers which are all masters. Second, ServerID, ldap URL and rid are somewhat&#xA;connected: they all contain number 3 in them. That&amp;rsquo;s a convention I find&#xA;easiest to follow and understand, and makes some errors somewhat easy to catch.&#xA;For example, &lt;code&gt;rid&lt;/code&gt; should never contain two same digits, like 33. Although ldap&#xA;server itself won&amp;rsquo;t stop you, it&amp;rsquo;s easier this way as &lt;code&gt;rid=33&lt;/code&gt; means that server&#xA;3 should connect to itself, which is not good. You can have as much servers as&#xA;you want and number of &lt;code&gt;syncrepl&lt;/code&gt; sections in your configuration should be one&#xA;less than the number of servers. FreeBSD slapd servie should be configured like&#xA;this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;slapd_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;slapd_flags&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;-u ldap -g ldap -h ldap://ldap3.domain.tld&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;One thing you should be careful about is that &lt;code&gt;ldap3.domain.tld&lt;/code&gt; must be&#xA;resolvable. On top of that, it should resolve to the IP of the jail it&amp;rsquo;s&#xA;running in. This is usually not the case as you probably point domain names to&#xA;server IP, not jail IP. The way I solved it is with the little help of Unbound.&#xA;As CBSD/Reggae already uses unbound, I created a fake auth zone for&#xA;ldap3.domain.tld:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ldap3.domain.tld. SOA ldap3.domain.tld. hostmaster.ldap3.domain.tld. &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                  &lt;span style=&#34;color:#ae81ff&#34;&gt;1998092901&lt;/span&gt;  ; Serial number&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                  &lt;span style=&#34;color:#ae81ff&#34;&gt;60&lt;/span&gt;          ; Refresh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                  &lt;span style=&#34;color:#ae81ff&#34;&gt;1800&lt;/span&gt;        ; Retry&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                  &lt;span style=&#34;color:#ae81ff&#34;&gt;3600&lt;/span&gt;        ; Expire&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                  &lt;span style=&#34;color:#ae81ff&#34;&gt;1728&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;      ; Minimum TTL&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ldap3.domain.tld.            NS      ldap3.domain.tld.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ORIGIN ldap3.domain.tld&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@    A   1.1.1.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Of course, you should replace &lt;code&gt;1.1.1.1&lt;/code&gt; with the actual IP address of jail&#xA;where ldap is running. This is not ideal, but if I ever find better solution&#xA;I will certainly write about it. There is just one more thing you should worry&#xA;about and that&amp;rsquo;s renewing certificates. As uid/gid of cert files is probably&#xA;not the same as those running slapd service, there&amp;rsquo;s a little script I wrote&#xA;that is executed every time I run letsencrypt client (dehydrated, in my case,&#xA;ran once a week):&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;DOMAIN&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$1&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt; -z &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;DOMAIN&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Usage &lt;/span&gt;$0&lt;span style=&#34;color:#e6db74&#34;&gt; &amp;lt;domain&amp;gt;&amp;#34;&lt;/span&gt; &amp;gt;&amp;amp;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  exit &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;fi&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PRIVKEY&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/etc/openldap/certs/privkey.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;CERT_DIFF&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dummy&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt; -e &lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PRIVKEY&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  CERT_DIFF&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;diff /etc/certs/&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;DOMAIN&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/privkey.pem &lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PRIVKEY&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;fi&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt; ! -z &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;CERT_DIFF&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  cat /etc/certs/&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;DOMAIN&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/privkey.pem &amp;gt;/usr/local/etc/openldap/certs/privkey.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  cat /etc/certs/&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;DOMAIN&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/fullchain.pem &amp;gt;/usr/local/etc/openldap/certs/fullchain.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  chown ldap:ldap /usr/local/etc/openldap/certs/*.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; /usr/local/etc/openldap/certs/*.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  service slapd restart&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;fi&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It should be ran as &lt;code&gt;update_certs.sh domain.tld&lt;/code&gt;. You might not have&#xA;letsencrypt certs in /etc/certs, so edit that script to conform to your paths&#xA;and configuration.&lt;/p&gt;&#xA;&lt;p&gt;NOTE: There are some blog posts that state you should use &lt;code&gt;chain.pem&lt;/code&gt; for&#xA;&lt;code&gt;tls_cacert&lt;/code&gt;. That does not work. If you have trouble with your service, try&#xA;running it as this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/libexec/slapd -u ldap -g ldap -h ldap://ldap3.domain.tld -d &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It will run slapd in the foreground and spew a lot of messages to your terminal.&#xA;Some of them might be helpful. Also, you might want to use other number than 1&#xA;for -d argument, but I found it&amp;rsquo;s the best verbosity level for me.&lt;/p&gt;&#xA;&lt;p&gt;OpenLDAP has alternate configuration syntax usually called &lt;code&gt;cn=config&lt;/code&gt; for&#xA;short. It allows you to keep configuration in ldap itself and changing those&#xA;values makes them active right away. To be honest, I perfectly understand why&#xA;some data centers would want not to restart the service when they change&#xA;configuration, but for my little server, that&amp;rsquo;s an overkill. Also, cn=config&#xA;variables for multimaster are somewhat similar to those I showed here, so it&#xA;should be almost easy to convert them. Also, official documentation for&#xA;multimaster uses cn=config, so&#xA;&lt;a href=&#34;https://openldap.org/doc/admin24/replication.html&#34;&gt;give it a try&lt;/a&gt; if you&amp;rsquo;re&#xA;using cn=config.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Crossbow</title>
      <link>https://meka.rs/blog/2020/02/18/freebsd-crossbow/</link>
      <pubDate>Tue, 18 Feb 2020 17:48:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2020/02/18/freebsd-crossbow/</guid>
      <description>&lt;p&gt;Once I started learning about containers and surrounding technologies, I heard&#xA;about Solaris Zones and Crossbow. In short, zones are containers, like jails,&#xA;and crossbow is something like a vnet. They say it&amp;rsquo;s way more flexible and&#xA;powerful. One of the things it can do is prevent you from setting up static IP.&#xA;I thought that&amp;rsquo;s pretty important thing and I wanted to have that. With&#xA;CBSD/Reggae I&amp;rsquo;m a little closer to saying &amp;ldquo;we have it&amp;rdquo;. Reggae sets up a jail&#xA;named &lt;code&gt;cbsd&lt;/code&gt; and inside it &lt;code&gt;/dev/pf&lt;/code&gt; and DHCP server are configured in a very&#xA;special way. Because DHCP process is running as dhcp user, and that user can&#xA;not run &lt;code&gt;pfctl&lt;/code&gt;, unless &lt;code&gt;/dev/pf&lt;/code&gt; owning group is the same as DHCP process&#xA;group. Luckily, devfs.rules allows one set of rules for host and other set for&#xA;the jail. That means &lt;code&gt;/dev/pf&lt;/code&gt; on host is owned by &lt;code&gt;root:root&lt;/code&gt; while it&amp;rsquo;s owned&#xA;by &lt;code&gt;root:unbound&lt;/code&gt; inside the jail and mode is 660. Of course, DHCP runs under&#xA;group unbound. The reason is that unbound files from host are nullfs mounted&#xA;inside the jail. That way DHCP can edit unbound zones and add leased addresses&#xA;to PF table. On host, that PF table is used to configure NAT, so basically&#xA;allowing jails to reach Internet.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s face it. What I just described is nowhere near to Solaris crossbow, but&#xA;it&amp;rsquo;s the closest I can get.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>CBSD Base Upgrade</title>
      <link>https://meka.rs/blog/2019/11/18/cbsd-base-upgrade/</link>
      <pubDate>Mon, 18 Nov 2019 19:36:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2019/11/18/cbsd-base-upgrade/</guid>
      <description>&lt;p&gt;Upgrade in CBSD means the same as in FreeBSD: increse only in patch version.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cbsd baseupdate&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;service cbsd restart&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For upgrade you need to stop the jail, set it to new base and start the jail.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cbsd jstop nginx&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cbsd jset jname&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;nginx ver&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;12.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cbsd jstart nginx&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cbsd etcupdate jname&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;cbsd mode&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;update from&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;12.0 to&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;12.1 mode&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;diff&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;CBSD will ask you how do you want new base files to be fetched, and default is&#xA;to download them. Other options include compiling from code and using host&#xA;system files as new base. If you upgrade more then one jail, the first&#xA;&lt;code&gt;jstart&lt;/code&gt; will create base jail for the rest to use.&lt;/p&gt;&#xA;&lt;p&gt;Once you&amp;rsquo;ve upgraded all your jails, it&amp;rsquo;s time to cleanup&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cbsd removebase ver&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;12.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>FreeBSD Upgrade</title>
      <link>https://meka.rs/blog/2019/11/18/freebsd-upgrade/</link>
      <pubDate>Mon, 18 Nov 2019 19:12:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2019/11/18/freebsd-upgrade/</guid>
      <description>&lt;p&gt;Upgrade in FreeBSD world means having a host on version 12.0 and doing similar&#xA;procedure like in &lt;a href=&#34;https://meka.rs/blog/2019/06/25/freebsd-update&#34;&gt;FreeBSD update&lt;/a&gt;, but ending up with a&#xA;major or minor version number incresed, not patch version number.&lt;/p&gt;&#xA;&lt;p&gt;TL;DR&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;env PAGER&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/bin/cat freebsd-update upgrade -r 12.1-RELEASE&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;freebsd-version -ku&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bectl create 12.0.11&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;freebsd-update install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;reboot&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;freebsd-update install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;reboot&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pkg upgrade&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;freebsd-update install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;reboot&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;freebsd-update&lt;/code&gt; utility will tell you if there is anything to be fetched. If&#xA;there isn&amp;rsquo;t, just ignore the rest of the commands.&lt;/p&gt;&#xA;&lt;p&gt;First, using &lt;code&gt;freebsd-version&lt;/code&gt; and &lt;code&gt;bectl&lt;/code&gt; you create a boot environment for&#xA;the current version of FreeBSD. Then, first install will update only kernel.&#xA;As FreeBSD kernels are backward compatible, your system can boot with newer&#xA;kernel then the rest of the operating system. Second install will take care of&#xA;FreeBSD base. If everything is OK, after another &lt;code&gt;reboot&lt;/code&gt;, you should upgrade&#xA;packages for the new OS version and run finall install which will take care of&#xA;known package problems. The last &lt;code&gt;reboot&lt;/code&gt; is there to ensure everything is&#xA;working OK, as you might have some kernel modules, like drm-kmod, which are&#xA;changed during the upgrade.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Update</title>
      <link>https://meka.rs/blog/2019/06/25/freebsd-update/</link>
      <pubDate>Tue, 25 Jun 2019 13:03:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2019/06/25/freebsd-update/</guid>
      <description>&lt;p&gt;As you might be comming from Linux background, like I am, you might not be&#xA;familiar with the FreeBSD update procedure. The main difference is that FreeBSD&#xA;has base system as one big component which is updated as a whole, plus it has&#xA;packages like any other Unix.&lt;/p&gt;&#xA;&lt;p&gt;TL;DR&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;env PAGER&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/bin/cat freebsd-update fetch&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;freebsd-version -ku&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bectl create 12.0.3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;freebsd-update install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;reboot&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Check if &lt;a href=&#34;https://svnweb.freebsd.org/ports/head/UPDATING?view=markup&#34;&gt;there&amp;rsquo;s a known migration problem&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pkg upgrade&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;reboot&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;If you have jails, update them before last reboot&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;freebsd-update&lt;/code&gt; utility will tell you if there is anything to be fetched. If&#xA;there isn&amp;rsquo;t, just ignore the rest of the commands, but if there is, you&#xA;probably want to know what is the current version using &lt;code&gt;freebsd-version&lt;/code&gt;. The&#xA;-k and -u options stand for kernel and userland, respectively. Those version&#xA;can be different (only the patch level), so pick the higher one. In the example&#xA;above, that&amp;rsquo;s 12.0-p3. If you&amp;rsquo;re running on ZFS, you can use &lt;code&gt;bectl&lt;/code&gt; to create&#xA;new boot environment out of the current one, so if update goes wrong, you can&#xA;still boot system with the previous version. The boot environment is ZFS-only&#xA;feature which allows for multiple root datasets which loader(8) knows how to&#xA;boot into. In a sense, it&amp;rsquo;s like installing update and all the packages to new&#xA;root partition, every time. If you&amp;rsquo;re not running your FreeBSD on ZFS, just skip&#xA;this step. Finally, we install the actual update and reboot, so the new kernel&#xA;and base system are loaded. As the final part, packages are updated.&lt;/p&gt;&#xA;&lt;p&gt;If you have a machine you can not reboot for any reason and have access through&#xA;VNC, serial console or other non-network channels, you can run this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;env PAGER&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/bin/cat freebsd-update fetch&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;freebsd-version -ku&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bectl create 12.0.3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;shutdown now&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;freebsd-update install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pkg upgrade&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;shutdown&lt;/code&gt; command will not power your machine off. It will bring it into&#xA;single user mode. In this mode, most processes are not running, only those to&#xA;enable basic terminal functionallity (and a bit more, but let&amp;rsquo;s say nothing is&#xA;running). It will ask for root password and once the actuall update is finished,&#xA;&lt;code&gt;exit&lt;/code&gt; will start the services like on fresh boot. The drawback is that kernel&#xA;updates are not activated, but you still profit from the updates to the&#xA;userland. As FreeBSD tries relly hard to maintain ABI compatibility on the patch&#xA;level, this is safe enough to do, but it is advisable to reboot once after the&#xA;update to load the new kernel.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Videos</title>
      <link>https://meka.rs/videos/</link>
      <pubDate>Mon, 24 Jun 2019 18:31:00 +0000</pubDate>
      <guid>https://meka.rs/videos/</guid>
      <description>&lt;h3 id=&#34;dafed-61---kako-automatizacija-procesa-pomaže-u-razvoju-sigurnijih-aplikacija&#34;&gt;DaFED #61 - Kako automatizacija procesa pomaže u razvoju sigurnijih aplikacija&lt;/h3&gt;&#xA;&lt;iframe height=&#34;350px&#34; width=&#34;100%&#34; src=&#34;https://www.youtube.com/embed/XnJjMqa5fDw&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&#34; allowfullscreen&gt;&lt;/iframe&gt;&#xA;&lt;h3 id=&#34;fosdem-2023---reggae-cool-way-of-managing-jailsvms-on-freebsd&#34;&gt;FOSDEM 2023 - Reggae: cool way of managing jails/VMs on FreeBSD&lt;/h3&gt;&#xA;&lt;video controls width=&#34;100%&#34;&gt;&#xA;  &lt;source src=&#34;https://video.fosdem.org/2023/AW1.120/reggae_jails_vms_on_freebsd.mp4&#34; /&gt;&#xA;&lt;/video&gt;&#xA;&lt;h3 id=&#34;eurobsd-2022---freebsd-audio-in-amateur-and-professional-setups&#34;&gt;EuroBSD 2022 - FreeBSD audio in amateur and professional setups&lt;/h3&gt;&#xA;&lt;iframe height=&#34;350px&#34; width=&#34;100%&#34; src=&#34;https://www.youtube.com/embed/9xIGfs6Bqpo&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&#34; allowfullscreen&gt;&lt;/iframe&gt;&#xA;&lt;h3 id=&#34;fosdem-2021---managing-virtual-resources-with-cbsd-and-beyond&#34;&gt;FOSDEM 2021 - Managing virtual resources with CBSD, and beyond&lt;/h3&gt;&#xA;&lt;video controls width=&#34;100%&#34;&gt;&#xA;  &lt;source src=&#34;https://video.fosdem.org/2021/D.bsd/cbsd_ecosystem.mp4&#34; /&gt;&#xA;&lt;/video&gt;&#xA;&lt;h3 id=&#34;bsidesljubljana-2019---how-did-we-teach-ourselves-security&#34;&gt;BSidesLjubljana 2019 - How Did We Teach (Ourselves) Security&lt;/h3&gt;&#xA;&lt;video controls width=&#34;100%&#34;&gt;&#xA;  &lt;source src=&#34;https://archive.org/download/BSidesLjubljana2019/t1_08_How_Did_We_Teach_%28Ourselves%29_Security-Goran_Meki%C4%87.mp4&#34; /&gt;&#xA;&lt;/video&gt;&#xA;&lt;h3 id=&#34;fosdem-2019---freebsd-in-audio-studio&#34;&gt;FOSDEM 2019 - FreeBSD in Audio Studio&lt;/h3&gt;&#xA;&lt;video controls width=&#34;100%&#34;&gt;&#xA;  &lt;source src=&#34;https://video.fosdem.org/2019/K.3.401/freebsd_in_audio_studio.mp4&#34; /&gt;&#xA;&lt;/video&gt;&#xA;&lt;h3 id=&#34;bsidesljubljana-2018---modern-and-secure-devops-on-freebsd&#34;&gt;BSidesLjubljana 2018 - Modern And Secure Devops on FreeBSD&lt;/h3&gt;&#xA;&lt;video controls width=&#34;100%&#34;&gt;&#xA;  &lt;source src=&#34;https://archive.org/download/BSidesLjubljana2018/18ModernAndSecureDevopsOnFreebsdByGoranMeki.mp4&#34; /&gt;&#xA;&lt;/video&gt;&#xA;&lt;h3 id=&#34;fosdem-2018---cbsd-isolation-manager&#34;&gt;FOSDEM 2018 - CBSD Isolation Manager&lt;/h3&gt;&#xA;&lt;video controls width=&#34;100%&#34;&gt;&#xA;  &lt;source src=&#34;https://video.fosdem.org/2018/K.3.401/cbsd_isolation_manager.mp4&#34; /&gt;&#xA;&lt;/video&gt;&#xA;&lt;h3 id=&#34;balccon-2016---floss-way-of-funding-a-hackerspace&#34;&gt;BalCCon 2016 - FLOSS Way of Funding a Hackerspace&lt;/h3&gt;&#xA;&lt;iframe height=&#34;350px&#34; width=&#34;100%&#34; src=&#34;https://www.youtube.com/embed/DHNnCXgD4RU&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&#34; allowfullscreen&gt;&lt;/iframe&gt;&#xA;&lt;h3 id=&#34;balccon-2015---what-is-hackerspace&#34;&gt;BalCCon 2015 - What is Hackerspace&lt;/h3&gt;&#xA;&lt;iframe height=&#34;350px&#34; width=&#34;100%&#34; src=&#34;https://www.youtube.com/embed/KpzQpAAwBvA&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&#34; allowfullscreen&gt;&lt;/iframe&gt;&#xA;</description>
    </item>
    <item>
      <title>IT Feels Like Constant Failure</title>
      <link>https://meka.rs/blog/2019/04/08/it-feels-like-constant-failure/</link>
      <pubDate>Mon, 08 Apr 2019 20:10:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2019/04/08/it-feels-like-constant-failure/</guid>
      <description>&lt;p&gt;Do you remember when any operating system just worked? Me neither, and I hate&#xA;it. I mean, Windows was always just a joke. Just think about it, Microsoft said&#xA;their git repository is 300GB in size. How do you compile, let alone read? One&#xA;will probably think of Linux, but what about systemd and Richard Stallman?&#xA;Honestly, I&amp;rsquo;m not sure what is more revolting: shitty system software, or the&#xA;most annoying guy ever. One might think about BSDs, but what about the support?&#xA;FreeBSD being most popular and getting most attraction still lacks support for&#xA;a lot of hardware. And the hardware? I don&amp;rsquo;t remember when I bought a piece of&#xA;hardware that didn&amp;rsquo;t totally suck. As a matter of fact, how do you even do&#xA;proper programming when the underlaying hardware is fucked up? And where are we&#xA;as IT going? We&amp;rsquo;re creating bunch of sites and software for what? I can&amp;rsquo;t&#xA;remember how many times I&amp;rsquo;ve heard &amp;ldquo;we&amp;rsquo;re creating something revolutionary&amp;rdquo;.&#xA;It&amp;rsquo;s like nobody can create just a regular software solving small problems.&#xA;Why? I hate the current state, and the worst is the hardware industry. Just&#xA;look at the spectra and meltdown. I&amp;rsquo;m ashamed and sorry for contributing to&#xA;this whole circus, where it&amp;rsquo;s only important to sell, get revenue and bail out.&#xA;I may never stop doing IT stuff, but I do hate it from the bottom of my soul.&#xA;Also, recent years showed me that my colleagues are mostly not interested in the&#xA;IT at all, but to get their salary and go home. I can&amp;rsquo;t blame them, but I can&amp;rsquo;t&#xA;like them either. As a matter of fact, there are more and more programmers that&#xA;have no education. I don&amp;rsquo;t mean formal, as I know some exceptional developers&#xA;without a single day at the university, but wish to know more is rare. Like&#xA;we&amp;rsquo;re playing this dumb game to put money into someone&amp;rsquo;s pocket, and that&#xA;pocket ain&amp;rsquo;t ours. It&amp;rsquo;s like we&amp;rsquo;re doing everything we can to screw this&#xA;industry that once was so beautiful. That&amp;rsquo;s why IT feels like a constant&#xA;failure, because it is!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>HardenedBSD Install Over Serial</title>
      <link>https://meka.rs/blog/2018/08/13/hardenedbsd-install-over-serial/</link>
      <pubDate>Mon, 13 Aug 2018 00:45:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2018/08/13/hardenedbsd-install-over-serial/</guid>
      <description>&lt;p&gt;If you have APU or similar router, it&amp;rsquo;s a big chance you&amp;rsquo;ll need serial console&#xA;install procedure. You&amp;rsquo;ll have to mount install image before booting and change&#xA;/boot/loader.conf so it includes the lines to use serial console:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;boot_multicons&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;boot_serial&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;comconsole_speed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;115200&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;console&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;comconsole,vidconsole&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the machine boots, it will ask you for prefered console type. Default&#xA;(vt100) is just fine. The rest of the installation is just like on the normal&#xA;machine, but you&amp;rsquo;ll have to modify /boot/loader.conf on the newely installed.&#xA;Reboot, and boot off of USB key once again with the same procedure, but go into&#xA;shell, instead of install.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir /tmp/install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;zpool import -R /tmp/install -f zroot&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;zfs mount zroot/ROOT/default&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now write the same lines for serial console to /tmp/install/boot/loader.conf and&#xA;you should be set.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>CBSD Reggae</title>
      <link>https://meka.rs/blog/2017/11/20/cbsd-reggae/</link>
      <pubDate>Mon, 20 Nov 2017 03:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/11/20/cbsd-reggae/</guid>
      <description>&lt;p&gt;If you didn&amp;rsquo;t get it by now, I&amp;rsquo;m huge CBSD fan. Actually, I&amp;rsquo;m CBSD developer&#xA;now. :o) One of the things I play with is Reggae, and some people asked me to&#xA;describe it and make a demo. So here goes the explanation why I created it, how&#xA;to use it and what are my plans for it in the future.&lt;/p&gt;&#xA;&lt;p&gt;As CBSD is used for almost everything in Reggae, I won&amp;rsquo;t discuss that part.&#xA;So, besides jails, these are the topics I tried to cover with&#xA;Reggae:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;network and pf being static&lt;/li&gt;&#xA;&lt;li&gt;environment for bhyve VMs&lt;/li&gt;&#xA;&lt;li&gt;ansible provisioning&lt;/li&gt;&#xA;&lt;li&gt;development envrionemnt&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Let me explain in a bit more detail. If you use CBSD as Oleg (lead developer)&#xA;likes it, it will do all the magic for you: configure bridge interface for VMs,&#xA;dynamically change PF rules when jails go up and so on. While this is&#xA;absolutely great feature, I know bunch of admins that would like to try CBSD&#xA;but don&amp;rsquo;t like other software to alter their firewall rules (me included).&#xA;To automate the process of CBSD initialization with PF rules that don&amp;rsquo;t change&#xA;and interfaces that are fixed (except tap and epair), I created command&#xA;&lt;code&gt;reggae init&lt;/code&gt;. You can think of it as a test: it creates static config for&#xA;CBSD network so you can test if everything is working as you would like it. As&#xA;script grew, it became obvious to me that it can also be used to initialize&#xA;the server, not just test weird CBSD config and such. Network interfaces are&#xA;configured only because you have to NAT using interface names so those had to&#xA;be static as much as possible. I like the setup where jails are on lo1 and&#xA;virtual machines on bridge1. In /etc/pf.conf that&amp;rsquo;s&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;jail_if &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lo1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bridge_if &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bridge1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nat on $ext_if from &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;$jail_if:network&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;$bridge_if:network&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt; to any -&amp;gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;$ext_if&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So that&amp;rsquo;s basically use case for the static network and how I tried to solve&#xA;it. I&amp;rsquo;m sure there are better ways to do it, but I wanted to create proof of&#xA;concept that we can discuss further.&lt;/p&gt;&#xA;&lt;p&gt;As for VMs you need DHCP server to make it easier to work with, &lt;code&gt;reggae init&lt;/code&gt;&#xA;will also setup two jails: dhcp and resolver. DHCP will lease IPs to VMs and&#xA;register them in DNS (resolver). What you&amp;rsquo;ll notice is that only jail on&#xA;bridge1 is DHCP, and that&amp;rsquo;s because it has to be on the same bridge as the VMs.&#xA;Also, DHCP server is ISC&amp;rsquo;s Kea which has control socket file you can use to get&#xA;statistics and to reconfigure/reload Kea. I still didn&amp;rsquo;t poke that socket, but&#xA;I hope that in the future it will provide enough stats that CBSD can use it&#xA;internally. Having resolver working, jails registration was straight forward:&#xA;master_poststart.d / master_prestop.d hooks that use nsupdate and RNDC key to&#xA;add/delete jail&amp;rsquo;s IP to/from the zone. So now Reggae has two zones, my.domain&#xA;and vm.my.domain, as IPs assigned to jails and VMs are from different IP ranges&#xA;and I want to be clear is it a jail or VM just from looking at the name.&lt;/p&gt;&#xA;&lt;p&gt;For Ansible to provision jails you have to use jail connection instead ssh.&#xA;Also, as Ansible expects python binary to be installed in /usr/bin, you have&#xA;to tell Ansible where python is on FreeBSD machines. So this is how the&#xA;inventory of one jail looks like:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;jail1 ansible_connection&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;jail ansible_python_interpreter&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#34;/usr/bin/env python&amp;#34;&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To make it easier for me to run Ansible on a jail, I created some Makefiles to&#xA;help me with common tasks. If you create hierarchy in your repo the way Reggae&#xA;expects it, you can &amp;ldquo;just write Ansible playbook&amp;rdquo; and it will be applied to your&#xA;jail with one &lt;code&gt;make&lt;/code&gt;. I could use a shell script for that, too, but I wanted to&#xA;leave room for parallelism in the future.&lt;/p&gt;&#xA;&lt;p&gt;To be able to reach your jail with Ansible once it&amp;rsquo;s on the server, Reggae will&#xA;create &lt;code&gt;provision&lt;/code&gt; user, give it sudo priviledges and add public key to it&amp;rsquo;s&#xA;ssh. What it does is&#xA;&lt;code&gt;cp ~/.ssh/id_rsa.pub &amp;lt;jail-data&amp;gt;/home/provision/.ssh/authorized_keys&lt;/code&gt;. It is a&#xA;bit hardcoded, but it will get better support in the future. The idea is to use&#xA;SSH&amp;rsquo;s ProxyCommand to make your host jump box to jail. As Ansible knows how to&#xA;use jump box, you can provision or update your jails on the server.&lt;/p&gt;&#xA;&lt;p&gt;To make all this possible, I created extra files like jail profile, skel, etc,&#xA;but there is also script which switches your DNS entry in /etc/resolv.conf from&#xA;the one DHCP provided (or you entered, if you use static IP) to the resolver&#xA;(jail where BIND9 is running), there are hooks for (de)registering jails, &amp;hellip;&#xA;What I&amp;rsquo;m also trying to achieve is to have my dev environment be exactly the&#xA;same (yeah, right, like that&amp;rsquo;s possible) as my production. Reggae also has&#xA;development mode, in which it will mount your resository&amp;rsquo;s directory on host to&#xA;/usr/src inside jail, create devel user with same UID:GID inside jail that user&#xA;running make has on the host has and it adds one more target, so when you run&#xA;&lt;code&gt;make &amp;amp;&amp;amp; make devel&lt;/code&gt; on yet uninitialized repository, it will provision it if&#xA;needed, run &lt;code&gt;/usr/src/bin/init.sh&lt;/code&gt; and &lt;code&gt;/usr/src/bin/devel.sh&lt;/code&gt;, so by&#xA;implementing those scripts you choose what happens on &lt;code&gt;make devel&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here are some example repos using Reggae:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/tilda-center/website&#34;&gt;Tilda Center website&lt;/a&gt; (development&#xA;mode example)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/mekanix/jail-mail&#34;&gt;EMail service&lt;/a&gt; (Ansible example)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What I&amp;rsquo;d like to see in the future is much of this work merged into CBSD on&#xA;one way or another. This is what makes my development experience nicer, and as&#xA;such I&amp;rsquo;d like it to be less hackish at some parts. Sometimes, it&amp;rsquo;s hackish&#xA;because of a CBSD bug, sometimes because I can&amp;rsquo;t think of a better solution at&#xA;the time. As I use it for testing CBSD in &amp;ldquo;uncharted theritories&amp;rdquo;, I like being&#xA;able to find bugs that wouldn&amp;rsquo;t pop up otherwise. Also, as I&amp;rsquo;d like to use CBSD&#xA;in every situation I can think of, hence making dev env as close to production&#xA;as possible, some extra tools or CBSD features are needed and Reggae is one of&#xA;them, at least for me. The parts that proove to be useful to other people will&#xA;probably go into CBSD or some more official CBSD repository.&lt;/p&gt;&#xA;&lt;p&gt;This is how &lt;code&gt;reggae init&lt;/code&gt; feels like:&lt;/p&gt;&#xA;&lt;script type=&#34;text/javascript&#34; src=&#34;https://asciinema.org/a/NCYU9hyXtcwTq2aZhOlLMj9zk.js&#34; id=&#34;asciicast-NCYU9hyXtcwTq2aZhOlLMj9zk&#34; async&gt;&lt;/script&gt;&#xA;&lt;p&gt;You can use it for development:&lt;/p&gt;&#xA;&lt;script src=&#34;https://asciinema.org/a/QQ3iVvJtacJ3oy4eHM7z7fGHc.js&#34; id=&#34;asciicast-QQ3iVvJtacJ3oy4eHM7z7fGHc&#34; async&gt;&lt;/script&gt;&#xA;&lt;p&gt;Or you can use it for project like service grouping:&lt;/p&gt;&#xA;&lt;script src=&#34;https://asciinema.org/a/ep0fuYUY4cyMgRlhp0lgXvUZx.js&#34; id=&#34;asciicast-ep0fuYUY4cyMgRlhp0lgXvUZx&#34; async&gt;&lt;/script&gt;&#xA;&lt;p&gt;Peek inside service:&lt;/p&gt;&#xA;&lt;script src=&#34;https://asciinema.org/a/rHSbFdSWFUmsb22tTHVJyhy4U.js&#34; id=&#34;asciicast-rHSbFdSWFUmsb22tTHVJyhy4U&#34; async&gt;&lt;/script&gt;&#xA;</description>
    </item>
    <item>
      <title>Getting Started with Digital Audio</title>
      <link>https://meka.rs/blog/2017/11/20/getting-started-with-digital-audio/</link>
      <pubDate>Mon, 20 Nov 2017 03:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/11/20/getting-started-with-digital-audio/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s bad to start your post with an apology, but I must: this one won&amp;rsquo;t deal&#xA;with FreeBSD as much as set some foundation for the posts to come.&lt;/p&gt;&#xA;&lt;p&gt;The base for a good digital audio workstation, or DAW for short is audio&#xA;interface. That is the piece of equipment that will do the most demanding task&#xA;of converting from analog to digital and vice versa. As audio we hear is, after&#xA;all, analog one must pick it&amp;rsquo;s audio interface a bit more carefully than the&#xA;rest of the gear, so here are my tips on choosing a decent one:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;find as much as you can about it&amp;rsquo;s ADC (analog to digital converter) and DAC&#xA;(digital to analog converter)&lt;/li&gt;&#xA;&lt;li&gt;match impedance (more on that later)&lt;/li&gt;&#xA;&lt;li&gt;as high sample/bit rate as possible with internal mixer using more bits than&#xA;ADC/DAC so it has room to handle clipping (common these days is 24/32 bits)&lt;/li&gt;&#xA;&lt;li&gt;ability to be world clock master and slave (more on that later)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Impedance is a fancy word for electrical resistance. It has to do with the fact&#xA;that resistance of a device is not the same in all circumstances. One of those&#xA;situations where this really matters is equalizer: one band actually has lower&#xA;resistance for a certain frequencies, and higher for others. All I&amp;rsquo;m trying to&#xA;emphasize here is that when you here &amp;ldquo;impedance&amp;rdquo; you should think &amp;ldquo;resistance&amp;rdquo;&#xA;and keep in mind that it&amp;rsquo;s dynamic.&lt;/p&gt;&#xA;&lt;p&gt;One thing all electrical circuits like is when impedance of it&amp;rsquo;s output matches&#xA;the one on the input of the next step. When I say &amp;ldquo;like&amp;rdquo;, I mean least amount&#xA;of energy is wasted in transit from one circuit to another (read: you get more&#xA;signal/noise ratio) and the least amount of distortion is introduced&#xA;(unfortunately, every device adds some distortion). So, to have a perfect audio&#xA;interface, choose the one that has mic, line and hi-z inputs. Mic input should&#xA;have 48V option which is needed for condenser microphones (studio microphones).&#xA;Line is what most devices use, like mp3 players, other sound cards and synths.&#xA;Hi-z is just a fancy name for &amp;ldquo;guitar input&amp;rdquo;. What you should look for with hi-z&#xA;is a active/passive switch. Active pickups have small amp inside them and need&#xA;battery, so they are easy to recognize. Passive pickups are the ones without&#xA;battery, and they have 3 to 9 times lower output than active ones (depending on&#xA;the chosen pair of active/passive pickups).&lt;/p&gt;&#xA;&lt;p&gt;As digital audio IO must operate at the precise same frequency across all&#xA;devices, once you get guitar or vocal processor, you&amp;rsquo;ll need to sync your audio&#xA;interface and processor. There are multiple ways for achieving that and it&#xA;mostly depends on the way you&amp;rsquo;re going to connect the devices, but let me explain&#xA;why it&amp;rsquo;s important. All digital devices use &amp;ldquo;the clock&amp;rdquo;. It&amp;rsquo;s what tells them&#xA;&amp;ldquo;hey, it&amp;rsquo;s time for the next sample&amp;rdquo; among other things. That clock is usually&#xA;quartz crystal which has a property of oscillating when electric current is&#xA;introduced. When you have two devices with their own clocks, they have slight&#xA;differences in frequencies which come from slight differences in crystals inside&#xA;them. You might think &amp;ldquo;I don&amp;rsquo;t care about few milliseconds&amp;rdquo; of delay, but that&amp;rsquo;s&#xA;not what&amp;rsquo;s in stake here. If digital device misses the clock beat, all audio&#xA;can become gibberish and noise. This is solved by having devices that can use&#xA;external clock as it&amp;rsquo;s own. Obviously, one of the devices must &amp;ldquo;export&amp;rdquo; it&amp;rsquo;s&#xA;internal clock (acts as master) to other devices (slaves).  S/PDIF and AES/EBU&#xA;digital connections can also transmit the clock but you have to check your&#xA;devices for such capabilities as not all can work this way. The safest option&#xA;is to have World Clock on all of your devices, where your audio interface is&#xA;the master. World Clock connector is BNC. It is especially important when you&#xA;want to connect multiple devices to your computer (for example, via USB) as&#xA;otherwise you&amp;rsquo;ll get a lot of small errors known as jitters.&lt;/p&gt;&#xA;&lt;p&gt;For someone starting with audio, this must sound terribly boring, and maybe too&#xA;technical, so please leave a comment if I didn&amp;rsquo;t cover something properly, or&#xA;you have an idea how to make it more fun.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Cloud and DevOps 3</title>
      <link>https://meka.rs/blog/2017/10/01/freebsd-cloud-and-devops-3/</link>
      <pubDate>Sun, 01 Oct 2017 12:34:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/10/01/freebsd-cloud-and-devops-3/</guid>
      <description>&lt;p&gt;By now you know &lt;a href=&#34;https://meka.rs/blog/2017/04/04/freebsd-cloud-and-devops-2/&#34;&gt;how to manage jails with Makefile&lt;/a&gt;.&#xA;It&amp;rsquo;s nice, but I took it a bit further this past few months. I realized that&#xA;Makefile can effectively replace Vagrant, so I created program called&#xA;&lt;a href=&#34;https://github.com/mekanix/reggae&#34;&gt;Reggae&lt;/a&gt;: REGister Globaly Access Everywhere.&#xA;In short it consists of few scripts that (de)register jail in/from&#xA;&lt;a href=&#34;https://consul.io&#34;&gt;Consul&lt;/a&gt;. As Consul acts as DNS, too, that means that when&#xA;your jail is up, other jails using Consul as DNS will know about it. Also,&#xA;Consul can be used for other things, but it&amp;rsquo;s a different topic.&lt;/p&gt;&#xA;&lt;p&gt;From the last blog post in this series you know how to use Makefile for these&#xA;tasks, but I&amp;rsquo;ll run through some of the Makefiles from my project. There are 3&#xA;.mk files in Reggae:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;project.mk&lt;/li&gt;&#xA;&lt;li&gt;service.mk&lt;/li&gt;&#xA;&lt;li&gt;ansible.mk&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So let me explain how it works on the example of the first project I used it&#xA;with: mail server. If you look at the mail as a project, it consists of few&#xA;services like ldap, webmail, mail (dovecot + postfix) and so on. I have&#xA;mail/Makefile which looks like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;REGGAE_PATH &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; /usr/local/share/reggae&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SERVICES &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; letsencrypt https://github.com/mekanix/jail-letsencrypt &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;           ldap https://github.com/mekanix/jail-ldap &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;           mail https://github.com/mekanix/jail-mail &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;           jabber https://github.com/mekanix/jail-jabber &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;           webmail https://github.com/mekanix/jail-webmail &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;           web https://github.com/mekanix/jail-web &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;           webconsul https://github.com/mekanix/jail-webconsul&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;DOMAIN&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;lust4trust.com&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.include&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;lt;${REGGAE_PATH}/mk/project.mk&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Yes, that&amp;rsquo;s the whole file! The core of the Reggae is SERVICES in project.mk, so&#xA;let&amp;rsquo;s see how it deals with it:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;up&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; fetch setup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.if&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;defined(service)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@echo&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;=== ${service} ===&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@${MAKE}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;${MAKEFLAGS}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;-C&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;services/${service}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;up&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.else&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.for&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;service&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;url&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;${SERVICES}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@echo&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;=== ${service} ===&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@${MAKE}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;${MAKEFLAGS}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;-C&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;services/${service}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;up&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.endfor&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.endif&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Lets break it down. First, &lt;code&gt;up&lt;/code&gt; target depends on &lt;code&gt;fetch&lt;/code&gt; and &lt;code&gt;setup&lt;/code&gt;. Once&#xA;everything needed is downloaded and initialized, one of the two &lt;code&gt;if&lt;/code&gt; branches&#xA;will be triggered. You can run it with &lt;code&gt;make up&lt;/code&gt; or &lt;code&gt;make service=ldap up&lt;/code&gt;.&#xA;Former runs &lt;code&gt;up&lt;/code&gt; on all services (or jails in our case) and later get&amp;rsquo;s only&#xA;ldap jail up. So the if is there to see if &lt;code&gt;service=&amp;lt;something&amp;gt;&lt;/code&gt; is present on the&#xA;command line. If it&amp;rsquo;s not, biggest problem for Reggae starts. That for loop is&#xA;where I lost most time figuring out how to have something I would call &amp;ldquo;list of&#xA;tuples&amp;rdquo; in Python. After a lot of experimenting, I realized that if I use&#xA;&lt;code&gt;service&lt;/code&gt; and &lt;code&gt;url&lt;/code&gt; as indexes in the same loop, it will do what I want. With&#xA;&lt;code&gt;down&lt;/code&gt; target you have to do it in reverse, as some jails might depend on other&#xA;jails (for nullfs mount, perheps?). As &lt;code&gt;SERVICES&lt;/code&gt; is array, not array of pairs,&#xA;you have to reverse the indexes, too: &lt;code&gt;url&lt;/code&gt; and &lt;code&gt;service&lt;/code&gt; in for loop.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;down&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; setup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.if&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;defined(service)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@${MAKE}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;${MAKEFLAGS}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;-C&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;services/${service}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;down&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.else&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;.for url service in ${SERVICES&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;[-1..1]}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;MAKE&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;MAKEFLAGS&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt; -C services/&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;service&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt; down&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.endfor&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.endif&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Service uses all the same Makefile tricks, so let me just show how I provision&#xA;the jails. I implemented ansible.mk as an example, but Reggae is not Ansible&#xA;centric. First thing is to mark the default target to run:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;.MAIN&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; up&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This way it doesn&amp;rsquo;t matter which target is first, &lt;code&gt;up&lt;/code&gt; will be triggered if you&#xA;just type &lt;code&gt;make&lt;/code&gt;. This also solves the problem of adding targets wherever you&#xA;like thus extending what can be done with your project. So let&amp;rsquo;s look at how&#xA;provisioning works.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;provision&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@touch .provisioned&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.if&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;target(do_provision)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@${MAKE}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;${MAKEFLAGS}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;do_provision&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.endif&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is in &lt;code&gt;service.mk&lt;/code&gt; in Reggae. If you defined &lt;code&gt;do_provision&lt;/code&gt; or included&#xA;ansible.mk from Reggae, provision will run it. As a matter of fact, this is how&#xA;ldap service Makefile looks like:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SERVICE &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; ldap&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;REGGAE_PATH &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; /usr/local/share/reggae&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;CUSTOM_TEMPLATES &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; templates&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.include&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;lt;${REGGAE_PATH}/mk/ansible.mk&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.include&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;lt;${REGGAE_PATH}/mk/service.mk&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Including &lt;code&gt;ansible.mk&lt;/code&gt; before &lt;code&gt;service.mk&lt;/code&gt; ensures that &lt;code&gt;do_provision&lt;/code&gt; is&#xA;defined when &lt;code&gt;provision&lt;/code&gt; target from service.mk is parsed. Also, &lt;code&gt;.MAIN&lt;/code&gt; will&#xA;ensure that running just &lt;code&gt;make&lt;/code&gt; doesn&amp;rsquo;t run the first target from ansible.mk.&lt;/p&gt;&#xA;&lt;p&gt;If you need to mount something extra in your jail, you can define &lt;code&gt;EXTRA_FSTAB&lt;/code&gt;&#xA;with the value of path to fstab containing extra mounts. Also, in order for&#xA;provision to work, some files had to be generated from templates, so this is the&#xA;directory hierarchy you need in your service repo:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;templates/site.yml.tpl&lt;/li&gt;&#xA;&lt;li&gt;playbook/group_vars&lt;/li&gt;&#xA;&lt;li&gt;playbook/inventory&lt;/li&gt;&#xA;&lt;li&gt;playbook/roles&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You should know what those are if you ever used Ansible. Also, playbook&#xA;directories are the ones where Reggae will either generate some files (that&#xA;should be in .gitignore) or expect other files to be.&lt;/p&gt;&#xA;&lt;p&gt;The last piece is registering with Consul. So, this is how I configured my&#xA;/etc/rc.conf.d/consul:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;consul_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;consul_args&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;-bind=127.0.2.1 -client=127.0.2.1 -recursor=8.8.8.8 -ui -server -bootstrap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can run Consul in jail, too. As a matter of fact, I do and it&amp;rsquo;s IP is&#xA;special: 127.0.2.1. If you do that, Reggae will just work with Consul. In some&#xA;of the future posts I&amp;rsquo;ll explain how you can use Ansible with Consul to&#xA;provision your jails. If you&amp;rsquo;re inpatient, you can check out my&#xA;&lt;a href=&#34;https://github.com/mekanix/mail&#34;&gt;mail project&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>NuttX and Clang</title>
      <link>https://meka.rs/blog/2017/07/03/nuttx-and-clang/</link>
      <pubDate>Mon, 03 Jul 2017 15:23:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/07/03/nuttx-and-clang/</guid>
      <description>&lt;p&gt;I am proud owner of a home audio studio, but it has a big flaw: hardware is not&#xA;open source. You may think it&amp;rsquo;s not a big deal, but once you want to alter&#xA;something, you realize you&amp;rsquo;re stuck. Let me explain. My mixer is digital and&#xA;you control it over some other device (computer, or android based device). It&amp;rsquo;s&#xA;a nice feature, and it has USB connection, so it can act as an audio interface.&#xA;The problem with that is 48kHz sampling, which is OK for live gigs, but not so&#xA;much for studio recordings. On the other hand, I have audio interface with 96kHz&#xA;sampling, but it can not work as stand alone mixer. To  be honest, I don&amp;rsquo;t know&#xA;anything about DSP and embeded programming, but I said to myself &amp;ldquo;I know I can&#xA;do better than this&amp;rdquo;. That&amp;rsquo;s how &amp;ldquo;the ride&amp;rdquo; began.&lt;/p&gt;&#xA;&lt;p&gt;Since then I really wanted to make Arduino Due working, but for some reason GCC&#xA;on FreeBSD gave a faulty binary. Back then I was desperate and I knew there is&#xA;absolutely no way I can fix the issue with the compiler. Hell, I couldn&amp;rsquo;t even&#xA;use it as developer, let alone debug it. So there came Clang/LLVM.&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&#34;https://meka.rs/blog/2017/06/02/arduino-due-and-clang/&#34;&gt;one of the previous posts&lt;/a&gt; I wrote&#xA;about compiling blink LED test with Clang. That gave me hope that FreeBSD might&#xA;be the perfect platform for me for embeded programming. As my end goal is to&#xA;create a digital mixer with proper sampling rate, I knew from the begining I can&#xA;not just write any code. It must be real time and optimized really good. I&amp;rsquo;ve&#xA;got to be honest with you: there are two obstacles for me to write such a code.&#xA;First one is that Arduino libraries are not optimal. I didn&amp;rsquo;t check, but I do&#xA;have friends who are professional embeded programmers who told me that. Second&#xA;one is that I&amp;rsquo;m system administrator. You can not imagine the desparation of a&#xA;sys admin staring at the board which doesn&amp;rsquo;t blink.&lt;/p&gt;&#xA;&lt;p&gt;Now for the good part. I discovered &lt;a href=&#34;http://www.nuttx.org/&#34;&gt;NuttX&lt;/a&gt;. A friend in&#xA;Tilda hackerspace asked me how do I search for such cool things, and the only&#xA;answer I had was &amp;ldquo;gut feeling&amp;rdquo;. Later I discovered that even&#xA;&lt;a href=&#34;https://www.youtube.com/watch?v=T8fLjWyI5nI&#34;&gt;Sony is using it&lt;/a&gt; for audio in&#xA;some of their products. Even better, they use C++11, which is like a scripting&#xA;language compared to &amp;ldquo;plain&amp;rdquo; C++ I used back in 2008. When I say &amp;ldquo;used&amp;rdquo; it&amp;rsquo;s an&#xA;overstatement. I think more apropriate phrase would be &amp;ldquo;I played with it&amp;rdquo;. So, I&#xA;made my goal to make NuttX compile with Clang, and I made it. You can check out&#xA;&lt;a href=&#34;https://github.com/mekanix/nuttx/tree/feature/clang&#34;&gt;my fork&lt;/a&gt; for now, until&#xA;the patch makes it into the official repository. Although I used FreeBSD for&#xA;development, I hope it&amp;rsquo;s generic enough to be used on other OSes which Clang/LLVM&#xA;supports. It still lacks LLVM libc++ support, and that&amp;rsquo;s what we&amp;rsquo;ll be working on&#xA;in the hackerspace today (Tuesday it&amp;rsquo;s embeded programming day) and in the&#xA;future.&lt;/p&gt;&#xA;&lt;p&gt;So, the final product will be digital mixer which can be controlled over network&#xA;based on NuttX, Clang,&#xA;&lt;a href=&#34;http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-f401re.html&#34;&gt;Nucleo F401RE&lt;/a&gt;,&#xA;and Cirus Logic &lt;a href=&#34;http://www.mouser.com/ds/2/76/CS4384_F1-39004.pdf&#34;&gt;DAC&lt;/a&gt; /&#xA;&lt;a href=&#34;http://www.mouser.com/ds/2/76/CirrusLogic_CS5368_F5-356402.pdf&#34;&gt;ADC&lt;/a&gt;. The DAC/ADC choice was made by a new found friend from France I will&#xA;talk about in some of the next posts (tramendesly interesting guy) who also&#xA;wrote audio and midi server for NuttX.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD and USB MIDI</title>
      <link>https://meka.rs/blog/2017/06/17/freebsd-and-usb-midi/</link>
      <pubDate>Sat, 17 Jun 2017 23:37:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/06/17/freebsd-and-usb-midi/</guid>
      <description>&lt;p&gt;The problem I was having was that I could record MIDI, but not send it to&#xA;hardware output. For impatient, just run &lt;code&gt;chmod o+rw /dev/umidi*&lt;/code&gt;. Yes, it was&#xA;that stupid and it took me few days to realize what&amp;rsquo;s the problem, so let&amp;rsquo;s go&#xA;through my setup and debug process. It will be fun, I promice.&lt;/p&gt;&#xA;&lt;p&gt;I never used hardware MIDI before, although I used software MIDI for various&#xA;things for years, so I have a rough feeling how things should work. Anyway, I&#xA;have a footswitch (Behringer FCB1010) MIDI out into USB audio interface&#xA;(Presonus AudioBox 1818VLS) in. Then &lt;code&gt;jack_umidi -d /dev/umidi0.0&lt;/code&gt; exposes&#xA;hardware MIDI ports as jack MIDI ports. You can use &lt;code&gt;jack_lsp&lt;/code&gt; to display all&#xA;jack ports and &lt;code&gt;jack_connect &amp;lt;out&amp;gt; &amp;lt;in&amp;gt;&lt;/code&gt; to connect whatever is coming from&#xA;input to output and make your audio interface act as MIDI thru. That way I use&#xA;Presonus as a &amp;ldquo;proxy&amp;rdquo; between FCB1010 and my guitar processor (Line 6 POD X3 Pro)&#xA;in order to be able to record controls at the same time as I record dry guitar.&#xA;I noticed that if I remove Presonus as proxy, controls work, but with it I&#xA;couldn&amp;rsquo;t get it to work. I tested to make sure jack is emitting MIDI messages&#xA;all, and it did. I tested hardware using my wife&amp;rsquo;s laptop and Linux, and that&#xA;worked. At that point I realized it can be too many things, as I have too much&#xA;apps in my setup, so I decided to make it as simple as possible: write a MIDI&#xA;program in C based on &lt;a href=&#34;http://manuals.opensound.com/developer/softsynth.c.html&#34;&gt;synth example&lt;/a&gt;.&#xA;To be precise, I wanted to use the &lt;code&gt;open_midi_device&lt;/code&gt; and then whatever I read&#xA;from it, I write to it back. The dumbest MIDI thru ever! Given example uses MIDI&#xA;device in read only mode, but I needed read/write. Once I tried to alter it, I&#xA;got &lt;code&gt;Permission denied&lt;/code&gt;. Looking at /dev/umidi0.0 permissions, no wonder, because&#xA;it&amp;rsquo;s owner is root, group is operator and it&amp;rsquo;s mod is 644. To make this right,&#xA;add this rules to &lt;code&gt;/etc/devfs.rules&lt;/code&gt; (create if it doesn&amp;rsquo;t exist):&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;localrules&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;5&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;add path &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;umidi*&amp;#39;&lt;/span&gt; mode &lt;span style=&#34;color:#ae81ff&#34;&gt;0666&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To make those rules active, add &lt;code&gt;devfs_system_ruleset=&amp;quot;localrules&amp;quot;&lt;/code&gt; to&#xA;&lt;code&gt;/etc/rc.conf&lt;/code&gt;. On next reboot everything will be just fine.&lt;/p&gt;&#xA;&lt;p&gt;Have fun with the MIDI!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Arduino Due and Clang</title>
      <link>https://meka.rs/blog/2017/06/02/arduino-due-and-clang/</link>
      <pubDate>Fri, 02 Jun 2017 04:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/06/02/arduino-due-and-clang/</guid>
      <description>&lt;p&gt;Since October last year I&amp;rsquo;ve been trying to get my FreeBSD box compile working&#xA;binary for Arduino Due. For some reason, GCC produced binary is missing a&#xA;section which I observed through readelf. I tried to debug this, but I&amp;rsquo;m not&#xA;even novice kernel developer, let alone bare metal embeded programmer. All that&#xA;changed tonight (or should I say in the 4am today) when I stumbled upon&#xA;&lt;a href=&#34;http://hannobraun.de/embedded/2015-04-30-building-with-llvm/&#34;&gt;just the right post&lt;/a&gt;.&#xA;I want to be clear, Hanno Braun did all the work, I just want to point out how&#xA;to get it working on your FreeBSD box.&lt;/p&gt;&#xA;&lt;p&gt;I use -STABLE branch currently so system compiler is Clang 4.0. Beside that&#xA;you&amp;rsquo;ll need few extra packages.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pkg install bossa arm-none-eabi-gcc&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Bossa is used to upload the binary to Arduno and GNU linker for ARM is used as&#xA;LLDB is not ready, yet (or I didn&amp;rsquo;t find example how to use it with Arduino).&#xA;Also, you&amp;rsquo;ll need to add your user into dialer group.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pw group mod dialer -m &amp;lt;user&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s say we have &lt;code&gt;blink.c&lt;/code&gt; file with the code which blinks the onboard LED and&#xA;&lt;code&gt;linker-script.ld&lt;/code&gt; mentioned in the Hanno&amp;rsquo;s post. Just for reference, this is&#xA;how he compiles the binary:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cc -nostdlib -ffreestanding -target arm-none-eabi -march&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;armv7-m -Tlinker-script.ld -Wl,--entry&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;start blink.c -o blink.elf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;arm-none-eabi-objcopy -O binary blink.elf blink.bin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On my box, resulting &lt;code&gt;blink.bin&lt;/code&gt; is 332 bytes! Not bad!&lt;/p&gt;&#xA;&lt;p&gt;The flashing part is a bit different on FreeBSD. First, you have to issue soft&#xA;erase by connecting to serial port provided by Arduino using 1200 baud. You just&#xA;have to connect, so nothing extra is needed.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cu -l /dev/cuaU0 -s &lt;span style=&#34;color:#ae81ff&#34;&gt;1200&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Also, you&amp;rsquo;ll have to tell Bossa utility which device file to use.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bossac --write --verify -p /dev/cuaU0 --boot -R blink.bin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Your Arduino Due should be blinking, now. Just for the sake of completeness, I&amp;rsquo;ll&#xA;show what Hanno wrote in .c and .ld file.&lt;/p&gt;&#xA;&lt;p&gt;blink.c:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-C&#34; data-lang=&#34;C&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// This is the top of the stack, as provided to us by the linker.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;extern&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;unsigned&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; _estack;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// This is a partial definition of the vector table. It only defines the&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// first two entries which, as far as I can tell, are the minimum needed&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// for a program to work at all.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Space for the other interrupt handlers is reserved. I&amp;#39;m not sure if this&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// is necessary, but I can imagine that the vector table not having the&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// right length could cause all kinds of problems (imagine if it was too&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// short, and the linker would place something else directly after it).&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;initial_stack_pointer_value;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;reset_handler;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; other_interrupt_vectors[&lt;span style=&#34;color:#ae81ff&#34;&gt;44&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]; &lt;span style=&#34;color:#75715e&#34;&gt;// space for 44 32-bit pointers&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} VectorTable;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;start&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// The vector table. We&amp;#39;re using GCC-specific functionality to place this&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// into the .vectors section, not where it would normally go (I suppose&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// .rodata). The linker script makes sure that the .vectors section is at&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// the right place.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;__attribute__&lt;/span&gt; ((&lt;span style=&#34;color:#a6e22e&#34;&gt;section&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;.vectors&amp;#34;&lt;/span&gt;)))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; VectorTable vector_table &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;_estack),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)start,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;};&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Addresses of several registers used to control parallel I/O.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;volatile&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; pb_pio_enable          &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#ae81ff&#34;&gt;0x400E1000&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;volatile&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; pb_output_enable       &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#ae81ff&#34;&gt;0x400E1010&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;volatile&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; pb_set_output_data     &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#ae81ff&#34;&gt;0x400E1030&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;volatile&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; pb_clear_output_data   &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#ae81ff&#34;&gt;0x400E1034&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Bit mask for PB27. This is pin 13 (the built-in LED) on the Arduino Due.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; pb27_mask &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08000000&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Addresses of several registers used to control the real-time timer.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;volatile&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; timer_mode_register  &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#ae81ff&#34;&gt;0x400E1A30&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;volatile&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; timer_value_register &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#ae81ff&#34;&gt;0x400E1A38&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// As the name suggests, this function sleeps for a given number of&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// milliseconds. Our replacement for Arduino&amp;#39;s delay function.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;sleep_ms&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; milliseconds) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; sleep_until &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;timer_value_register &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; milliseconds;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;timer_value_register &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; sleep_until) {}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// This function is the entry point for our application and the handler&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// function for the reset interrupt.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;start&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#75715e&#34;&gt;// Enable PB27 (pin 13) and configure it for output.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;pb_pio_enable    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pb27_mask;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;pb_output_enable &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pb27_mask;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#75715e&#34;&gt;// Set the timer to a resolution of a millisecond.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;timer_mode_register &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000020&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#75715e&#34;&gt;// Continuously set and clear output on PB27 (pin 13). This blinks&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#75715e&#34;&gt;// the Due&amp;#39;s built-in LED, which is the single purpose of this&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#75715e&#34;&gt;// program.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&#x9;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;pb_set_output_data &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pb27_mask;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&#x9;&lt;span style=&#34;color:#a6e22e&#34;&gt;sleep_ms&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;200&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&#x9;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;pb_clear_output_data &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pb27_mask;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&#x9;&lt;span style=&#34;color:#a6e22e&#34;&gt;sleep_ms&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;200&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;linker-script.ld:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/* ----------------------------------------------------------------------------&#xA; *         SAM Software Package License&#xA; * ----------------------------------------------------------------------------&#xA; * Copyright (c) 2012, Atmel Corporation&#xA; *&#xA; * All rights reserved.&#xA; *&#xA; * Redistribution and use in source and binary forms, with or without&#xA; * modification, are permitted provided that the following condition is met:&#xA; *&#xA; * - Redistributions of source code must retain the above copyright notice,&#xA; * this list of conditions and the disclaimer below.&#xA; *&#xA; * Atmel&amp;#39;s name may not be used to endorse or promote products derived from&#xA; * this software without specific prior written permission.&#xA; *&#xA; * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL &amp;#34;AS IS&amp;#34; AND ANY EXPRESS OR&#xA; * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF&#xA; * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE&#xA; * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,&#xA; * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT&#xA; * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,&#xA; * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&#xA; * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&#xA; * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,&#xA; * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&#xA; * ----------------------------------------------------------------------------&#xA; */&#xA;&#xA;OUTPUT_FORMAT(&amp;#34;elf32-littlearm&amp;#34;, &amp;#34;elf32-littlearm&amp;#34;, &amp;#34;elf32-littlearm&amp;#34;)&#xA;OUTPUT_ARCH(arm)&#xA;SEARCH_DIR(.)&#xA;&#xA;/* Memory Spaces Definitions */&#xA;MEMORY&#xA;{&#xA;&#x9;rom (rx)    : ORIGIN = 0x00080000, LENGTH = 0x00080000 /* Flash, 512K */&#xA;&#x9;sram0 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00010000 /* sram0, 64K */&#xA;&#x9;sram1 (rwx) : ORIGIN = 0x20080000, LENGTH = 0x00008000 /* sram1, 32K */&#xA;&#x9;ram (rwx)   : ORIGIN = 0x20070000, LENGTH = 0x00018000 /* sram, 96K */&#xA;}&#xA;&#xA;/* Section Definitions */&#xA;SECTIONS&#xA;{&#xA;    .text :&#xA;    {&#xA;        . = ALIGN(4);&#xA;        _sfixed = .;&#xA;        KEEP(*(.vectors .vectors.*))&#xA;        *(.text .text.* .gnu.linkonce.t.*)&#xA;        *(.glue_7t) *(.glue_7)&#xA;        *(.rodata .rodata* .gnu.linkonce.r.*)&#xA;        *(.ARM.extab* .gnu.linkonce.armextab.*)&#xA;&#xA;        /* Support C constructors, and C destructors in both user code&#xA;           and the C library. This also provides support for C++ code. */&#xA;        . = ALIGN(4);&#xA;        KEEP(*(.init))&#xA;        . = ALIGN(4);&#xA;        __preinit_array_start = .;&#xA;        KEEP (*(.preinit_array))&#xA;        __preinit_array_end = .;&#xA;&#xA;        . = ALIGN(4);&#xA;        __init_array_start = .;&#xA;        KEEP (*(SORT(.init_array.*)))&#xA;        KEEP (*(.init_array))&#xA;        __init_array_end = .;&#xA;&#xA;        . = ALIGN(0x4);&#xA;        KEEP (*crtbegin.o(.ctors))&#xA;        KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))&#xA;        KEEP (*(SORT(.ctors.*)))&#xA;        KEEP (*crtend.o(.ctors))&#xA;&#xA;        . = ALIGN(4);&#xA;        KEEP(*(.fini))&#xA;&#xA;        . = ALIGN(4);&#xA;        __fini_array_start = .;&#xA;        KEEP (*(.fini_array))&#xA;        KEEP (*(SORT(.fini_array.*)))&#xA;        __fini_array_end = .;&#xA;&#xA;        KEEP (*crtbegin.o(.dtors))&#xA;        KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))&#xA;        KEEP (*(SORT(.dtors.*)))&#xA;        KEEP (*crtend.o(.dtors))&#xA;&#xA;        . = ALIGN(4);&#xA;        _efixed = .;            /* End of text section */&#xA;    } &amp;gt; rom&#xA;&#xA;    /* .ARM.exidx is sorted, so has to go in its own output section.  */&#xA;    PROVIDE_HIDDEN (__exidx_start = .);&#xA;    .ARM.exidx :&#xA;    {&#xA;      *(.ARM.exidx* .gnu.linkonce.armexidx.*)&#xA;    } &amp;gt; rom&#xA;    PROVIDE_HIDDEN (__exidx_end = .);&#xA;&#xA;    . = ALIGN(4);&#xA;    _etext = .;&#xA;&#xA;    .relocate : AT (_etext)&#xA;    {&#xA;        . = ALIGN(4);&#xA;        _srelocate = .;&#xA;        *(.ramfunc .ramfunc.*);&#xA;        *(.data .data.*);&#xA;        . = ALIGN(4);&#xA;        _erelocate = .;&#xA;    } &amp;gt; ram&#xA;&#xA;    /* .bss section which is used for uninitialized data */&#xA;    .bss ALIGN(4) (NOLOAD) :&#xA;    {&#xA;        . = ALIGN(4);&#xA;        _sbss = . ;&#xA;        _szero = .;&#xA;        *(.bss .bss.*)&#xA;        *(COMMON)&#xA;        . = ALIGN(4);&#xA;        _ebss = . ;&#xA;        _ezero = .;&#xA;    } &amp;gt; ram&#xA;&#xA;    . = ALIGN(4);&#xA;    _end = . ;&#xA;&#xA;    /* .stack_dummy section doesn&amp;#39;t contains any symbols. It is only&#xA;       used for linker to calculate size of stack sections, and assign&#xA;       values to stack symbols later */&#xA;    .stack_dummy :&#xA;    {&#xA;        *(.stack*)&#xA;    } &amp;gt; ram&#xA;&#xA;    /* Set stack top to end of ram, and stack limit move down by&#xA;     * size of stack_dummy section */&#xA;    __StackTop = ORIGIN(ram) + LENGTH(ram);&#xA;    __StackLimit = __StackTop - SIZEOF(.stack_dummy);&#xA;    PROVIDE(_sstack = __StackLimit);&#xA;    PROVIDE(_estack = __StackTop);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>FreeBSD Cloud and DevOps 2</title>
      <link>https://meka.rs/blog/2017/04/04/freebsd-cloud-and-devops-2/</link>
      <pubDate>Tue, 04 Apr 2017 12:17:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/04/04/freebsd-cloud-and-devops-2/</guid>
      <description>&lt;p&gt;So you have all the pieces installed and configured. Let&amp;rsquo;s do something on top&#xA;of that. I don&amp;rsquo;t like Vagrant, now that CBSD and Jails are around, but it&amp;rsquo;s&#xA;perfect for DevOps jobs. I remember a friend of mine using Makefile for DevOps,&#xA;even if under it is Docker or Vagrant. It&amp;rsquo;s small, portable and available on&#xA;every OS worth mentioning. Nice way to keep everything low on resource usage.&lt;/p&gt;&#xA;&lt;p&gt;So, let&amp;rsquo;s say we want to have at least 2 targets: up and setup. Setup would set&#xA;up config files, where up would do the actual job. For example:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PROJECT&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;myproj&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;up&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; setup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo cbsd jstart &lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PROJECT&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;setup&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sed -e &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s:PROJECT:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PROJECT&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;:g&amp;#34;&lt;/span&gt; provision/inventory.tpl &amp;gt;provision/inventory&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sed -e &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s:PROJECT:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PROJECT&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;:g&amp;#34;&lt;/span&gt; provision/group_vars/all.tpl &amp;gt;provision/group_vars/all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sed -e &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s:PROJECT:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PROJECT&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;:g&amp;#34;&lt;/span&gt; provision/localhost.yml.tpl &amp;gt;provision/localhost.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sed -e &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s:PROJECT:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PROJECT&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;:g&amp;#34;&lt;/span&gt; provision/site.yml.tpl &amp;gt;provision/site.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo cbsd jcreate jconf&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PWD&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/cbsd.conf &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo sh -c &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;sed -e &amp;#34;s:PWD:${PWD}:g&amp;#34; -e &amp;#34;s:PROJECT:${PROJECT}:g&amp;#34; fstab.conf &amp;gt;/cbsd/jails-fstab/fstab.${PROJECT}&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can see that &lt;code&gt;up&lt;/code&gt; target is using cbsd.conf and fstab.conf. You can generate&#xA;cbsd.conf with &lt;code&gt;cbsd jconstruct-tui&lt;/code&gt;, like usual, just choose not to start it&#xA;once you configure it and CBSD will save the config in temporary file you can&#xA;use as a template. The fstab.conf is simple:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/cbsd/jails-data/PROJECT-data/etc /etc nullfs rw &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/cbsd/jails-data/PROJECT-data/root /root nullfs rw &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/cbsd/jails-data/PROJECT-data/tmp /tmp nullfs rw &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/cbsd/jails-data/PROJECT-data/usr/home /usr/home nullfs rw &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/cbsd/jails-data/PROJECT-data/usr/local /usr/local nullfs rw &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/cbsd/jails-data/PROJECT-data/usr/compat /usr/compat nullfs rw &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/cbsd/jails-data/PROJECT-data/var /var nullfs rw &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PWD /usr/home/devel/workdir nullfs rw &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;One nice thing Vagrant has is it will provision your VM if it has provisioner&#xA;configured if it&amp;rsquo;s the first time you&amp;rsquo;re starting that VM. Let&amp;rsquo;s add that:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;up&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; setup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo cbsd jcreate jconf&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PWD&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/cbsd.conf &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.if&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;!exists(.provisioned)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@${MAKE}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;${MAKEFLAGS}&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;provision&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;.endif&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;provision&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo ansible-playbook -i provision/inventory provision/site.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@touch .provisioned&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Instead of &lt;code&gt;vagrant ssh&lt;/code&gt; I added &lt;code&gt;make login&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;login&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; up&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo cbsd jlogin &lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PROJECT&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, there are tear down targets, as well:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Makefile&#34; data-lang=&#34;Makefile&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;down&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; setup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo cbsd jstop &lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PROJECT&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo ansible-playbook -i provision/inventory provision/teardown.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;destroy&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; down&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@rm -f provision/inventory provision/site.yml provision/group_vars/all .provisioned&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;@sudo cbsd jremove &lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;PROJECT&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All that&amp;rsquo;s left now is to write Ansible playbook, but I&amp;rsquo;ll leave that for some&#xA;other post.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Sing, beastie, sing!</title>
      <link>https://meka.rs/blog/2017/01/25/sing-beastie-sing/</link>
      <pubDate>Wed, 25 Jan 2017 19:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/01/25/sing-beastie-sing/</guid>
      <description>&lt;p&gt;FreeBSD digital audio workstation, or DAW for short, is now possible. At this&#xA;very moment it&amp;rsquo;s not user friendly that much, but you&amp;rsquo;ll manage. What I want to&#xA;say is that I worked on porting some of the audio apps to FreeBSD, met some&#xA;other people interested in porting audio stuff and became heavily involved with&#xA;DrumGizmo - drum sampling engine. Let me start with the basic setup.&lt;/p&gt;&#xA;&lt;p&gt;FreeBSD doesn&amp;rsquo;t have hard real-time support, but it&amp;rsquo;s pretty close. For the&#xA;needs of audio, FreeBSD&amp;rsquo;s implementation of real-time is sufficient and, in my&#xA;opinion, superior to the one you can get on Linux with RT path (which is ugly,&#xA;not supported by distributions and breaks apps like VirtualBox). As default&#xA;install of FreeBSD is concerned with real-time too much, we have to tweak sysctl&#xA;a bit, so append this to your /etc/sysctl.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kern.timecounter.alloweddeviation&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hw.usb.uaudio.buffer_ms&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# only on -STABLE for now&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hw.snd.latency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kern.coredump&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So let me go through the list. First item tells FreeBSD how many events it can&#xA;aggregate (or wait for) before emitting them. The reason this is the default is&#xA;because aggregating events saves power a bit, and currently more laptops are&#xA;running FreeBSD than DAWs. Second one is the lowest possible buffer for USB&#xA;audio driver. If you&amp;rsquo;re not using USB audio, this won&amp;rsquo;t change a thing. Third&#xA;option is for defining default latency if program doesn&amp;rsquo;t set one. Every program&#xA;can change this value for it self, but most of them don&amp;rsquo;t deal with this. Fourth&#xA;one has nothing to do with real-time, but dealing with programs that consume&#xA;~3GB of RAM, dumping cores around made a problem on my machine. Besides, core&#xA;dumps are only useful if you know how to debug the problem, or someone is&#xA;willing to do that for you. I like to not generate those files by default, but&#xA;if some app is constantly crashing, I enable dumps, run the app, crash it, and&#xA;disable dumps again. I lost 30GB in under a minute by examining 10 different&#xA;drumkits of DrumGizmo and all of them gave me 3GB of core file.&lt;/p&gt;&#xA;&lt;p&gt;If you have audio interface with more than 8 channels, you&amp;rsquo;ll need virtual_oss&#xA;and virtual_oss_ctl. The decision was made that more than 8 channels of audio&#xA;are more suitable to be mixed, resampled and generally processed in user space.&#xA;&lt;a href=&#34;https://github.com/mekanix/virtual_oss_rc&#34;&gt;My rc script&lt;/a&gt; for virtual_oss is&#xA;still pending, as I just can&amp;rsquo;t find the time to work on it. Copy virtual_oss&#xA;from that repo to /usr/local/etc/rc.d and it will start virtual_oss assuming&#xA;your audio interface has 18 channels. You have to add &lt;code&gt;virtual_oss_enable=&amp;quot;YES&amp;quot;&lt;/code&gt;&#xA;to your /etc/rc.conf and you can alter the arguments by adding your own&#xA;&lt;code&gt;virtual_oss_flags=&amp;quot;...&amp;quot;&lt;/code&gt;. For example, take a look at the rc script, as it has&#xA;default value of virtual_oss_flags.&lt;/p&gt;&#xA;&lt;p&gt;Next is my jack setup, which is oneliner:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# jackd -r -d oss -r 88200 -C /dev/vdsp.jack -P /dev/vdsp.jack -i 18 -o 18&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;m not using real-time for jack, as it&amp;rsquo;s not supported for a non-root process&#xA;to raise it&amp;rsquo;s priority to real-time. You can do that by&#xA;&lt;code&gt;sudo rtprio 10 -(pgrep jackd)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Currently, Ardour 5.5 and DrumGizmo are in conflict.&#xA;&lt;a href=&#34;https://github.com/tilda-center/freebsd-ports&#34;&gt;Our hackerspace forked FreeBSD ports&lt;/a&gt;&#xA;and added a quick patch for Ardour which removes the conflict. I talked to the&#xA;maintainer of the port about it and he&amp;rsquo;s working on a proper patch and will try&#xA;to push it upstream, to Ardour developers.&lt;/p&gt;&#xA;&lt;p&gt;As there are some resampling problems with virtual_oss, you&amp;rsquo;re advised to use&#xA;PulseAudio (not my favorite solution) by telling it to use virtual_oss. You&amp;rsquo;ll&#xA;have to add the following to the /usr/local/etc/pulse/default.pa:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;load-module module-oss device&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/dev/vdsp.jack&amp;#34;&lt;/span&gt; sink_name&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;output source_name&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;input&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And just for the reference, this is my virtual_oss config:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;virtual_oss_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;virtual_oss_flags&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;-S -i 8 -C 18 -c 18 -r 88200 -b 32 -s 384 -f /dev/dsp0 -c 2 -d dsp -c 18 -d vdsp.jack -t vdsp.ctl -M i,0,8,0,0,0 -M i,0,9,0,0,0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;-S: enable resampling&lt;/li&gt;&#xA;&lt;li&gt;-i: enable real time&lt;/li&gt;&#xA;&lt;li&gt;-c/-C: 18ch in/out&lt;/li&gt;&#xA;&lt;li&gt;-r: sampling rate&lt;/li&gt;&#xA;&lt;li&gt;-b: bits&lt;/li&gt;&#xA;&lt;li&gt;-s: size of buffer&lt;/li&gt;&#xA;&lt;li&gt;-d: virtual oss device to create&lt;/li&gt;&#xA;&lt;li&gt;-t: virtual oss control device to create&lt;/li&gt;&#xA;&lt;li&gt;-M: mirror first input to outputs 8/9&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The reason I mirror first input (input zero) to 8/9 is because I use my first&#xA;input for guitar, and outputs 8/9 are towards guitar processor. With this setup&#xA;I can play OSS, JACK and PulseAudio sound all at the same time, which I was not&#xA;able to do on Linux.&lt;/p&gt;&#xA;&lt;p&gt;Now sing, beastie!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Cloud and DevOps 1</title>
      <link>https://meka.rs/blog/2017/01/08/freebsd-cloud-and-devops-1/</link>
      <pubDate>Sun, 08 Jan 2017 16:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/01/08/freebsd-cloud-and-devops-1/</guid>
      <description>&lt;p&gt;The reason I tried FreeBSD in August, after 11 years of being happy with Gentoo&#xA;then Debian was the article about Docker on FreeBSD. I knew about PF, ZFS and&#xA;DTrace from the past, but ability to run Linux images was just too good to be&#xA;true. To the extent, it is too good, and the reason is that ABI Linux support is&#xA;not complete. If you happen to need that missing bit in ABI, it&amp;rsquo;s a show stopper&#xA;for anybody.&lt;/p&gt;&#xA;&lt;p&gt;Poor was the result, I&amp;rsquo;m afraid, but there&amp;rsquo;s a positive side: Docker is not why&#xA;I&amp;rsquo;m stuck with FreeBSD now. :o) There are so much better implementations of&#xA;container technologies, I abandoned Docker completely. That and&#xA;&lt;a href=&#34;https://thehftguy.com/2016/11/01/docker-in-production-an-history-of-failure/&#34;&gt;Docker&amp;rsquo;s continuous failure&lt;/a&gt;&#xA;make you think of changing the tech stack completely. In this serie, I&amp;rsquo;ll walk&#xA;you through my current stack for production and devops.&lt;/p&gt;&#xA;&lt;p&gt;For start, let me give you some of the vocabulary:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ZFS - File system and volume manager.&lt;/li&gt;&#xA;&lt;li&gt;Jail - Container technology, most similar to Linux LXC or Solaris Zones. Some&#xA;think of it as chroot on steroids.&lt;/li&gt;&#xA;&lt;li&gt;PF - Packet Filter - firewall.&lt;/li&gt;&#xA;&lt;li&gt;BHyve - Type 2 hypervizor, or what provides VMs - virtual machines.&lt;/li&gt;&#xA;&lt;li&gt;DNSMasq - DHCP and DNS server - keeps track of which virtual machine is where.&lt;/li&gt;&#xA;&lt;li&gt;CBSD - Manages jails and virtual machines - create, up, down, destroy.&lt;/li&gt;&#xA;&lt;li&gt;Sudo - Execute stuff as root when needed - devops side, mostly.&lt;/li&gt;&#xA;&lt;li&gt;Make{,file} - Make is similar to GNU make with all it&amp;rsquo;s rules in Makefile.&lt;/li&gt;&#xA;&lt;li&gt;Resolvconf - Software which configures /etc/resolv.conf&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For this post I want you to get a working CBSD env. I&amp;rsquo;ll just assume you have&#xA;machine which you&amp;rsquo;ll dedicate to FreeBSD only. Tips for install: use &amp;ldquo;Guided ZFS&#xA;partitioning&amp;rdquo; and create user when asked. You&amp;rsquo;ll get to know the ZFS over time,&#xA;but for now think of it as a requirement for easier jail and VM management. So,&#xA;the only thing you have after install is FreeBSD base system on ZFS pool (by&#xA;default, it&amp;rsquo;s name is zroot), root user and a regular user. As root prepare the&#xA;CBSD:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# zfs create -o mountpoint=/cbsd zroot/cbsd&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# pkg install cbsd dnsmasq bind-tools tightvnc&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# env workdir=&amp;#34;/cbsd&amp;#34; /usr/local/cbsd/sudoexec/initenv&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# mkdir /usr/local/etc/dnsmasq.d&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What this does is creates ZFS dataset which will be mounted on /cbsd as soon as&#xA;&lt;code&gt;zfs create&lt;/code&gt; finishes. For now you can think of a dataset as of a partition&#xA;which can be created and destroyed while ZFS pool is mounted. Don&amp;rsquo;t worry if you&#xA;don&amp;rsquo;t undestand ZFS features, it&amp;rsquo;s really complex piece of software.&lt;/p&gt;&#xA;&lt;p&gt;After ZFS dataset creation, &lt;code&gt;pkg&lt;/code&gt; installs CBSD and CBSD is initialized. I have&#xA;few tips for the initialization, as it&amp;rsquo;s interactive: don&amp;rsquo;t enable NAT, use&#xA;172.16.0.1 for DNS and &amp;ldquo;10.0.0.0/16 10.0.0.1/32&amp;rdquo; for IP range. Although CBSD&#xA;does great job at figuring out what PF rules it should insert/remove, I like all&#xA;the rules in one place, /etc/pf.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ext_if &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;re0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;jail_if &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lo1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bridge_if &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bridge1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set skip on &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; lo0, $jail_if, $bridge_if &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scrub in all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nat on $ext_if from &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;$jail_if:network&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;$bridge_if:network&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt; to any -&amp;gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;$ext_if&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;block in log all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass out all keep state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto tcp to any port ssh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass inet proto &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; icmp, igmp &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can see lo1 and bridge1 interfaces, so they have to be configured. That&amp;rsquo;s&#xA;done in /etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cloned_interfaces&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bridge1 lo1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_bridge1&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;description re0 172.16.0.1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_lo1&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A bit of an explanation is needed. First, lo1 will be used for jails, bridge1&#xA;for VMs. As CBSD does great job of automating VM management, it also creates&#xA;bridge and tap interface(s). As I wanted the network part to be as static as&#xA;possible, I&amp;rsquo;m creating bridge1 the way CBSD would and give it the IP which VMs&#xA;will use as DNS server and gateway. My only network card on desktop is re0,&#xA;hence the description. Disclaimer: all this CBSD network mangling is more&#xA;appropriately done by patching /cbsd/vnet.subr and /cbsd/vnet-tui.subr.&lt;/p&gt;&#xA;&lt;p&gt;You have to enable PF, of course. I like to do it in /etc/rc.conf.d directory for&#xA;DevOps purposes I&amp;rsquo;ll talk about later. There are two files for PF: pf and pflog.&lt;/p&gt;&#xA;&lt;p&gt;/etc/rc.conf.d/pf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pf_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;/etc/rc.conf.d/pflog:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pflog_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As CBSD doesn&amp;rsquo;t provide DHCP or DNS for VMs, we&amp;rsquo;ll use DNSMasq. For devops on&#xA;your desktop/laptop it&amp;rsquo;s enough and even for small to mid size cloud setups it&#xA;would work. On large scale deployments you probably have BIND, already. To enable&#xA;DNSMasq, first make it start on boot.&lt;/p&gt;&#xA;&lt;p&gt;/etc/rc.conf.d/dnsmasq:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dnsmasq_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You need to edit the config in /usr/local/etc/dnsmasq.conf. These are the&#xA;options I changed:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;domain&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;vm&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dhcp-range&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;172.16.0.50,172.16.0.250,12h&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interface&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;lo0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interface&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;bridge1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bind-interfaces&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;resolv-file&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/etc/dnsmasq.d/resolvconf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;conf-dir&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/etc/dnsmasq.d/,*.conf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All options are present in the file initially, but commented out. In short, this&#xA;config provides DHCP and DNS service only on bridge1 which is dedicated for VMs&#xA;while allowing for on-the-fly VM info changing by including everything from&#xA;/usr/local/etc/dnsmaq.d directory which ends with .conf.&lt;/p&gt;&#xA;&lt;p&gt;For easier URLs, you can use DNSMasq as your DNS server through 127.0.0.1. To do&#xA;that this is what you need to have in /etc/resolvconf.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name_servers&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;127.0.0.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dnsmasq_resolv&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/etc/dnsmasq.d/resolvconf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Whenever your DNS settings change, resolvconf will write the info into the file&#xA;which will make DNSMasq re-read it.&lt;/p&gt;&#xA;&lt;p&gt;The last thing to do is configure BHyve. You&amp;rsquo;ll need to load the modules and let&#xA;CBSD take care of the rest, so add these lines to /boot/loader.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;zfs_load&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vmm_load&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;if_tap_load&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;if_bridge_load&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nmdm_load&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;ZFS and VMM are self explainatory module names, while TAP and Bridge are two&#xA;kinds of interfaces used to emulate network stack inside VM. Null Modem or nmdm&#xA;is used to get the terminal output through a serial line and tmux.&lt;/p&gt;&#xA;&lt;p&gt;Reboot and you should be able to create new jails and virtual machines:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# cbsd jconstruct-tui&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# cbsd jstart &amp;lt;jail&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# cbsd jlogin &amp;lt;jail&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# cbsd jstop &amp;lt;jail&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# cbsd jremove &amp;lt;jail&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With &lt;code&gt;cbsd jconstruct-tui&lt;/code&gt; you have to choose lo1 for the interface, once you&amp;rsquo;re&#xA;greeted with the dialog based form. Commands for VMs are the same, just prepend&#xA;them with &lt;code&gt;b&lt;/code&gt; instead of &lt;code&gt;j&lt;/code&gt;, e.g. &lt;code&gt;cbsd bconstruct-tui&lt;/code&gt;. The lo1 interface is&#xA;only for jails, so for VMs you don&amp;rsquo;t have to do anything special.&lt;/p&gt;&#xA;&lt;p&gt;Nice thing about bstart is that it will start bhyve process in tmux so &lt;code&gt;tmux a&lt;/code&gt;&#xA;will open it. Another nice thing is that if booting from CD-ROM image, BHyve&#xA;will wait for the VNC connection to start the boot process. That means that&#xA;booting will not start the second you issued &lt;code&gt;cbsd bstart&lt;/code&gt;, but once you start&#xA;&lt;code&gt;vncviewer localhost&lt;/code&gt;, so you can see all the messages.&lt;/p&gt;&#xA;&lt;p&gt;Now, go and play with it a bit. Don&amp;rsquo;t worry, you don&amp;rsquo;t need any images or&#xA;anything, CBSD will download them for you when you select appropriate template.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Lost Passport</title>
      <link>https://meka.rs/blog/2017/01/02/lost-passport/</link>
      <pubDate>Mon, 02 Jan 2017 03:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2017/01/02/lost-passport/</guid>
      <description>&lt;p&gt;My wife and I went from Hamburg to Belgrade on 31st December. We had connected&#xA;flights and from Hamburg we went to Zurich. In Zurich we realized my wife lost&#xA;her passport. The situation is hilarious looking back, but totally not fun while&#xA;it&amp;rsquo;s happening. So, her passport fell from her pocket in the plane and we&#xA;noticed that on our way to the customs. What happens next is hell breaking loose,&#xA;which we kindda expected for several reasons, but let me go back to the begining.&lt;/p&gt;&#xA;&lt;p&gt;The reason why we were in Hamburg so late in the year was CCC, of course. That&#xA;means we&amp;rsquo;re with our friends in Hamburg on the night of 30th, and flying home on&#xA;the morning of the 31th December. One thing was sure: we won&amp;rsquo;t get enough sleep.&#xA;Laying down in 4am and getting up at 6am makes you slugish. We asked a German&#xA;friend about the S-Bahn to airport, and although it helped, seing everything in&#xA;German in 7am throws you off the balance. Moreover, S1, which we were waiting,&#xA;has (at least) 2 platforms which are not next to each other. After some reading&#xA;we found out which is the right one and which dirrection we need. Now comes the&#xA;first big problem: first 3 cars don&amp;rsquo;t end up on the same place as last 3 cars,&#xA;so in order to get to the airport, you have to enter the right one. Description&#xA;is, of course, in German. Finding someone awake at 7am on 31th December is hard.&#xA;Finding someone who speaks German and English at that exact same time is &amp;hellip;&#xA;frustrating, but we made it. Second problem: although the customs work 24/7, the&#xA;one you need to get you EU tax money back works 9-17!!! There&amp;rsquo;s no country in&#xA;the world that doesn&amp;rsquo;t hide behind bureaucracy when they need to give you (back)&#xA;money. That was really, really close to our first departure, that I got my money&#xA;back, got mu bag and entered the plane with ~5 minutes breaks between the&#xA;actions. Third problem: got in Zurich, no passport. For fuck sake, how big that&#xA;airport is! It&amp;rsquo;s even bigger when you have a forth problem: you didn&amp;rsquo;t go to&#xA;toilet for 5 days, and your somach decides to do something about it that very&#xA;minute. Fift problem: wife had an operation last year and running is not what&#xA;she can do for long. Sixt problem: it&amp;rsquo;s fucking New Year, no one is working &amp;hellip;&#xA;almost. Luckily, the clerk we saw about lost passport is one very capable woman&#xA;who managed to find it by having 1000 phone calls. One thing was going on our&#xA;hand: our plane was comming from Amsterdam where the fog made all flights late&#xA;around ~40 minutes.&lt;/p&gt;&#xA;&lt;p&gt;So, after around 40 minutes of running with a feeling of a knife in my stomach,&#xA;we got into the line for departure. At that moment I&amp;rsquo;m all swetting like crazy,&#xA;pushing all my things into my wife&amp;rsquo;s hands with only 4 words: &amp;ldquo;I can&amp;rsquo;t, no&#xA;longer!&amp;rdquo;. How do you hurry in that situation? Relax so you mussle doesn&amp;rsquo;t cramp,&#xA;or hurry like crazy? I&amp;rsquo;ll tell you this much: that was the fastest toilet&#xA;business in my life. OK, everything is fine, I&amp;rsquo;m in line again, than in plane,&#xA;we&amp;rsquo;re in Belgrade &amp;hellip; fuck!!! Did that clerk say she called the gate to take our&#xA;bags off the plane because they can not travel without us? I remember she did&#xA;that, but did she call back? After ~15 minutes at staring at other people&#xA;luggage, we saw our bags. Of course they were the last.&lt;/p&gt;&#xA;&lt;p&gt;Everything is fine now, really. We only need to get home, which has little&#xA;detour to get a drivers dog so she doesn&amp;rsquo;t freak out when all the cracks start&#xA;banging. After that we finally got home! Ah, rest, finally.&lt;/p&gt;&#xA;&lt;p&gt;Rest my ass! In 4 hours friends are comming, we&amp;rsquo;re celebrating New Year at our&#xA;flat. Shower, eat, sleep 2 hours, drink, eat, drink, drink &amp;hellip; in 3am pass out.&#xA;Please, no more exciting and tiresome events untill summer, please!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD WiFi and Ethernet Bridging and Aggregation</title>
      <link>https://meka.rs/blog/2016/12/24/freebsd-wifi-and-ethernet-bridging-and-aggregation/</link>
      <pubDate>Sat, 24 Dec 2016 22:27:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2016/12/24/freebsd-wifi-and-ethernet-bridging-and-aggregation/</guid>
      <description>&lt;p&gt;The title is cumbersome but the topic is quite ordinary life, to be honest. Idea&#xA;is to have WiFi and Ethernet cards unified. On the router that means that&#xA;whether you&amp;rsquo;re getting your address over Wifi or Ethernet, you get the same&#xA;range. On the client (usually laptop) we want to not be able to distinguish if&#xA;we&amp;rsquo;re on Wifi or Ethernet connection, but we do prefer Ethernet.&lt;/p&gt;&#xA;&lt;h2 id=&#34;router-configuration&#34;&gt;Router Configuration&lt;/h2&gt;&#xA;&lt;p&gt;When you think about it, what we need is described in lame terms as &amp;ldquo;I want wifi&#xA;and ethernet interface to have same IPv4 address&amp;rdquo;. As that&amp;rsquo;s kindda imposible,&#xA;you can have a bridge with Spanning Tree Protocol (or STP for short), which is&#xA;the next best thing. Bridge is just one virtual interface which binds, or&#xA;bridges, two or more interfaces. In my case, ethernet interface is re1 and wifi&#xA;interface is wlan0. To create a bridge with STP (to be totally honest, FreeBSD&#xA;defaults to RSTP or Rapid STP which is STP compatible) you&amp;rsquo;ll add the following&#xA;to /etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# WiFi config&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wlans_ath0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlan0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create_args_wlan0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlanmode hostap mode 11gn&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_wlan0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ssid mywifi channel 8&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hostapd_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Bridge config&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_re1&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cloned_interfaces&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bridge0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_bridge0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addm re1 addm wlan0 stp re1 stp wlan0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_bridge0_alias0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inet 192.168.5.1 netmask 255.255.255.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it. You&amp;rsquo;ll notice that we enabled hostapd, too. It is what provides WPA2&#xA;on WiFi. It&amp;rsquo;s config is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interface&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;wlan0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;debug&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ctrl_interface&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/var/run/hostapd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ctrl_interface_group&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;wheel&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ssid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;mywifi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wpa&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wpa_passphrase&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;password&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wpa_key_mgmt&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;WPA-PSK&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wpa_pairwise&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;CCMP&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I found tutorials which set MAC address of all three interfaces: wifi, ethernet&#xA;and bridge to the same value. I tried it and it doesn&amp;rsquo;t work. As a matter of&#xA;fact, the config show here will produce that you see the same MAC of your router&#xA;no matter how you connect to it: Wifi or Ethernet.&lt;/p&gt;&#xA;&lt;p&gt;What you probably want is NAT enabled router. My prefered tool is PF. To enable&#xA;PF and logger, add the following to /etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pf_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pflog_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gateway_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YES&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The simplest rules for this use case are:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ext_if &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;re0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int_if &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bridge0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set skip on lo0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scrub in all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nat on $ext_if from $int_if:network to any -&amp;gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;$ext_if&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;block in all&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass out all keep state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass proto tcp to any port ssh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pass inet proto &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; icmp, igmp &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;laptop-configuration&#34;&gt;Laptop Configuration&lt;/h2&gt;&#xA;&lt;p&gt;What we want on laptop is quite the opposite of the router: instead all bridged&#xA;interfaces to work at the same time, we want only one to be active. The rule for&#xA;activation is: if there&amp;rsquo;s no signal (or carier) on the Ethernet interface, use&#xA;WiFi. That kind of virtual interface is called lagg or Link Aggregation. One&#xA;lagg has master interface (in our case Ethernet one) and slaves. Master&#xA;interface is the one that is added to the lagg the first. To aggregate WiFi and&#xA;Ethernet on em0 interface, add the following to /etc/rc.conf:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cloned_interfaces&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lagg0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wlans_iwn0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlan0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create_args_wlan0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;country US regdomain FCC&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_lagg0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;laggproto failover laggport em0 laggport wlan0 DHCP&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_wlan0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ether f0:de:f1:64:2c:3b WPA&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifconfig_em0&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;up&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There are 3 important parts. First, wlan0 MAC is set to be the same as the one&#xA;found on em0. This minifies the time it takes to switch between the two&#xA;interfaces. Second, don&amp;rsquo;t put DHCP anywhere except on the lagg0. Third, you have&#xA;to bring all the interfaces you use up (hence the last line).&lt;/p&gt;&#xA;&lt;p&gt;With the router that leases the addresses only from one pool, and interfaces&#xA;that are effectively on the same IP range, aggregating interfaces on laptop with&#xA;the same MAC address will give you the same IP no matter how you&amp;rsquo;re connecting.&#xA;Also, as FreeBSD PF doesn&amp;rsquo;t have egress, having all outbound traffic on one&#xA;interface, be it virtual or hardware, makes things easier to filter and route.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD Network Optimization and CCC Tickets</title>
      <link>https://meka.rs/blog/2016/11/07/freebsd-network-optimization-and-ccc-tickets/</link>
      <pubDate>Mon, 07 Nov 2016 23:45:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2016/11/07/freebsd-network-optimization-and-ccc-tickets/</guid>
      <description>&lt;p&gt;Today was the first day of presale tickets for people without voucher. Let me be&#xA;precise, today at 20:00 started the DDoS on&#xA;&lt;a href=&#34;http://tickets.events.ccc.de&#34;&gt;ticket servers&lt;/a&gt;. So, let me put things into&#xA;perspective. Because CCC is more and more popular, they had to do something to&#xA;limit the number of tickets. They decided to give vouchers to hackerspaces and&#xA;alikes. As we heard of that too late (or were too lazy, pick your favorite),&#xA;the reply we got was &amp;ldquo;we ended requests for vouchers earlier today&amp;rdquo;. Bummer!&lt;/p&gt;&#xA;&lt;p&gt;Next you can do is buy a normal ticket, but that&amp;rsquo;s limited, too. You have 3&#xA;chances to do so: 07, 19 and 25 November. So, let&amp;rsquo;s see. Last year there were&#xA;about 13k people. Let&amp;rsquo;s say only 5k are buying tickets. Guess what, they all&#xA;tried to do it today at exactly 20:00. If you dig/nslookup tickets.events.ccc.de,&#xA;you&amp;rsquo;ll see that it&amp;rsquo;s the only one IP. There might be multiple app servers behind&#xA;nginx (yeah, we saw nginx 500 error messages), but still, that&amp;rsquo;s HUGE amount of&#xA;traffic for one IP. And then games began.&lt;/p&gt;&#xA;&lt;p&gt;My wife and I loaded the page 30 minutes before, so the CSS, JS and whatnot is&#xA;cached. We knew there&amp;rsquo;s going to be problems, so we were prepared. We both have&#xA;Linux with dual boot: Windows in her case, FreeBSD in mine. I saw it in her eyes&#xA;&amp;ldquo;I already booted Windows &amp;hellip;&amp;rdquo; and got reply to silent question &amp;ldquo;Yeah, and&#xA;you&amp;rsquo;re going to race with all the people on better OSes?&amp;rdquo;. So there we are,&#xA;Linux on her machine, and FreeBSD on mine. I was thinking two things: she&amp;rsquo;s&#xA;already on Linux, if the site doesn&amp;rsquo;t work on FreeBSD for some reason, there&amp;rsquo;s&#xA;her machine to refresh the page while I reboot, and let&amp;rsquo;s add diversity, who&#xA;knows maybe Linux has some problems that FreeBSD doesn&amp;rsquo;t. I was going to go with&#xA;BSD because they practically implemented TCP/IP sockets (hence the name &amp;ldquo;BSD&#xA;sockets&amp;rdquo;). I know that network stack implementation is better on FreeBSD than&#xA;Linux, and I don&amp;rsquo;t even want to discuss Windows. Did it work? Oh yeah! My wife&amp;rsquo;s&#xA;Linux didn&amp;rsquo;t load the first page while I bought us tickets. So let&amp;rsquo;s see how I&#xA;did it.&lt;/p&gt;&#xA;&lt;p&gt;Does network stack and BSD vs. Linux really work? Absolutely NO! The difference&#xA;is that my wife&amp;rsquo;s on laptop over WiFi, and I&amp;rsquo;m on desktop over ethernet. WPA2,&#xA;I&amp;rsquo;m sure, is much more overhead than Linux implementation of TCP/IP stack. I&amp;rsquo;m&#xA;sorry if you feel fooled by the title, but I really thought about optimal&#xA;implementation of TCP/IP when I considered which OS to boot, and it&amp;rsquo;s more fun&#xA;to have a title like this then &amp;ldquo;How I bought CCC tickets&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;So, here we are, the page is loaded, I choose to buy 2 tickets (yeah, my wife is&#xA;a huge fan of hacking) and &amp;hellip; error 500. I feel I used all the force in the&#xA;Universe pressing F5 frantically. Then I got to the page to choose payment method&#xA;and then one page to enter email, than the final one, which didn&amp;rsquo;t work. I&#xA;decided I&amp;rsquo;m gonna get the tickets no matter what! On the third page, you&amp;rsquo;re&#xA;informed the ticket is reserved for you for 30 minutes. If for any reason you&#xA;don&amp;rsquo;t want it, you just close the browser and the ticket is returned to the pool&#xA;of tickets. That&amp;rsquo;s nasty, as I have to do something with the server which is&#xA;under heavy DDoS . Of course it was about to timeout when I tried a little hack&#xA;(it&amp;rsquo;s not even a hack, to be honest): return to the previous page, click the&#xA;same button, and after using the F5 force again, you get another 30 minutes. So,&#xA;I figured how to not be time limited. That&amp;rsquo;s cool! Then comes the hard part. On&#xA;the last page where you confirm everything, submit button didn&amp;rsquo;t work and gave&#xA;some errors about django in the browser console. WHAT THE FUCKING FUCK!!! Pissed&#xA;off I looked at #33c3 hashtag on twitter and saw that most people who bought&#xA;tickets are speaking German. Right! Switch to German on the last page, and F5&#xA;force again. IT WORKED!!! Do I speak German? Nein! The button looks the same and&#xA;I really didn&amp;rsquo;t care about the letters.&lt;/p&gt;&#xA;&lt;p&gt;The moral of the story: you better be system and network administrator and&#xA;backend and frontend developer if you want to buy CCC ticket without the voucher.&lt;/p&gt;&#xA;&lt;h2 id=&#34;update-1&#34;&gt;Update 1&lt;/h2&gt;&#xA;&lt;p&gt;No matter how you intend to pay for the ticket, select Bank transfer&#xA;as selecting credit card will give you one more form to fill in. You&amp;rsquo;ll get the&#xA;email which, among other details, contains link to tiketing server&amp;rsquo;s page with&#xA;details about your ticket. Tomorrow, when all the DDoS is over, go to that link&#xA;and choose &amp;ldquo;switch payment method&amp;rdquo; if you want to pay with credit card. This way&#xA;you have one page less to display, which is infinity for a server under DDoS.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>FreeBSD In Two Months</title>
      <link>https://meka.rs/blog/2016/10/28/freebsd-in-two-months/</link>
      <pubDate>Fri, 28 Oct 2016 00:15:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2016/10/28/freebsd-in-two-months/</guid>
      <description>&lt;p&gt;My last post was about CCC and it&amp;rsquo;s almost the time for a new one. I was so&#xA;bussy hacking things that I forgot I have a blog. Huge amount of new things&#xA;happened to me, but I&amp;rsquo;ll focus on the FreeBSD. I installed BETA1 of 11.0 as soon&#xA;as it came out as I really wanted to see how good is the Docker support. Now I&#xA;don&amp;rsquo;t even use Docker, and FreeBSD is my main OS on laptop and desktop, although&#xA;I still have Debian on desktop for the sake of recording my band. So let me give&#xA;you some context and my history with this operating system.&lt;/p&gt;&#xA;&lt;p&gt;I remember I was using 5.0 for a while and 4.9 before it for quite a while. The&#xA;first thing I noticed is the size of the system and the speed at which world is&#xA;compiled. It was so much faster to compile FreeBSD libc than glibc that I&#xA;suspected that there&amp;rsquo;s something missing in the BSD libc. For me, that was all I&#xA;needed to switch from using SuSE 7.2 at the time (I think). It was 2003-2005&#xA;that I used FreeBSD with some pauses. As my university was under heavy influence&#xA;by M$, I had trouble adjusting Linux to do what was needed. Doing the same on&#xA;FreeBSD wasn&amp;rsquo;t even poissible. Soon, I switch to Gentoo, as it was the next best&#xA;thing.&lt;/p&gt;&#xA;&lt;p&gt;To be honest, I never looked back to FreeBSD until two months ago. What I read&#xA;was that version 11 is comming with the Docker support, which I used heavily on&#xA;my servers. From past experience I knew about the beauty of FreeBSD build system&#xA;and PF as firewall and ZFS and DTrace and &amp;hellip; I was lucky enough that about a&#xA;month after I installed FreeBSD on my laptop, there was a EuroBSD conference in&#xA;my country. Of course I rushed there! But something happened since then.&lt;/p&gt;&#xA;&lt;p&gt;Talking to some of the clients and friends gave me impression that GPLv3 is&#xA;scaring people and companies. As a huge fan of GNU, I just thought they are not&#xA;using open source, so they don&amp;rsquo;t know what they are talking about, but then I&#xA;read about GPLv3 more. As a tool for binding people to write more open source&#xA;code, it became monopolistic licence in a way that if anything is GPL,&#xA;everything is GPL. This resonated in my head for some time and that was what&#xA;made me realize why are BSD people so licence pure - you can&amp;rsquo;t ignore business&#xA;just because you have this vision in your head that says &amp;ldquo;everyone should write&#xA;open source code&amp;rdquo;. BSD community seamed (and it is) more permissive and open to&#xA;the real world.&lt;/p&gt;&#xA;&lt;p&gt;But licences are not my strong point, so I&amp;rsquo;ll stick to the tech part. Let me&#xA;just briefly describe some of the technologies in the BSD world. First in my&#xA;book is ZFS. It is so much more than a file system. It has RAID included, if&#xA;needed, it has copy-on-write, it&amp;rsquo;s got 128bit system, it has volume manager and&#xA;on top of it all, RAID is not just RAID, it&amp;rsquo;s RAIDZ, meaning ZFS keeps extra&#xA;checksum for every block, which make it super consistent.&lt;/p&gt;&#xA;&lt;p&gt;Second on my list of favorite technologies is PF. It&amp;rsquo;s so readable that&#xA;sometimes I wonder if they screwed up implementation just to make it more&#xA;readable (of course they didn&amp;rsquo;t). Even so, it&amp;rsquo;s strongest point is not syntax,&#xA;it&amp;rsquo;s statefulness of the firewall. PF deserves a post on it&amp;rsquo;s on but to put the&#xA;statefull firewall into context: it gives you more logical connections between&#xA;the packets.&lt;/p&gt;&#xA;&lt;p&gt;Third one is DTrace which stands for &amp;ldquo;dynamic tracer&amp;rdquo;. It&amp;rsquo;s an interesting idea&#xA;that every OS is full of probes in different places, and when turned on, they&#xA;give you information about &amp;hellip; well, depends what probs you enable. When no&#xA;probe is enabled, it has no overhead at all, which makes it great for debugging&#xA;production servers. It can trace kernel and user space and has a AWKish syntax.&lt;/p&gt;&#xA;&lt;p&gt;Fourth, and last for this post is Jail. Although it&amp;rsquo;s technology introduced in&#xA;FreeBSD world in 2000, somehow it didn&amp;rsquo;t get much publicity. Together with ZFS&#xA;it makes one hell of a system for hosting stuff. Also, that&amp;rsquo;s the core of&#xA;FreeBSD implementation of Docker.&lt;/p&gt;&#xA;&lt;p&gt;Almost none of that is what I&amp;rsquo;m working on, right now. Although I made a switch&#xA;because of the above mentioned technologies, the main reason for me to hack it&#xA;more is it&amp;rsquo;s fully preemptive kernel, which is the core of any real time system.&#xA;Real time makes sound better and delay from plucking a guitar string to hearing&#xA;it on the speakers is lower. Most of the work on supporting audio interfaces&#xA;with more than 8 channes is done by Hans Petter Selasky, so I&amp;rsquo;d like to&#xA;publicly thank him for all the trouble he when through. Although my FreeBSD DAW&#xA;is not perfect due to smaller number of audio apps then the number found in&#xA;Linux world, it shows huge potential.&lt;/p&gt;&#xA;&lt;p&gt;What happened in 2 months exactly? As I&amp;rsquo;m Python and JavaScript developer,&#xA;musician, video editor and in one word hacker, I didn&amp;rsquo;t expect FreeBSD to&#xA;fullfill all my needs (no other OS did). Today only Drumgizmo is what&amp;rsquo;s missing&#xA;on my FreeBSD box to make it a perfect DAW. To be honest, after two months of&#xA;using it I expect that I would be learning kernel development in order to make&#xA;any sound. Instead, it almost gives me all the power I would ever need (yeah,&#xA;I know there&amp;rsquo;s new power to be found).&lt;/p&gt;&#xA;&lt;p&gt;So to put it all together, what FreeBSD gives me is the power to have one&#xA;machine for everything: security, firewalling, FS consistency, real time audio&#xA;and development environment for any language I choose to work with. I really&#xA;enjoy my new OS, but I have one concern. As I&amp;rsquo;m talking to people how great&#xA;FreeBSD is, I&amp;rsquo;m affraid I&amp;rsquo;ll become one of those preachers who can&amp;rsquo;t stop&#xA;talking. It&amp;rsquo;s not my vocal cords I&amp;rsquo;m concerned about, as after all I am a singer&#xA;in a metal band. It&amp;rsquo;s the damage I might do to the FreeBSD as a project if I&amp;rsquo;m&#xA;preaching about it too much.&lt;/p&gt;&#xA;&lt;p&gt;Thank you, FreeBSD project!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>32C3</title>
      <link>https://meka.rs/blog/2016/04/20/32c3/</link>
      <pubDate>Wed, 20 Apr 2016 15:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2016/04/20/32c3/</guid>
      <description>&lt;p&gt;We got in Hamburg few days before Christmas so we had enough time to see the&#xA;city, this time. I had a feeling that people in Hamburg are depressed which was&#xA;a drag as I got there not too happy about the recent development of my life. To&#xA;be honest, first few days I thought I would be better at home, or anywhere else.&#xA;But then the congress started and it got a bit better, but the feeling of&#xA;something missing didn&amp;rsquo;t go away. Even worse, I wasn&amp;rsquo;t the only one who had that&#xA;feeling. As every normal guy would do, I fixed it with rakija, of course.&lt;/p&gt;&#xA;&lt;p&gt;Although it&amp;rsquo;s important for me to tell you the whole state of mind I was in,&#xA;that&amp;rsquo;s not the reason I&amp;rsquo;m writing this post. We (LUGoNS) were lucky enough to&#xA;have a table beside MetaLab guys. Amount of happiness coming from them was&#xA;amazing. As always, CCC was full of wonderfully talented hackers and I had great&#xA;time at the Python Booth, for example. Great time passes fast, and the closing&#xA;ceremony was getting close.&lt;/p&gt;&#xA;&lt;p&gt;For me, the whole point of going to 32C3 was closing ceremony. It was really&#xA;emotional for me. Emotional enough to find a shoulder to weep on it. Tears just&#xA;broke out of me and all bad feelings started to pour out of me. What really&#xA;happened on that ceremony was that the guy who was talking said something I&#xA;didn&amp;rsquo;t know it will be such a trigger = &amp;ldquo;Look around you, remember small things&#xA;and take it home&amp;rdquo;. And I did. That&amp;rsquo;s when I realized what is going on.&lt;/p&gt;&#xA;&lt;p&gt;The background story first. Back in 1999. my country was bombed by NATO. Few&#xA;days of that period I spent in a moist, old basement with my parents, PC&#xA;motherboard and a magazine with audio synthesizers. That basement had no&#xA;electricity, toilet or anything, so when something was needed we went to the&#xA;house. What&amp;rsquo;s important is that it was full of equipment. At that point I made&#xA;a promise to myself that I will have huge pile of electronics one day.&#xA;Meaningful electronics! That &amp;ldquo;remember the small things&amp;rdquo; somehow reminded me of&#xA;that day 16 years ago. After coming to my senses my girlfriend asked me &amp;ldquo;what&#xA;the hell was that?&amp;rdquo;. The only thing I kept repeating was &amp;ldquo;I made it&amp;rdquo;. I was&#xA;repeating it like hypnotized.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m a co-founder of a hackerspace and we&amp;rsquo;re piling wonderful electronics. I&#xA;barely hold my self together while writing this and remembering = &amp;ldquo;from the&#xA;shitty basement to a hackerspace&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;Thank you CCC, I will remember it all!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>I am a hacker</title>
      <link>https://meka.rs/blog/2015/11/30/i-am-a-hacker/</link>
      <pubDate>Mon, 30 Nov 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/11/30/i-am-a-hacker/</guid>
      <description>&lt;p&gt;What is a hacker? Who the hell knows? On top of that, I&amp;rsquo;m clamming I&amp;rsquo;m one of&#xA;them. What gives me the right? I&amp;rsquo;m not sure, but in short, I know one thing:&#xA;hackers are smart and they never give up. Once I heard the smartest man I&amp;rsquo;ve&#xA;ever met saying to a developer: &amp;ldquo;OK, make something, then Meka will do the&#xA;magic&amp;rdquo;. That&amp;rsquo;s the best compliment I&amp;rsquo;ve ever got. I guess that makes me smart,&#xA;too. And never giving up &amp;hellip; I know I&amp;rsquo;m that kind of guy. If anyone wants me to&#xA;do anything I&amp;rsquo;m remotely interested in, it&amp;rsquo;s enough I hear &amp;ldquo;that it&amp;rsquo;s&#xA;impossible&amp;rdquo;. I guess it&amp;rsquo;s enough proof I&amp;rsquo;m persistent.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s go from the start. I knew I&amp;rsquo;m good at math since 3rd grade elementary&#xA;school. I&amp;rsquo;ve been the best physics student in elementary, too. I&amp;rsquo;ve never been&#xA;the best student, that&amp;rsquo;s for sure. I was more interested in asking &amp;ldquo;why&amp;rdquo; and&#xA;&amp;ldquo;how&amp;rdquo; than having a good grade. I always asked myself &amp;ldquo;what if we do this&#xA;differently&amp;rdquo; and it always gave me bad grades, but somehow, when things go&#xA;south, I get to answer the tough questions. High school was even worse. I was a&#xA;bit above the average. University? Totally below average. Of course, if grades&#xA;mean anything to you. The mean shit to me. And let me take this opportunity to&#xA;say that except 3 professors, all of them are total crap. One of the proofs is&#xA;that I&amp;rsquo;ve got this answer to &amp;ldquo;Why am I failing programming?&amp;rdquo;: &amp;ldquo;Your algorithms&#xA;are too advanced for professors to get them&amp;rdquo;. Let me repeat: I was below&#xA;average.&lt;/p&gt;&#xA;&lt;p&gt;Today, I&amp;rsquo;m co-founder of a &lt;a href=&#34;http://tilda.center/&#34;&gt;Tilda Center&lt;/a&gt;, Novi Sad&amp;rsquo;s&#xA;hackerspace. So, I&amp;rsquo;m discussing funding and finances with my friend and he told&#xA;me &amp;ldquo;Don&amp;rsquo;t make the same mistake I made with &lt;a href=&#34;https://lugons.org/&#34;&gt;LUGoNS&lt;/a&gt;&amp;rdquo;. What&#xA;he told me is &amp;ldquo;don&amp;rsquo;t invest too much of your own money into it&amp;rdquo;. How can I not&#xA;to? I believe in Tilda with my whole heart. So, after a while, I&amp;rsquo;m telling him&#xA;something like &amp;ldquo;Well, yeah, I know what you mean, but I can make it work, trust&#xA;me. Besides, I know math, physics, electronics, backend and frontend&#xA;programming, system and network administration, devops, guitar playing, singing,&#xA;audio and video production and post production, cooking and I&amp;rsquo;m starting with&#xA;capoeira trainings this Tuesday. With all this knowledge, I will make it work&#xA;on Mars, if needed&amp;rdquo;. I&amp;rsquo;m not good at all those things equaly, obviously, but&#xA;I&amp;rsquo;m refusing to accept I&amp;rsquo;m not above average at any of those except capoeira.&lt;/p&gt;&#xA;&lt;p&gt;For the end, let me just tell you I&amp;rsquo;m not trying to brag around how good I am at&#xA;anything. This post is to remind me I&amp;rsquo;m not as stupid as I have tendency to tell&#xA;people I am, and to remind me of the most important achievement in my life: I&#xA;AM A HACKER!!! I have to repeat that in order to understand why I&amp;rsquo;m so&#xA;different and unaccepted. Thank you for reading!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>OpenBSD WiFi</title>
      <link>https://meka.rs/blog/2015/08/18/openbsd-wifi/</link>
      <pubDate>Tue, 18 Aug 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/08/18/openbsd-wifi/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m a proud owner of &lt;a href=&#34;http://pcengines.ch/apu.htm&#34;&gt;APU&lt;/a&gt;. I&amp;rsquo;m currently running&#xA;OpenBSD on it. It&amp;rsquo;s pretty &lt;a href=&#34;https://github.com/mekanix/openbsd-config&#34;&gt;simple config&lt;/a&gt;.&#xA;Everything was &amp;ldquo;working&amp;rdquo; until I decided to tighten the screws on the device, as&#xA;I purchased a new screwdriver. Since then, WiFi is terribly slow. I had ~2s&#xA;delay between pressing a key and seeing character when logged in over ssh from&#xA;laptop to desktop. So, I&amp;rsquo;ve disassembled the device and assembled it all over&#xA;again, but no luck. Then I realized that I&amp;rsquo;m using 11b mode. Switching to&#xA;&lt;a href=&#34;https://github.com/mekanix/openbsd-config/commit/08cb7e40cb1f67e446d6255327661af9aeb87f4b&#34;&gt;11g and priority 0&lt;/a&gt;&#xA;made it all working well. SSH is more responsive and&#xA;&lt;a href=&#34;http://speedtest.net&#34;&gt;speed test&lt;/a&gt; shows 10Mbit/s instead of ~5Mbit/s it showed&#xA;previously. I&amp;rsquo;ve learned my lesson.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Guitar Pickups</title>
      <link>https://meka.rs/blog/2015/07/25/guitar-pickups/</link>
      <pubDate>Sat, 25 Jul 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/07/25/guitar-pickups/</guid>
      <description>&lt;p&gt;When I was searching for my guitar, I read a lot of articles about pickups, too.&#xA;In &lt;a href=&#34;http://tilda.center&#34;&gt;Tilda Center&lt;/a&gt; we have at least two guys who play guitar&#xA;beside me, and once we had discussion about this exact topic, which made me&#xA;believe that there are not enough articles about pickups, types, usages,&#xA;electronics behind them etc. Or, maybe, the articles are not clear enough. I&amp;rsquo;ll&#xA;try to explain.&lt;/p&gt;&#xA;&lt;p&gt;First, there are few types of different types of pickups. The most famous are&#xA;single coil and humbucker. Let&amp;rsquo;s start with single coil.&lt;/p&gt;&#xA;&lt;p&gt;From &lt;a href=&#34;http://media.musiciansfriend.com/is/image/MMGS7/S1-Hot-Passive-Single-Coil-Pickup/308017000000000-00-750x750.jpg&#34;&gt;this picture&lt;/a&gt;&#xA;you can see that single coil have single line of magnets. If you&amp;rsquo;ve ever played&#xA;a guitar with this kind of pickups, you&amp;rsquo;ve noticed that they have a lot of&#xA;noise, especially if you have CRT monitor. Single coil have &amp;ldquo;flat&amp;rdquo; sound and a&#xA;bit thin.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://www.musik-produktiv.it/pic-003750176xl/dimarzio-humbucker-the-breed.jpg&#34;&gt;Humbuckers&lt;/a&gt;,&#xA;on the other hand, have two lines of magnets. If you&amp;rsquo;ve ever heard of balanced&#xA;cable, you know the basic principle: one line of magnets have their polarity&#xA;N-S, while the other line is S-N. That means that one line of magnets&#xA;generate sound, while the other line generates inverse sound. In perfect&#xA;conditions, if you mix those two signals, generated sound will cancel each other&#xA;out, and the only signal that you&amp;rsquo;ll end up is the noise generated in magnet&#xA;coils. As a matter of fact, noise will be doubled, because generated noise is&#xA;not inversed like the sound. I hope this is clear enough. Now imagine that you&#xA;invert one of the sounds before mixing. What you&amp;rsquo;d have is opposite: double the&#xA;sound, noise canceled out.&lt;/p&gt;&#xA;&lt;p&gt;The difference in sound is obvious. There&amp;rsquo;s less noise (or hum) in humbuckers&#xA;than single coils. As magnets and wires are not perfect, humbucker will cancel&#xA;out some of the high frequencies. To me, that&amp;rsquo;s a good thing, as I find single&#xA;coil sound too piercing.&lt;/p&gt;&#xA;&lt;p&gt;There are other types of pickups, but they are either single coil or humbucker&#xA;in it&amp;rsquo;s essence. For example, EMG and Seymor Duncan have active pickups: the&#xA;ones which have small integrated amp in them so the signal they output is much&#xA;higher (think high gain distortion). In order to power up that amp, 9V battery&#xA;is needed, and is usually placed with the rest of the electronics on the back of&#xA;the guitar.&lt;/p&gt;&#xA;&lt;p&gt;To put it into perspective, let me tell you what bands I associate with what&#xA;types of guitars/pickups. When I think about single coil, it&amp;rsquo;s either Strat or&#xA;Tele. Bends that come to my mind playing those guitars are Dire Straights, Eric&#xA;Clapton. Iron Maiden, for example, uses single coil, but I always felt they are&#xA;somewhere in the middle: between singles and hums. When I think about&#xA;humbuckers, Gerry Moore, Clutch and Corrosion of Conformity come to mind, while&#xA;I think best example of active pickups are Zakk Wylde, Kerry King and Metallica&#xA;(sorry for all of those being EMG based, I don&amp;rsquo;t know anyone playing Seymour&#xA;Duncan&amp;rsquo;s Blackouts except a friend of mine, and I&amp;rsquo;m probably putting them in my&#xA;next guitar)&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Tilda Center Summer</title>
      <link>https://meka.rs/blog/2015/06/28/tilda-center-summer/</link>
      <pubDate>Sun, 28 Jun 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/06/28/tilda-center-summer/</guid>
      <description>&lt;p&gt;As my plans for summer festivals and beaches are ruined, my activity in&#xA;&lt;a href=&#34;http://tilda.center&#34;&gt;Tilda Center&lt;/a&gt; increased. Pure action-reaction physics at&#xA;work. :o) We got two new tables and weekly meetings on Mondays and Thursdays.&#xA;On Mondays is a general discussion or gathering to just hang out. On Thursdays,&#xA;theme of the meeting is &lt;a href=&#34;https://github.com/one-love&#34;&gt;One Love&lt;/a&gt;, project a few&#xA;of us are contributing to. In future, we&amp;rsquo;re hoping to fund our hackerspace with&#xA;it. I can tell you it&amp;rsquo;s interesting. Amount of ideas worth trying out is&#xA;astonishing. One of the members even brought guitar for slight adjustments.&#xA;Knowledge is flowing, and it&amp;rsquo;s great. We even have time for Danube beach, when&#xA;the weather is kind enough. :o) Soon, I hope we&amp;rsquo;ll have &amp;ldquo;conference&amp;rdquo; room in&#xA;Tilda ready. We already have a white board on the wall. Ah, I love drawings on&#xA;the meetings. So much easier to comprehend someone else&amp;rsquo;s idea if it&amp;rsquo;s drawn. I&#xA;tend to teach our young members that everything can be represented as a&#xA;drawing, and if it can&amp;rsquo;t, you can make analogy to something from common life.&#xA;It&amp;rsquo;s great how much errors are stressed out like this, during planing stage.&#xA;Reminds me of &lt;a href=&#34;https://www.youtube.com/watch?v=PUv66718DII&#34;&gt;Brad Victor&lt;/a&gt;. We&#xA;opened back in April and we caused so much joy, but there is so much to explore&#xA;and so much to learn. What a great ride up to now!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Dockerize Everything</title>
      <link>https://meka.rs/blog/2015/06/18/dockerize-everything/</link>
      <pubDate>Thu, 18 Jun 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/06/18/dockerize-everything/</guid>
      <description>&lt;p&gt;Often I hear the &amp;ldquo;Dockerize Everything&amp;rdquo; phrase. To be honest, when ever there&amp;rsquo;s&#xA;a new technology, people praise it as &amp;ldquo;it fixes everything&amp;rdquo;. I don&amp;rsquo;t believe&#xA;that&amp;rsquo;s the truth about any technology, not even docker. It&amp;rsquo;s not that I think&#xA;docker is a bad thing. Hell, I wrote&#xA;&lt;a href=&#34;https://meka.rs/tag/cloud-basics.html&#34;&gt;series of blog posts about docker&lt;/a&gt;. I just think docker is&#xA;used where it&amp;rsquo;s not suited too often. One such example is data container. As it&#xA;might be great for huge number of servers, it&amp;rsquo;s not that great for small fleets&#xA;of servers. For example, if you have nginx and data container such that data&#xA;container is used as a volume for nginx, every time you change data container&#xA;because you have new files, nginx has to be restarted. That means you have&#xA;downtime even if you want to upload just a new css file. That&amp;rsquo;s not so great.&#xA;But why would you ignore &amp;ldquo;normal&amp;rdquo; directories just because docker exists? Docker&#xA;can use directory as a volume, so if you upload the same css file to a server&amp;rsquo;s&#xA;directory, no downtime is needed. That&amp;rsquo;s what I did for my blog: have the static&#xA;files in directory and use nginx docker container.&lt;/p&gt;&#xA;&lt;p&gt;Just to conclude, it&amp;rsquo;s important to research new technologies, but it&amp;rsquo;s equally&#xA;important to draw the line what should new technology do, and what should old&#xA;one be used.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>pfSense Community</title>
      <link>https://meka.rs/blog/2015/06/17/pfsense-community/</link>
      <pubDate>Wed, 17 Jun 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/06/17/pfsense-community/</guid>
      <description>&lt;p&gt;Few days ago I wrote about&#xA;&lt;a href=&#34;https://meka.rs/blog/2015/06/07/pfsense-vs-openbsd&#34;&gt;pfsense vs openbsd&lt;/a&gt; and&#xA;&lt;a href=&#34;https://twitter.com/meka_floss/status/607327909431361536&#34;&gt;twitted about it&lt;/a&gt;. As&#xA;you can see, it triggered a flamewar, which was never my intention. The reason I&#xA;continued that flamewar (and one more with the same person on other thread) was&#xA;the I had nothing better to do, to be honest. I was away from home with my&#xA;laptop, and I was tired of programming and administration projects. I&amp;rsquo;ve noticed&#xA;that OpenBSD community hardly said anything. I don&amp;rsquo;t understand why anyone would&#xA;be intimidated with the fact that one person twitted about not using some piece&#xA;of software. Having that attitude could never attract people. Linux user group&#xA;I&amp;rsquo;m member of had few men like that, and we ended up pushing away people who&#xA;wanted to be part of our group and contribute. Even if people are wrong, they&#xA;should be let to make mistake, if they decided to try something out.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, the arguments presented were funny. For example, one of the&#xA;arguments was that PF on FreeBSD 11 is faster than the one on OpenBSD 5.6. While&#xA;this may or may not be true, the fact is that FreeBSD 11 is not released, making&#xA;it bleeding edge version. At the same time, OpenBSD 5.7 is the current stable&#xA;version, not 5.6. And who said that the speed of firewall was even important,&#xA;compared to ease of use and integration with the rest of the system. As a matter&#xA;of fact, firewall is just one small part of the system, and it&amp;rsquo;s not even the&#xA;reason why I made the switch.&lt;/p&gt;&#xA;&lt;p&gt;All in all, pfSense community, or at least two gentlemen that were the loudest,&#xA;are one more reason why I will not use their product. It&amp;rsquo;s not my anger or any&#xA;other emotion. If I learned anything from open source projects is that community&#xA;is everything. Sad for pfSense!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>pfSense vs OpenBSD</title>
      <link>https://meka.rs/blog/2015/06/07/pfsense-vs-openbsd/</link>
      <pubDate>Sun, 07 Jun 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/06/07/pfsense-vs-openbsd/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve had pfSense on my router for some time now. To be honest, about a year. The&#xA;reason I decided to switch to OpenBSD should be obvious, but I&amp;rsquo;ll write about it&#xA;anyway. Let me introduce you to the background of the two choices.&lt;/p&gt;&#xA;&lt;p&gt;PfSense is based on FreeBSD. To be more precise, version 2.1 which was latest&#xA;stable release up to few months ago, is based on FreeBSD 8, while 2.2 is based&#xA;on FreeBSD 10. To be honest, FreeBSD is one of the most exciting projects ever.&#xA;In my opinion mostly because of the technologies it ported from other operating&#xA;systems like ZFS and DTrace from OpenSolaris and PF from OpenBSD, to name the&#xA;few. With such diversity of ported projects, it has my deep respect if for&#xA;nothing else, than for being able to incorporate and maintain them in a secure&#xA;and stable way. If you ever tried to continuously port and maintain a software&#xA;from other platform, you know what it takes. For me, firewall is the most&#xA;important part of routing OS, and FreeBSD having incorporated the best one,&#xA;makes it great.&lt;/p&gt;&#xA;&lt;p&gt;But, it&amp;rsquo;s not all that great. For example, PF in FreeBSD is based on OpenBSD&amp;rsquo;s&#xA;implementation (which is original) from 4 years ago. Although FreeBSD and&#xA;OpenBSD have different plans and courses for their implementation of PF, I like&#xA;OpenBSD&amp;rsquo;s syntax better. Another thing that made me switch to OpenBSD is DHCP+DNS&#xA;on pfSense. I don&amp;rsquo;t know if it&amp;rsquo;s up to FreeBSD or pfSense, but once a machine&#xA;gets IP, it takes too long (as in 15 minutes) for it to be registered in DNS.&#xA;All of this was enough for me to at least try OpenBSD. Hmmmm &amp;hellip; try. Let me&#xA;tell you I&amp;rsquo;m not going back to pfSense, but I might give FreeBSD a chance. I like&#xA;to experiment, so we&amp;rsquo;ll see.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve also ditched ubound and dhcpd in favor of DNSMasq which serves great as a&#xA;DHCP+DNS server. WiFi hostap works like a charm, and almost every system config&#xA;file is in /etc. The way to make console redirect to serial port is to enter 2&#xA;lines in /etc/boot.conf (you have to use proper pfSense image to do that). All&#xA;that and the fact that Cisco and Apple is PF makes me feel warm. :o) No,&#xA;seriously, what makes me have this feeling of security is what I&amp;rsquo;ve heard from&#xA;a friend few years back: &amp;ldquo;OpenBSD policy that the mistake in the documentation&#xA;is the mistake in the code&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;One of these days I&amp;rsquo;ll be writing a script to automate the provisioning of my&#xA;router which will portrait the ease of using OpenBSD more than this post.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Tube vs Transistor</title>
      <link>https://meka.rs/blog/2015/06/07/tube-vs-transistor/</link>
      <pubDate>Sun, 07 Jun 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/06/07/tube-vs-transistor/</guid>
      <description>&lt;p&gt;For so long I&amp;rsquo;ve listened about debate how tubes have &amp;ldquo;warmer&amp;rdquo; sound. All&#xA;audiophiles will tell you that you can not compare amps which are tube based to&#xA;those that have transistors in them. I don&amp;rsquo;t say they&amp;rsquo;re wrong, but I&amp;rsquo;m never&#xA;satisfied with &amp;ldquo;It&amp;rsquo;s just the way it is&amp;rdquo; explanation, so I searched for more&#xA;info. First, I don&amp;rsquo;t believe that just because you use tubes you get better&#xA;sound. There has to be more to it. As they&amp;rsquo;ve explained me, tubes have a feature&#xA;which makes even harmonics stand out, while the transistor does the same for odd&#xA;ones. This makes tube harmonics get along better. For simplicity, think of&#xA;overtones which are octaves. Octaves are 2x, 4x, 8x &amp;hellip; the original sound which&#xA;are even harmonics.&lt;/p&gt;&#xA;&lt;p&gt;Now the fun part. I didn&amp;rsquo;t know, but more than once I&amp;rsquo;ve heard from really&#xA;educated people that you can make an amp with transistors which makes even&#xA;harmonics stand out. You&amp;rsquo;ll probably ask yourself, just like I did, why don&amp;rsquo;t&#xA;we have these amps around. I don&amp;rsquo;t know, but I&amp;rsquo;m almost sure it has something&#xA;to do with economy.&lt;/p&gt;&#xA;&lt;p&gt;There is some area of audio amps where tubes are superb and transistors can&amp;rsquo;t&#xA;ever come close to them: distortion in guitar amps. The reason for this is that&#xA;tubes and transistors act totally different when they are saturated, hence the&#xA;difference in sound of distortion.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m a guitar player, among other things, and the best think I can think of, in&#xA;theory, is tube preamp with transistor power amp which makes even harmonics&#xA;stand out. I don&amp;rsquo;t know if it&amp;rsquo;s possible, but I would sure would like to try to&#xA;create one.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title></title>
      <link>https://meka.rs/resume/</link>
      <pubDate>Sat, 06 Jun 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/resume/</guid>
      <description>&lt;p&gt;&lt;a class=&#34;nopdf&#34; href=&#34;../resume.pdf&#34;&gt;PDF&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;goran-mekić&#34;&gt;Goran Mekić&lt;/h1&gt;&#xA;&lt;h3 id=&#34;senior-backend-systems-engineer--low-latency--distributed-systems--rust-c-python&#34;&gt;Senior Backend Systems Engineer | Low-Latency &amp;amp; Distributed Systems | Rust, C++, Python&lt;/h3&gt;&#xA;&lt;a href=&#34;#personal-statement&#34; aria-label=&#34;Personal statement&#34;&gt;&#xA;  &lt;h2 id=&#34;personal-statement&#34;&gt;Personal Statement&lt;/h2&gt;&#xA;&lt;/a&gt;&#xA;&lt;p&gt;Senior backend engineer with 15+ years of experience designing, optimizing, and operating&#xA;high-performance distributed systems in production environments. Specializes in low-latency&#xA;processing, system-level optimization, and debugging complex interactions across compute,&#xA;networking, and storage layers.&lt;/p&gt;&#xA;&lt;p&gt;Proven track record of improving performance and reliability in large-scale infrastructure,&#xA;including systems managing 250+ PB of data. Strong background in real-time processing&#xA;(audio/DSP), with deep understanding of latency, throughput, and resource efficiency constraints.&lt;/p&gt;&#xA;&lt;p&gt;Operates comfortably across the full system stack, from kernel-level behavior and storage&#xA;systems to backend services and distributed orchestration.&lt;/p&gt;&#xA;&lt;h3 id=&#34;social-engagement&#34;&gt;Social Engagement&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=gByyga_5mPw&amp;amp;list=PLpeJ1COhO5aneha988XS5ny6hMQ105g4a&#34;&gt;C++ lectures in Serbian&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=XnJjMqa5fDw&#34;&gt;DaFED #61 – Kako automatizacija procesa pomaže u razvoju sigurnijih aplikacija&lt;/a&gt; → Presented how process automation improves application security and reduces human error in development workflows&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://archive.fosdem.org/2023/schedule/event/reggae_jails_vms_on_freebsd/&#34;&gt;FOSDEM 2023 – Reggae: cool way of managing jails/VMs on FreeBSD&lt;/a&gt; → Introduced Reggae as a tool for managing FreeBSD jails and virtual machines, focusing on scalable development environments&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=9xIGfs6Bqpo&#34;&gt;EuroBSD 2022 – FreeBSD audio in amateur and professional setups&lt;/a&gt; → Explored FreeBSD-based audio workflows across hobbyist and professional use cases, including system configuration and performance&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://archive.fosdem.org/2021/schedule/event/cbsd_ecosystem/&#34;&gt;FOSDEM 2021 – Managing virtual resources with CBSD, and beyond&lt;/a&gt; → Demonstrated advanced resource management and orchestration using CBSD for virtualization on FreeBSD&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://archive.org/download/BSidesLjubljana2019/t1_08_How_Did_We_Teach_%28Ourselves%29_Security-Goran_Meki%C4%87.mp4&#34;&gt;BSides Ljubljana 2019 – How Did We Teach (Ourselves) Security&lt;/a&gt; → Shared practical approaches to self-learning and teaching cybersecurity within community-driven environments&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://archive.fosdem.org/2019/schedule/event/freebsd_in_audio_studio/&#34;&gt;FOSDEM 2019 – FreeBSD in Audio Studio&lt;/a&gt; → Presented real-world usage of FreeBSD in audio production environments, covering stability and performance considerations&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://archive.org/download/BSidesLjubljana2018/18ModernAndSecureDevopsOnFreebsdByGoranMeki.mp4&#34;&gt;BSides Ljubljana 2018 – Modern and Secure DevOps on FreeBSD&lt;/a&gt; → Covered secure DevOps practices using FreeBSD, including isolation, automation, and system hardening&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://archive.fosdem.org/2018/schedule/event/cbsd_isolation_manager/&#34;&gt;FOSDEM 2018 – CBSD Isolation Manager&lt;/a&gt; → Introduced CBSD as a solution for lightweight virtualization and system isolation on FreeBSD&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=DHNnCXgD4RU&#34;&gt;BalCCon 2016 – FLOSS Way of Funding a Hackerspace&lt;/a&gt; → Discussed sustainable funding models for open-source communities and hackerspaces&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=KpzQpAAwBvA&#34;&gt;BalCCon 2015 – What is Hackerspace&lt;/a&gt; → Introduced the concept, structure, and community impact of hackerspaces&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;high-impact-contributions&#34;&gt;High-Impact Contributions&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Led performance optimization efforts across distributed systems handling 250+ PB of data,&#xA;improving reliability and reducing system bottlenecks&lt;/li&gt;&#xA;&lt;li&gt;Diagnosed and resolved complex system issues including deadlocks, race conditions, and&#xA;cross-layer performance degradation&lt;/li&gt;&#xA;&lt;li&gt;Built and optimized low-latency processing systems in Rust and C++ for real-time environments&lt;/li&gt;&#xA;&lt;li&gt;Designed backend and infrastructure systems that scale across hundreds of nodes with high&#xA;availability&lt;/li&gt;&#xA;&lt;li&gt;Improved observability and debugging capabilities using advanced tracing and monitoring tools&lt;/li&gt;&#xA;&lt;li&gt;Consistently trusted with production-critical systems where failure has significant operational&#xA;impact&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;technical-scope&#34;&gt;Technical Scope&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Languages: Rust, C++, Python, TypeScript&lt;/li&gt;&#xA;&lt;li&gt;Systems: FreeBSD, Linux, ZFS&lt;/li&gt;&#xA;&lt;li&gt;Distributed Systems: AWS, Docker, Ansible, SaltStack&lt;/li&gt;&#xA;&lt;li&gt;Performance &amp;amp; Observability: DTrace, Prometheus, Grafana&lt;/li&gt;&#xA;&lt;li&gt;Backend Systems: FastAPI, Flask, REST APIs&lt;/li&gt;&#xA;&lt;li&gt;Specialized Domains: Real-time processing, DSP systems, virtualization&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;ai--systems-thinking&#34;&gt;AI &amp;amp; Systems Thinking&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Strong understanding of constraints relevant to modern AI systems including latency, throughput,&#xA;and resource usage&lt;/li&gt;&#xA;&lt;li&gt;Experience working with data-intensive and real-time processing systems applicable to speech and&#xA;inference workloads&lt;/li&gt;&#xA;&lt;li&gt;Regularly integrates AI tools into engineering workflows for faster iteration and problem solving&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;engineering-approach&#34;&gt;Engineering Approach&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Focus on building systems that are predictable, debuggable, and performant under real-world&#xA;conditions&lt;/li&gt;&#xA;&lt;li&gt;Preference for simple, reliable solutions over unnecessary complexity&lt;/li&gt;&#xA;&lt;li&gt;Comfortable operating in fast-moving environments with evolving requirements&lt;/li&gt;&#xA;&lt;li&gt;Strong bias toward understanding system behavior at a deep level&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr/&gt;&#xA;&lt;a href=&#34;#work-experience&#34; aria-label=&#34;Work experience&#34;&gt;&#xA;  &lt;h2 id=&#34;work-experience&#34;&gt;Work Experience&lt;/h2&gt;&#xA;&lt;/a&gt;&#xA;&lt;div id=&#34;sysit&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;sysit--2026&#34;&gt;&lt;a href=&#34;https://sys.it.com/&#34;&gt;SysIT&lt;/a&gt; | 2026&lt;/h3&gt;&#xA;&lt;p&gt;Business Development &amp;amp; Technical Consultant&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Advise organizations on aligning technology strategy with business objectives, with a focus on&#xA;scalable and efficient systems&lt;/li&gt;&#xA;&lt;li&gt;Design and implement AI-driven solutions using tools such as Claude, ChatGPT, and Gemini to&#xA;automate workflows and improve decision-making&lt;/li&gt;&#xA;&lt;li&gt;Architect, deploy, and manage containerized infrastructure using Kubernetes, ensuring&#xA;reliability, scalability, and cost efficiency&lt;/li&gt;&#xA;&lt;li&gt;Develop and maintain infrastructure as code using Terraform to enable repeatable, secure,&#xA;and automated environments&lt;/li&gt;&#xA;&lt;li&gt;Deliver high-performance systems development in Rust, including low-level and DSP-focused&#xA;applications&lt;/li&gt;&#xA;&lt;li&gt;Perform kernel-level debugging and patching in FreeBSD environments to resolve complex system&#xA;issues&lt;/li&gt;&#xA;&lt;li&gt;Analyze and optimize system and application performance using advanced tools such as DTrace&lt;/li&gt;&#xA;&lt;li&gt;Support engineering teams in improving development processes, reducing technical debt, and&#xA;accelerating delivery cycles&lt;/li&gt;&#xA;&lt;li&gt;Partner with stakeholders to identify inefficiencies and implement technical solutions that&#xA;streamline operations and improve product performance&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;bakson&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;bakson-ltd--2025&#34;&gt;&lt;a href=&#34;https://baksonltd.com/&#34;&gt;Bakson LTD&lt;/a&gt; | 2025&lt;/h3&gt;&#xA;&lt;p&gt;Led the modernization of OSS deployment pipelines and infrastructure management through Terraform,&#xA;Kubernetes, and proactive technical guidance.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Contributed to variety of OSS projects in different programming languages&lt;/li&gt;&#xA;&lt;li&gt;Worked with a variety of teams to maintain high standards of quality across OSS projects&lt;/li&gt;&#xA;&lt;li&gt;Collaborated with software developers, system administrators, and IT staff to streamline&#xA;development and deployment workflows&lt;/li&gt;&#xA;&lt;li&gt;Set up and maintenance cloud infrastructure required to run specific OSS projects&lt;/li&gt;&#xA;&lt;li&gt;Designed, implemented, and managed CI/CD pipelines for efficient software delivery&lt;/li&gt;&#xA;&lt;li&gt;Mentored junior team members and provide technical guidance&lt;/li&gt;&#xA;&lt;li&gt;Administered kubernetes cluster&lt;/li&gt;&#xA;&lt;li&gt;Maintained terraform code&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;axcient&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;axcient--2022--2025&#34;&gt;&lt;a href=&#34;https://axcient.com&#34;&gt;Axcient&lt;/a&gt; | 2022 – 2025&lt;/h3&gt;&#xA;&lt;p&gt;Owned performance, reliability, and scalability of large-scale distributed storage systems&#xA;operating across multiple data centers.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Drove system-level performance improvements across infrastructure managing 200+ PB of data&lt;/li&gt;&#xA;&lt;li&gt;Investigated and resolved critical production issues involving distributed coordination,&#xA;storage systems, and compute interactions&lt;/li&gt;&#xA;&lt;li&gt;Performed deep analysis of system behavior using tracing tools (DTrace) and monitoring systems&lt;/li&gt;&#xA;&lt;li&gt;Built automation for managing infrastructure across hundreds of machines using SaltStack&lt;/li&gt;&#xA;&lt;li&gt;Improved observability using Prometheus and Grafana, enabling faster diagnosis of production issues&lt;/li&gt;&#xA;&lt;li&gt;Partnered with engineering teams to improve system architecture and operational reliability&lt;/li&gt;&#xA;&lt;li&gt;Systems Architect / Backend Engineer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;fourity&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;fourity--2021--2022&#34;&gt;&lt;a href=&#34;https://fourity.com&#34;&gt;Fourity&lt;/a&gt; | 2021 – 2022&lt;/h3&gt;&#xA;&lt;p&gt;Led design and implementation of backend and distributed systems across multiple projects.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Architected scalable backend systems with focus on performance, resilience, and maintainability&lt;/li&gt;&#xA;&lt;li&gt;Designed distributed system components and infrastructure automation strategies&lt;/li&gt;&#xA;&lt;li&gt;Delivered systems capable of handling high-load environments with minimal operational overhead&lt;/li&gt;&#xA;&lt;li&gt;Provided technical leadership and guided engineering decisions across teams&lt;/li&gt;&#xA;&lt;li&gt;Senior Backend Engineer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;firebird-networks&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;firebird-networks-pulsar--2018---2019&#34;&gt;Firebird Networks Pulsar | 2018 - 2019&lt;/h3&gt;&#xA;&lt;p&gt;As the sole architect and developer for the Firebird Networks Pulsar project,&#xA;I was responsible for the design and development of a network gear&#xA;configuration automation tool. Using Ansible, I automated the setup and&#xA;management of network infrastructure, making future deployments easier and&#xA;faster for the company. My role included the full software development&#xA;lifecycle, from requirements gathering to implementation and testing.&#xA;Additionally, I worked on the frontend development with React and integrated&#xA;real-time features using WebSockets for live monitoring and control of network&#xA;gear.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Architecture Design: Designed and implemented a scalable solution for&#xA;automating network gear configurations, improving deployment speed and&#xA;reducing human error.&lt;/li&gt;&#xA;&lt;li&gt;Full Stack Development: Developed both frontend and backend components of the&#xA;system, using React and Flask to create a user-friendly interface and a&#xA;robust API for network management.&lt;/li&gt;&#xA;&lt;li&gt;Real-Time Monitoring: Integrated real-time monitoring capabilities, allowing&#xA;users to monitor and control their network gear from the web interface using&#xA;WebSockets and Socket.IO.&lt;/li&gt;&#xA;&lt;li&gt;Deployment Automation: Leveraged Ansible to automate the deployment and&#xA;configuration of network gear, reducing the time spent on manual setup and&#xA;ensuring consistency across environments.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: React, Flask, Ansible, Python, WebSockets, Socket.IO&lt;/p&gt;&#xA;&lt;div id=&#34;cala-health&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;cala-health--2018&#34;&gt;&lt;a href=&#34;https://www.calahealth.com&#34;&gt;Cala Health&lt;/a&gt; | 2018&lt;/h3&gt;&#xA;&lt;p&gt;Worked on a regulated medical platform requiring high reliability, performance, and secure data handling.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Designed and developed backend services supporting real-time, data-intensive medical workflows&lt;/li&gt;&#xA;&lt;li&gt;Built and maintained REST APIs used across internal systems and external integrations&lt;/li&gt;&#xA;&lt;li&gt;Improved system performance through profiling and optimization of backend services&lt;/li&gt;&#xA;&lt;li&gt;Contributed to architecture decisions around scalability, fault tolerance, and system reliability&lt;/li&gt;&#xA;&lt;li&gt;Implemented secure data handling aligned with medical and privacy requirements&lt;/li&gt;&#xA;&lt;li&gt;Collaborated with product, research, and clinical teams to deliver reliable system behavior&lt;/li&gt;&#xA;&lt;li&gt;Debugged production issues with focus on stability and predictable performance under load&lt;/li&gt;&#xA;&lt;li&gt;Integrated AWS services (S3, Cognito) for secure storage, authentication, and scalability&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;geosolutions&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;geosolutions--2017&#34;&gt;&lt;a href=&#34;https://www.geo-solutions.it&#34;&gt;GeoSolutions&lt;/a&gt; | 2017&lt;/h3&gt;&#xA;&lt;p&gt;During my time at GeoSolutions, I contributed to the development and&#xA;implementation of a custom monitoring solution for GeoNode, an open-source&#xA;platform for geospatial data management. My work focused on optimizing the&#xA;performance of GeoNode by integrating a robust monitoring system with Django/Python,&#xA;React, and D3.js for data visualization. This solution helped provide&#xA;actionable insights into system performance and user engagement, ultimately&#xA;improving the user experience for clients.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Monitoring Solution Development: Designed and implemented a custom monitoring&#xA;system that tracked system performance and user interactions with GeoNode,&#xA;using Django/Python and React for the web application layer.&lt;/li&gt;&#xA;&lt;li&gt;Data Visualization: Leveraged D3.js to create interactive and meaningful&#xA;visualizations that helped clients better understand the state of their&#xA;geospatial data and system performance.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Django/Python, React, D3.js, GeoNode&lt;/p&gt;&#xA;&lt;div id=&#34;photoslurp&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;photoslurp--2015---2016&#34;&gt;&lt;a href=&#34;http://www.photoslurp.com/&#34;&gt;Photoslurp&lt;/a&gt; | 2015 - 2016&lt;/h3&gt;&#xA;&lt;p&gt;At Photoslurp, I was part of a dynamic team responsible for development and&#xA;maintainance of a platform designed for the collection, exchange, and&#xA;management of media rights for photos and artwork. As a full-stack developer,&#xA;I played a pivotal role in both frontend and backend development. My main focus&#xA;was ensuring that the platform could efficiently handle media rights requests&#xA;and facilitate the acquisition of media through a seamless user interface.&#xA;I worked closely with designers to implement interactive elements and with&#xA;backend engineers to ensure data integrity, efficient workflows, and real-time&#xA;processing of media requests.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Frontend Development: Participated in the development of user-friendly&#xA;frontend features using Bootstrap and jQuery to ensure the platform was&#xA;visually appealing and easy to navigate. I also integrated Underscore and&#xA;Backbone.js to facilitate more dynamic user interactions, allowing users to&#xA;manage media rights seamlessly.&lt;/li&gt;&#xA;&lt;li&gt;Backend Development: Contributed to the backend development of the platform&#xA;using Django/Python, which was crucial for managing media data, user permissions,&#xA;and rights. I also worked on the integration of Celery for task scheduling&#xA;and asynchronous processing of media requests.&lt;/li&gt;&#xA;&lt;li&gt;API Development: Designed and built RESTful APIs to handle media rights&#xA;requests, ensuring that they were easy to use, secure, and scalable.&#xA;This included building endpoints for uploading, retrieving, and managing&#xA;media data.&lt;/li&gt;&#xA;&lt;li&gt;Continuous Deployment: Worked with Ansible to automate the deployment of the&#xA;platform, enabling continuous integration and delivery (CI/CD) to enhance the&#xA;efficiency of updates and maintenance.&lt;/li&gt;&#xA;&lt;li&gt;Backend Optimization: Implemented performance optimizations on the backend by&#xA;leveraging Redis and RabbitMQ for task queueing and message brokering,&#xA;ensuring fast and reliable media rights transactions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Django/Python, Bootstrap, jQuery, Backbone.js, Underscore, Celery, REST API, Ansible, Redis, RabbitMQ, PostgreSQL&lt;/p&gt;&#xA;&lt;div id=&#34;fsd&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;fsd--2015&#34;&gt;&lt;a href=&#34;https://fsd.rs&#34;&gt;fSD&lt;/a&gt; | 2015&lt;/h3&gt;&#xA;&lt;p&gt;At fSD, I was tasked with implementing and automating DevOps practices for the&#xA;development team working on an ERP system based on PHP and EmberJS. The project&#xA;required a focus on streamlining the development, deployment, and operations&#xA;processes to ensure a consistent, secure, and scalable environment. I worked&#xA;closely with the development and infrastructure teams to integrate modern&#xA;DevOps tools and security best practices, ultimately enhancing the reliability&#xA;and security of the system.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;DevOps Automation: Implemented Ansible to automate various development&#xA;workflows, including server provisioning, configuration management, and&#xA;deployment pipelines, allowing the development team to focus more on coding&#xA;and less on manual processes.&lt;/li&gt;&#xA;&lt;li&gt;Infrastructure Management: Designed and deployed infrastructure solutions to&#xA;ensure efficient and stable environments for development, staging, and&#xA;production. I used Vagrant to manage virtualized development environments,&#xA;improving consistency across the team and reducing the &amp;ldquo;works on my machine&amp;rdquo;&#xA;issues.&lt;/li&gt;&#xA;&lt;li&gt;CI/CD Pipeline: Integrated Jenkins for continuous integration and delivery,&#xA;ensuring that code changes were automatically tested, built, and deployed.&#xA;This reduced deployment errors and enabled faster release cycles.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Ansible, Vagrant, PHP, Percona, Nginx, Jenkins, EmberJS&lt;/p&gt;&#xA;&lt;div id=&#34;reciprocity-labs&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;reciprocity-labs--2014---2015&#34;&gt;&lt;a href=&#34;http://reciprocitylabs.com&#34;&gt;Reciprocity Labs&lt;/a&gt; | 2014 - 2015&lt;/h3&gt;&#xA;&lt;p&gt;At Reciprocity Labs, I was brought in as a backend developer with a focus on&#xA;implementing secure authentication mechanisms, particularly SAML (Security&#xA;Assertion Markup Language) authentication. The primary goal was to integrate a&#xA;robust identity management system for our clients to enable secure and seamless&#xA;single sign-on (SSO) functionality across multiple applications. Over time, my&#xA;responsibilities expanded to include frontend work, and I contributed to the&#xA;full-stack development of the project. My role involved improving security&#xA;practices, enhancing application performance, and collaborating with teams to&#xA;ensure secure, scalable, and efficient architecture.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SAML Authentication Implementation: Led the implementation of SAML&#xA;authentication for the project, which allowed the integration of a secure and&#xA;scalable single sign-on (SSO) solution. This involved working with various&#xA;identity providers and ensuring the correct configuration of authentication&#xA;flows.&lt;/li&gt;&#xA;&lt;li&gt;Backend Development: Developed the core backend services using Python and&#xA;Flask, building secure RESTful APIs for handling user data, authentication,&#xA;and application logic. I worked closely with the team to ensure that the APIs&#xA;were well-documented, secure, and easy to integrate.&lt;/li&gt;&#xA;&lt;li&gt;Security Best Practices: Served as a security advisor, helping to implement&#xA;server hardening measures to protect against common vulnerabilities. This&#xA;included setting up proper authentication, encryption protocols, and access&#xA;control lists (ACLs), among other security measures.&lt;/li&gt;&#xA;&lt;li&gt;Infrastructure &amp;amp; Automation: Utilized Vagrant and Ansible to automate&#xA;development and deployment processes, ensuring consistency and ease of&#xA;provisioning across development, staging, and production environments. This&#xA;allowed the team to focus on development while maintaining a high level of&#xA;infrastructure automation.&lt;/li&gt;&#xA;&lt;li&gt;Frontend Development: As the project evolved, I took on frontend&#xA;responsibilities, working with the team to improve the user interface using&#xA;JavaScript, CSS, and other frontend technologies. I worked on user experience&#xA;improvements, ensuring the interface was intuitive and secure for users.&lt;/li&gt;&#xA;&lt;li&gt;Database Integration: Assisted with the integration of MySQL for data storage&#xA;and worked on optimizing database queries and schema design to ensure the&#xA;platform could scale as the user base grew.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Python (Flask), SAML, RESTful APIs, Vagrant, Ansible, MySQL, JavaScript, CSS, Server Hardening, Git&lt;/p&gt;&#xA;&lt;div id=&#34;lambda-solutions&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;lambda-solutions--2014---2014&#34;&gt;&lt;a href=&#34;http://www.lambdasolutions.net/&#34;&gt;Lambda Solutions&lt;/a&gt; | 2014 - 2014&lt;/h3&gt;&#xA;&lt;p&gt;At Lambda Solutions, I served as the primary System Administrator responsible&#xA;for the deployment, configuration, and maintenance of hosting solutions for&#xA;Moodle and Totara, two leading open-source learning management systems (LMS).&#xA;The role required a strong focus on managing scalable, high-performance&#xA;infrastructure that could support educational institutions and organizations.&#xA;My responsibilities spanned across system provisioning, automation, and&#xA;ensuring the systems remained secure, stable, and optimized to handle the&#xA;traffic and data storage demands of e-learning environments.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;System Deployment &amp;amp; Configuration: Deployed and configured highly available&#xA;and secure environments for Moodle and Totara, ensuring that these LMS&#xA;platforms could scale and handle large volumes of users, content, and&#xA;activity. I implemented best practices in system administration to ensure&#xA;both systems were running optimally and securely.&lt;/li&gt;&#xA;&lt;li&gt;Infrastructure Automation: Utilized Ansible to automate the provisioning and&#xA;configuration of servers. This reduced the time required to deploy and&#xA;configure new environments, increasing the efficiency of the team and&#xA;improving the consistency of the infrastructure.&lt;/li&gt;&#xA;&lt;li&gt;Cloud Management: Worked with Amazon Web Services (AWS) to deploy scalable&#xA;cloud-based solutions. I set up and managed AWS resources such as EC2&#xA;instances, S3 buckets for storage, and RDS for databases, ensuring that the&#xA;infrastructure was cost-effective and scalable based on the needs of the&#xA;clients.&lt;/li&gt;&#xA;&lt;li&gt;System Monitoring &amp;amp; Troubleshooting: Implemented monitoring tools and&#xA;processes to ensure system health and uptime. I worked with tools such as&#xA;Nagios and Zabbix to continuously monitor server performance, alerting the&#xA;team to potential issues before they impacted end-users. I also handled&#xA;troubleshooting of any system failures or performance degradation.&lt;/li&gt;&#xA;&lt;li&gt;Security Management: Applied security patches, set up firewalls, and&#xA;configured SSL/TLS encryption to protect sensitive data. I ensured that best&#xA;practices in system security were followed, including hardening the servers&#xA;and ensuring that only authorized access was granted to the systems.&lt;/li&gt;&#xA;&lt;li&gt;Backup &amp;amp; Disaster Recovery: Designed and implemented backup strategies to&#xA;ensure data integrity and availability. I worked with AWS S3 for remote&#xA;backups and configured automated daily backups to minimize the risk of data&#xA;loss in case of failure.&lt;/li&gt;&#xA;&lt;li&gt;Collaboration &amp;amp; Documentation: Worked closely with the development team to&#xA;troubleshoot and resolve any issues related to the integration of Moodle and&#xA;Totara into the client&amp;rsquo;s environment. I also created and maintained&#xA;comprehensive documentation to support ongoing operations and future&#xA;deployments.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Ansible, Moodle, Totara, AWS (EC2, S3, RDS), Linux (Debian/CentOS), SSL/TLS, Nagios, Zabbix, Vagrant, MySQL&lt;/p&gt;&#xA;&lt;div id=&#34;secent-llc&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;secent-llc--2013---2014&#34;&gt;&lt;a href=&#34;http://www.secent.com/&#34;&gt;Secent LLC&lt;/a&gt; | 2013 - 2014&lt;/h3&gt;&#xA;&lt;p&gt;At Secent LLC, I worked as a Team Lead and Senior Developer for an advanced&#xA;reverse proxy and single sign-on (SSO) solution designed for a major electrical&#xA;company. The project focused on building a highly configurable reverse proxy&#xA;system that could integrate seamlessly with the client’s infrastructure to&#xA;manage authentication, access control, and secure communications across&#xA;multiple internal and external systems. Additionally, I contributed to several&#xA;critical tasks involving development, security, and automation to ensure the&#xA;solution met the company&amp;rsquo;s rigorous security and scalability requirements.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Project Leadership: As the team lead, I managed a group of developers and&#xA;collaborated closely with system administrators to design and implement a&#xA;flexible, scalable reverse proxy system. I was responsible for coordinating&#xA;the development efforts and ensuring that the team adhered to deadlines,&#xA;followed best practices, and delivered high-quality code.&lt;/li&gt;&#xA;&lt;li&gt;Single Sign-On (SSO) Solution: Led the integration of a Single Sign-On (SSO)&#xA;solution based on Django/Python, which allowed the company to authenticate users&#xA;across various internal and external systems using a single set of&#xA;credentials. This implementation was built to be highly secure and scalable,&#xA;ensuring that sensitive data was protected at all times.&lt;/li&gt;&#xA;&lt;li&gt;Backend Development: As a senior developer, I worked extensively on the&#xA;backend of the solution, leveraging Django/Python to build custom RESTful APIs and&#xA;integrate SimpleSAMLphp for authentication. I was also responsible for&#xA;optimizing the performance of the backend and ensuring it could handle the&#xA;high volume of authentication requests securely.&lt;/li&gt;&#xA;&lt;li&gt;Security Enhancements: Contributed as a security advisor, ensuring that all&#xA;security best practices were followed throughout the development process. I&#xA;helped implement secure data transmission using SSL/TLS, enforced access&#xA;control policies, and conducted regular security audits to identify and&#xA;mitigate potential vulnerabilities.&lt;/li&gt;&#xA;&lt;li&gt;Automating Deployment: Utilized Ansible to automate the configuration and&#xA;deployment of servers. This allowed the team to quickly spin up and configure&#xA;new environments, ensuring that each deployment was consistent and secure.&#xA;I also worked with Git for version control and collaborated with the team to&#xA;maintain an efficient development workflow.&lt;/li&gt;&#xA;&lt;li&gt;Cross-Functional Collaboration: Worked closely with other teams, including&#xA;the DevOps and network security teams, to ensure that the reverse proxy&#xA;system integrated smoothly with other infrastructure components. I also&#xA;provided support for troubleshooting and resolving integration issues across&#xA;the organization.&lt;/li&gt;&#xA;&lt;li&gt;Database Integration &amp;amp; Management: Managed the configuration of databases&#xA;such as PostgreSQL to store user authentication data, ensuring that it was&#xA;encrypted and compliant with company security policies. I helped ensure that&#xA;the database was optimized for performance and could scale with the growing&#xA;user base.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Django/Python, REST API, SimpleSAMLphp, Git, SSL/TLS, Ansible,&#xA;PostgreSQL, Vagrant, Apache, AWS&lt;/p&gt;&#xA;&lt;p&gt;I worked on a project for an aerospace company that involved testing software&#xA;and building packages for in-house applications. This role focused heavily on&#xA;ensuring the quality, performance, and reliability of the software systems while&#xA;also contributing to packaging and deployment processes. My responsibilities&#xA;included creating robust testing strategies, managing software builds, and&#xA;automating deployment pipelines to ensure that software releases were stable&#xA;and met all specified requirements.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Software Testing &amp;amp; QA: Worked closely with the development team to test and&#xA;validate software for the aerospace company’s in-house projects. I designed&#xA;and executed various types of tests, including functional, performance, and&#xA;regression tests, to ensure the software met the required standards and&#xA;specifications.&lt;/li&gt;&#xA;&lt;li&gt;Build Automation: Assisted in the creation and maintenance of automated build&#xA;systems for software deployment. I utilized tools such as Jenkins to&#xA;streamline the build and testing processes, reducing the time required to&#xA;validate new software releases and ensuring that any issues could be quickly&#xA;identified.&lt;/li&gt;&#xA;&lt;li&gt;Package Management: Created packages for software deployment on various&#xA;platforms, ensuring that the installations were seamless and reliable. This&#xA;involved working with VMWare and other virtualization technologies to test&#xA;the software in isolated environments before deployment to production.&lt;/li&gt;&#xA;&lt;li&gt;Version Control &amp;amp; Collaboration: Collaborated with developers to manage&#xA;software versions and handle source code integration using Git. I helped&#xA;manage code repositories and maintained proper versioning to ensure that&#xA;software releases were traceable and reproducible.&lt;/li&gt;&#xA;&lt;li&gt;Deployment &amp;amp; Release Management: Contributed to the planning and execution&#xA;of software deployments, ensuring that the release processes were smooth and&#xA;that any necessary configuration changes were properly documented. I also&#xA;helped prepare documentation related to the deployment and configuration of&#xA;software packages.&lt;/li&gt;&#xA;&lt;li&gt;Issue Resolution &amp;amp; Troubleshooting: Worked with the development team to&#xA;troubleshoot issues identified during testing. I helped debug and resolve&#xA;software-related issues, ensuring that fixes were applied and retested&#xA;promptly before final release.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Jenkins, VMWare, Git, Redmine, Software Testing (manual and automated), Build Automation&lt;/p&gt;&#xA;&lt;div id=&#34;saturized&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;saturized--2011---2013&#34;&gt;&lt;a href=&#34;http://www.saturized.com/&#34;&gt;Saturized&lt;/a&gt; | 2011 - 2013&lt;/h3&gt;&#xA;&lt;p&gt;At Saturized, I was responsible for ensuring the reliability, performance, and&#xA;security of the company’s infrastructure. My role focused on capacity planning,&#xA;storage allocation, system backups, security management, and troubleshooting&#xA;recurring issues. The systems I managed were crucial to the company&amp;rsquo;s&#xA;operations, and I played a key role in ensuring that all technical requirements&#xA;were met while planning for future scalability and redundancy.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Capacity Planning &amp;amp; Storage Management: Managed and planned for system growth&#xA;by allocating storage and ensuring the infrastructure could scale to meet the&#xA;company&amp;rsquo;s needs. I handled the storage requirements for databases and file&#xA;servers, ensuring that the infrastructure could accommodate increasing data&#xA;loads while maintaining performance and redundancy.&lt;/li&gt;&#xA;&lt;li&gt;System Monitoring &amp;amp; Performance Tuning: Implemented monitoring tools such as&#xA;Munin, Icinga, and Zabbix to proactively track system health and performance.&#xA;I was responsible for identifying performance bottlenecks, optimizing system&#xA;configurations, and resolving issues before they impacted operations. This&#xA;included fine-tuning server configurations for optimal performance and&#xA;reliability.&lt;/li&gt;&#xA;&lt;li&gt;Backup &amp;amp; Disaster Recovery: Designed and implemented backup strategies to&#xA;ensure the integrity and safety of critical data. I ensured that backup&#xA;solutions were in place for both file and database storage, and I set up&#xA;disaster recovery plans to minimize downtime in the event of a failure.&lt;/li&gt;&#xA;&lt;li&gt;Security Management &amp;amp; Compliance: Worked closely with the security team to&#xA;implement strong security measures, including setting up firewalls, applying&#xA;security patches, and ensuring proper access controls. I was also responsible&#xA;for maintaining system hardening protocols to ensure compliance with security&#xA;standards and protect against unauthorized access.&lt;/li&gt;&#xA;&lt;li&gt;Server Maintenance &amp;amp; Administration: Managed various servers, including web&#xA;servers, file servers, and firewalls. I was responsible for the ongoing&#xA;maintenance, configuration, and troubleshooting of these servers, ensuring&#xA;that they remained secure, reliable, and available for company operations.&#xA;I used Puppet for configuration management to ensure that servers were&#xA;consistently configured across the infrastructure.&lt;/li&gt;&#xA;&lt;li&gt;Virtualization Management: Worked with QEmu/Libvirt to set up and manage&#xA;virtual machines (VMs), ensuring that resources were efficiently utilized and&#xA;that virtual environments were secure and properly isolated. I also assisted&#xA;with configuring and managing Gerrit and Git for source code version control.&lt;/li&gt;&#xA;&lt;li&gt;Team Collaboration &amp;amp; Root-Cause Analysis: Worked closely with the development&#xA;and network teams to conduct root-cause analysis of recurring system issues.&#xA;I identified patterns of failures, developed solutions to address them, and&#xA;collaborated with other teams to implement long-term fixes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: PostgreSQL (Master/Slave Replication), QEmu/Libvirt, Gerrit, Git, Redmine, Munin, Icinga, Zabbix, Puppet, Firewall Management, Jenkins&lt;/p&gt;&#xA;&lt;div id=&#34;ddor&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;ddor--2006---2011&#34;&gt;&lt;a href=&#34;http://www.ddor.rs/&#34;&gt;DDOR&lt;/a&gt; | 2006 - 2011&lt;/h3&gt;&#xA;&lt;p&gt;At DDOR, I was responsible for the administration and management of Solaris and&#xA;Linux systems, focusing on configuring, troubleshooting, and maintaining a&#xA;variety of services and applications. I played an essential role in ensuring&#xA;that the company&amp;rsquo;s IT infrastructure was secure, reliable, and scalable. My&#xA;work also included system backup and recovery, capacity planning, performance&#xA;tuning, and providing support for a wide range of internal systems.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Solaris &amp;amp; Linux System Administration: Managed both Solaris and Linux servers&#xA;for a wide range of business-critical applications. This included the&#xA;installation, configuration, and maintenance of various services, as well as&#xA;ensuring optimal performance and security across the entire infrastructure.&lt;/li&gt;&#xA;&lt;li&gt;Storage Management: Administered enterprise storage solutions, including EMC&#xA;Clariion and Fujitsu Eternus DX440 storage systems, ensuring data redundancy,&#xA;high availability, and performance. I was responsible for managing storage&#xA;volumes, setting up LUNs (Logical Unit Numbers), and ensuring that the&#xA;storage infrastructure was optimized for both performance and reliability.&lt;/li&gt;&#xA;&lt;li&gt;Virtualization &amp;amp; Cloud Infrastructure: Managed virtualization environments&#xA;using VMware ESXi, where I configured and maintained virtual machines (VMs)&#xA;and their corresponding resources. This included setting up virtual networks&#xA;and ensuring that VMs were properly configured for maximum resource&#xA;utilization and system security.&lt;/li&gt;&#xA;&lt;li&gt;Backup &amp;amp; Disaster Recovery: Responsible for configuring and managing backup&#xA;and recovery processes to protect critical company data. I implemented&#xA;regular backup routines, tested recovery procedures, and ensured that backup&#xA;data was always available and accessible in case of system failure.&lt;/li&gt;&#xA;&lt;li&gt;Performance Tuning &amp;amp; Capacity Planning: Led efforts for performance tuning,&#xA;identifying system bottlenecks, and optimizing server configurations to&#xA;ensure optimal system performance. I also performed capacity planning,&#xA;ensuring that the company’s infrastructure could scale with the growing&#xA;demands of the business.&lt;/li&gt;&#xA;&lt;li&gt;Security &amp;amp; Monitoring: Worked closely with the security team to implement&#xA;robust security measures, including configuring firewalls, ensuring the&#xA;proper application of security patches, and auditing system logs for&#xA;unauthorized access. I used monitoring tools such as Monit and Munin to track&#xA;system health and alert the team to potential issues before they became&#xA;critical.&lt;/li&gt;&#xA;&lt;li&gt;Troubleshooting &amp;amp; Support: Provided ongoing system support and&#xA;troubleshooting services for various IT systems, resolving issues related to&#xA;hardware, software, and network configurations. I worked with other teams to&#xA;ensure that issues were resolved quickly, minimizing downtime and disruption&#xA;to business operations.&lt;/li&gt;&#xA;&lt;li&gt;Configuration Management &amp;amp; Automation: Used Puppet for managing the&#xA;configuration of servers and ensuring that all systems were consistent,&#xA;properly configured, and compliant with internal policies. I also contributed&#xA;to the automation of various system management tasks to reduce manual work&#xA;and improve overall efficiency.&lt;/li&gt;&#xA;&lt;li&gt;Application Support: Supported applications such as Oracle APP and Tomcat by&#xA;configuring, monitoring, and troubleshooting performance issues to ensure&#xA;seamless operation. I ensured that the applications were secure and&#xA;accessible, with minimal downtime.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Solaris, Linux, EMC Clariion, Fujitsu Eternus DX440, VMware ESXi, Monit, Munin, Puppet, Oracle APP, Tomcat, Subversion&lt;/p&gt;&#xA;&lt;div id=&#34;home-invest&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;home-invest--2006---2006&#34;&gt;&lt;a href=&#34;http://homeinvest.rs/&#34;&gt;Home Invest&lt;/a&gt; | 2006 - 2006&lt;/h3&gt;&#xA;&lt;p&gt;At Home Invest, I was responsible for the implementation, administration, and&#xA;ongoing maintenance of various network services, including Mail, DHCP, DNS, and&#xA;Domain Controller. This role required ensuring that the infrastructure was&#xA;secure, efficient, and well-maintained, with a focus on Linux-based solutions&#xA;and firewall security. I contributed to optimizing and automating the company&amp;rsquo;s&#xA;IT operations, ensuring smooth communication and network services across the&#xA;organization.&lt;/p&gt;&#xA;&lt;p&gt;Key Responsibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Network Services Management: Installed, configured, and maintained critical&#xA;network services including Mail (Postfix, Dovecot), DHCP, DNS (Bind), and&#xA;Domain Controllers. This ensured that all network communications and services&#xA;were running efficiently, securely, and with minimal downtime.&lt;/li&gt;&#xA;&lt;li&gt;Linux-based System Administration: Led the administration of Linux systems&#xA;that served as the foundation for the company&amp;rsquo;s network infrastructure.&#xA;Ensured proper configuration, updates, and security patches were applied in a&#xA;timely manner to keep systems secure and functional.&lt;/li&gt;&#xA;&lt;li&gt;Firewall Configuration &amp;amp; Security: Managed network security using IPTables&#xA;to set up firewalls, securing the company’s internal and external&#xA;communications. I configured firewall rules to prevent unauthorized access,&#xA;protect against external threats, and enforce strict access control policies.&lt;/li&gt;&#xA;&lt;li&gt;Email System Setup &amp;amp; Maintenance: Configured and maintained the company&amp;rsquo;s&#xA;email servers, ensuring reliable communication both internally and externally.&#xA;I configured Postfix for mail sending, Dovecot for IMAP, and applied&#xA;necessary filters to ensure security, such as anti-spam measures.&lt;/li&gt;&#xA;&lt;li&gt;DNS Setup &amp;amp; Maintenance: Managed the company’s DNS servers using Bind,&#xA;ensuring that the domain names were properly configured and that DNS queries&#xA;were resolved quickly and accurately. This was crucial to maintaining&#xA;seamless internet connectivity and access to company resources.&lt;/li&gt;&#xA;&lt;li&gt;User Account &amp;amp; Permission Management: Configured user accounts and&#xA;permissions, ensuring that employees had the appropriate access to the&#xA;network resources they needed while maintaining a secure environment. This&#xA;included managing access to network shares, email services, and domain&#xA;resources.&lt;/li&gt;&#xA;&lt;li&gt;System Monitoring &amp;amp; Troubleshooting: Monitored system health and performance,&#xA;ensuring that all services were up and running. Addressed any issues related&#xA;to system performance or network downtime and applied solutions in a timely&#xA;manner to minimize disruptions.&lt;/li&gt;&#xA;&lt;li&gt;Documentation &amp;amp; Knowledge Transfer: Created comprehensive documentation&#xA;outlining system configurations, network setups, and maintenance processes to&#xA;ensure that procedures were clear and easily replicable in the event of&#xA;system changes or staff turnover.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Technologies Used: Linux, Postfix, Dovecot, DHCP, DNS (Bind), Samba, IPTables&lt;/p&gt;&#xA;&lt;hr/&gt;&#xA;&lt;a href=&#34;#projects&#34; aria-label=&#34;Projects&#34;&gt;&#xA;  &lt;h2 id=&#34;projects&#34;&gt;Projects&lt;/h2&gt;&#xA;&lt;/a&gt;&#xA;&lt;div id=&#34;maolan&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;maolan--real-time-audio-processing-platform-rust--2018&#34;&gt;&lt;a href=&#34;https://maolan.github.io&#34;&gt;Maolan&lt;/a&gt; – Real-Time Audio Processing Platform (Rust) | 2018&lt;/h3&gt;&#xA;&lt;p&gt;Designed and built a high-performance audio processing system focused on low-latency workloads.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Architected a modular audio processing engine in Rust with emphasis on performance and&#xA;extensibility&lt;/li&gt;&#xA;&lt;li&gt;Implemented real-time processing pipelines with strict latency constraints&lt;/li&gt;&#xA;&lt;li&gt;Optimized system behavior across Linux and FreeBSD environments&lt;/li&gt;&#xA;&lt;li&gt;Integrated multiple audio backends and drivers for stable and efficient processing&lt;/li&gt;&#xA;&lt;li&gt;Worked at OS and hardware interaction level to minimize processing overhead&lt;/li&gt;&#xA;&lt;li&gt;Distributed Communications Infrastructure&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;tilda-center&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;tilda-center--2015&#34;&gt;&lt;a href=&#34;https://tilda.center&#34;&gt;Tilda Center&lt;/a&gt; | 2015&lt;/h3&gt;&#xA;&lt;p&gt;Tilda Center is a hackerspace and educational hub focused on modern&#xA;technologies and open-source tools. I co-founded the center to bridge the gap&#xA;between affordable, high-quality education and cutting-edge technology. I am&#xA;responsible for leading technical research, teaching, and system administration.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Developed and delivered training in Python/Flask/FastAPI, React/Redux/Svelte,&#xA;HTML/CSS, electronics, and audio production.&lt;/li&gt;&#xA;&lt;li&gt;Managed IT infrastructure, including FreeBSD/Linux systems, ZFS, PF, and&#xA;automation using Ansible.&lt;/li&gt;&#xA;&lt;li&gt;Led research initiatives on FreeBSD kernel development, DSP/RT Rust/C++&#xA;environments, and audio/music systems.&lt;/li&gt;&#xA;&lt;li&gt;Designed and implemented internal systems for virtualized environments and&#xA;efficient resource management using CBSD/Reggae.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;comms&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;communications-server--2018&#34;&gt;&lt;a href=&#34;https://github.com/mekanix/comms&#34;&gt;Communications Server&lt;/a&gt; | 2018&lt;/h3&gt;&#xA;&lt;p&gt;Designed and automated deployment of production-grade communication systems.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Built distributed systems for mail, DNS, chat, and directory services&lt;/li&gt;&#xA;&lt;li&gt;Designed high-availability configurations with redundancy and failover mechanisms&lt;/li&gt;&#xA;&lt;li&gt;Automated infrastructure using Ansible and FreeBSD jails&lt;/li&gt;&#xA;&lt;li&gt;Improved reliability and operational efficiency through automation and system design&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;cbsd&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;cbsdreggaeclonos---virtualization--orchestration--2017&#34;&gt;&lt;a href=&#34;https://github.com/cbsd&#34;&gt;CBSD/Reggae/ClonOS&lt;/a&gt; - Virtualization &amp;amp; Orchestration | 2017&lt;/h3&gt;&#xA;&lt;p&gt;Worked on tooling for managing large-scale virtualized environments.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Developed orchestration tools for multi-node infrastructure&lt;/li&gt;&#xA;&lt;li&gt;Implemented parallel build and deployment systems for jails and virtual machines&lt;/li&gt;&#xA;&lt;li&gt;Optimized resource utilization and system performance in multi-tenant environments&lt;/li&gt;&#xA;&lt;li&gt;Improved scalability and operational efficiency of virtualization workflows&lt;/li&gt;&#xA;&lt;li&gt;Storage &amp;amp; System Optimization Work&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;drumgizmo&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;drumgizmo--2017&#34;&gt;&lt;a href=&#34;http://drumgizmo.org&#34;&gt;Drumgizmo&lt;/a&gt; | 2017&lt;/h3&gt;&#xA;&lt;p&gt;DrumGizmo is an open-source, multichannel drum plugin and stand-alone&#xA;application for music production.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Contributed to the FreeBSD OSS audio driver backend and ported the software&#xA;to FreeBSD.&lt;/li&gt;&#xA;&lt;li&gt;Maintained FreeBSD ports for seamless integration with the system.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div id=&#34;one-love&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;one-love--2014&#34;&gt;&lt;a href=&#34;https://github.com/one-love&#34;&gt;One Love&lt;/a&gt; | 2014&lt;/h3&gt;&#xA;&lt;p&gt;One Love is a decentralized management platform for data centers using Docker&#xA;and cloud technologies. As a full-stack developer, I’ve contributed to both&#xA;frontend and backend development.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Designed and developed the frontend using React, Redux, and Webpack to ensure&#xA;seamless user experience.&lt;/li&gt;&#xA;&lt;li&gt;Developed backend services using Flask, ZeroMQ, and REST APIs for&#xA;high-performance, scalable communication.&lt;/li&gt;&#xA;&lt;li&gt;Managed deployment pipelines on AWS, DigitalOcean, and other cloud platforms,&#xA;with a focus on automation and efficiency.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr/&gt;&#xA;&lt;a href=&#34;#education&#34; aria-label=&#34;Education&#34;&gt;&#xA;  &lt;h2 id=&#34;education&#34;&gt;Education&lt;/h2&gt;&#xA;&lt;/a&gt;&#xA;&lt;div id=&#34;university&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;master-of-science-in-business-information-technology&#34;&gt;Master of Science in Business Information Technology&lt;/h3&gt;&#xA;&lt;h4 id=&#34;faculty-of-sciences-university-of-novi-sad&#34;&gt;Faculty of Sciences, University Of Novi Sad&lt;/h4&gt;&#xA;&lt;p&gt;Studying all aspect of IT including Computer Networks, Software Engineering,&#xA;Data Structures and Algorithms, E-business and Artificial Intelligence&lt;/p&gt;&#xA;&lt;div id=&#34;high-scool&#34;&gt;&lt;/div&gt;&#xA;&lt;h3 id=&#34;electronics-technician&#34;&gt;Electronics Technician&lt;/h3&gt;&#xA;&lt;h4 id=&#34;the-electricity--electronics-middle-school-mihajlo-pupin-novi-sad&#34;&gt;The electricity &amp;amp; electronics middle school &amp;ldquo;Mihajlo Pupin&amp;rdquo; Novi Sad&lt;/h4&gt;&#xA;&lt;p&gt;Mihajlo Pupin Novi Sad Eletronics Middle School Designing and building of&#xA;electrical circuits, including simple digital boards and fixing all non-SMP low&#xA;voltage devices, scheme and PCB design, primarily for audio devices.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>All Strings Attached</title>
      <link>https://meka.rs/blog/2015/06/06/all-strings-attached/</link>
      <pubDate>Sat, 06 Jun 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/06/06/all-strings-attached/</guid>
      <description>&lt;p&gt;First of all, I&amp;rsquo;m no physicist. Everything written here is what I&amp;rsquo;ve gathered&#xA;from other sources, like books and Wikipedia. As I never had a chance to check&#xA;my thoughts with someone with proper and formal physics education, I might be&#xA;(terribly) wrong, so don&amp;rsquo;t quote me as a scientist or a proven theorist.&lt;/p&gt;&#xA;&lt;p&gt;Most of my thoughts come from Brian Greene&amp;rsquo;s&#xA;&lt;a href=&#34;http://www.briangreene.org/?page_id=24&#34;&gt;Fabric of the Cosmos&lt;/a&gt;. I like how&#xA;the book is easy to understand so much that I recommend it to everyone. I&amp;rsquo;ll&#xA;admit it, I was hardly waiting to get to the strings. Don&amp;rsquo;t get me wrong, the&#xA;whole book is golden, but I was mostly interested in strings. Just imagine&#xA;(if you can, but up to now, nobody was able to) that vibrating string manifests&#xA;itself as a particle. I mean, different vibrational patterns make up different&#xA;things in our Universe: particles, time, energy, radiation, &amp;hellip;  Once more,&#xA;strings create time. Wow! What a concept. But I want to talk about something&#xA;more scientific, if I may call it that. Throughout the research which is mostly&#xA;mathematical, scientists came to conclude that the string theory gave birth to&#xA;5 different frameworks of string theory. It&amp;rsquo;s like you say there are 5 different&#xA;variations of the same theory. A bit awkward situation for science, but the 6th&#xA;variation solved it all, or at least is trying to do that. It&amp;rsquo;s not the 6th&#xA;variation, it&amp;rsquo;s &amp;ldquo;one ring to rule them all&amp;rdquo;, to be a bit more precise. It&amp;rsquo;s&#xA;called the M-theory and nobody knows what M stands for. The craziest proposal&#xA;I&amp;rsquo;ve heard of what M is: 180 degrees of W which stands for Witten, the person&#xA;who came up with the idea of M-theory.&#xA;&lt;a href=&#34;http://en.wikipedia.org/wiki/Edward_Witten&#34;&gt;Edward Witten&lt;/a&gt; is such a crazy guy&#xA;that you have to love him. Although he&amp;rsquo;s physicist, he&amp;rsquo;s the first man who got&#xA;the Fields Medal award, which is award in math. Unbelievable guy!&lt;/p&gt;&#xA;&lt;p&gt;Anyway, back to the topic. In short, there are strings which are loops, and&#xA;strings which are like a rope with two ends. Researchers found that &amp;ldquo;rope like&amp;rdquo;&#xA;strings are attached to 2 dimensional branes. I won&amp;rsquo;t go into what branes are&#xA;for two reasons: I don&amp;rsquo;t know and it&amp;rsquo;s not that important at this time. The&#xA;funny thing is that all forces are rope alike, except gravity. Even more, all&#xA;forces except gravity are strings with two ends on the same brane. Now, this is&#xA;astonishing, at least to me. This makes gravity special, which researchers knew&#xA;before string theory, but it&amp;rsquo;s even more special now. In theory, strings are&#xA;1-dimensional objects living in a 11-dimensional environment (10 spacial and 1&#xA;time dimension). All vibrational patterns of all known forces and matter are&#xA;bound to the same brane, except gravity. This makes gravity able to traverse our&#xA;3 spacial dimensions and span on other branes. How? Gravity is made of loop&#xA;strings, hence not being tied to any brane. Isn&amp;rsquo;t that remarkable? I&amp;rsquo;m thrilled&#xA;that we can (at least in theory) communicate with other dimensions through&#xA;gravity. How? First thought is&#xA;&lt;a href=&#34;https://en.wikipedia.org/wiki/Gravitational_wave&#34;&gt;gravitational wave&lt;/a&gt;. Imagine&#xA;that you can use gravitational waves to create bits, just like computers use&#xA;electromagnetic field. I don&amp;rsquo;t even know if it&amp;rsquo;s theoretically possible, but&#xA;dreaming about other dimensions is becoming less of a dream and more of a&#xA;research. That makes me happy!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Goran Mekić</title>
      <link>https://meka.rs/pages/home/</link>
      <pubDate>Sat, 06 Jun 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/pages/home/</guid>
      <description>&lt;ul&gt;&#xA;&lt;li&gt;Co-founder of &lt;a href=&#34;http://tilda.center&#34;&gt;Tilda Center&lt;/a&gt; - Hackerspace in Novi Sad&lt;/li&gt;&#xA;&lt;li&gt;Guitar player in &lt;a href=&#34;https://lust4thrust.com&#34;&gt;Lust 4 Thrust&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Co-organizer of &lt;a href=&#34;https://pyser.org&#34;&gt;Python Serbia Conference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Co-organizer of &lt;a href=&#34;https://bsidesns.org&#34;&gt;BSidesNoviSad&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Author of &lt;a href=&#34;https://github.com/freenit-framework&#34;&gt;Freenit Framework&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Author of &lt;a href=&#34;https://github.com/maolan&#34;&gt;Maolan&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Presonus Troubles</title>
      <link>https://meka.rs/blog/2015/05/23/presonus-troubles/</link>
      <pubDate>Sat, 23 May 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/05/23/presonus-troubles/</guid>
      <description>&lt;p&gt;For some time now, I have problems with Presonus AudioBox 1818VSL. The problem&#xA;is the SPDIF input is muted. I tried this and that, I submitted an issue on&#xA;Presonus ticketing system and nothing helped. First, Presonus, you&amp;rsquo;re morons.&#xA;Every new driver needs to update firmware on the device, too, and there is no&#xA;way you can update/downgrade driver without firmware or vice versa. Second,&#xA;Presonus, you&amp;rsquo;re idiots. You&amp;rsquo;ve made USB compliant audio interface, only to&#xA;change the mode to non-complaint in the newest firmware, rendering the device&#xA;useless on GNU/Linux. Third, Presonus, you&amp;rsquo;re imbeciles. The controls you get&#xA;with &lt;code&gt;alsamixer&lt;/code&gt; is a joke. You can not mute/unmute digital inputs, for example.&#xA;This is not true, and this was my problem for months now. Once Debian is going&#xA;for reboot/shutdown, it saves the current state of audio interface to&#xA;&lt;code&gt;/var/lib/alsa/asound.state&lt;/code&gt; file. Every time Debian loads this file, digital&#xA;inputs just stop working. And they so stop working, they don&amp;rsquo;t even work on&#xA;Windows. What I had to do is uninstall driver on Windows, install new driver,&#xA;reboot, launch Presonus&amp;rsquo; mixer which says it has to update the firmware, fail,&#xA;update firmware again, uninstall driver, install old driver (version 1.1, which&#xA;has a firmware which is USB compliant) reboot, launch mixer, fail firmware&#xA;upgrade (which is actually downgrade), update firmware and than it works.&lt;/p&gt;&#xA;&lt;p&gt;At first, I said &amp;ldquo;OK, I&amp;rsquo;ll turn off Presonus before shutting down the PC&amp;rdquo;, but&#xA;that&amp;rsquo;s not good. I have to think too much for one simple shutdown. Later on, I&#xA;made &lt;code&gt;/var/lib/alsa/asound.state&lt;/code&gt; link to &lt;code&gt;/dev/null&lt;/code&gt;. That loaded garbage into&#xA;the audio interface (so, go through Windows procedure from hell once again).&#xA;Then I made &lt;code&gt;/var/lib/alsa&lt;/code&gt; link to &lt;code&gt;/dev/null&lt;/code&gt;. That solved the problem, but&#xA;I didn&amp;rsquo;t like the solution. After countless days of poking, I realized that&#xA;amixer returns interesting result for one of the controls:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;amixer -c 1 get &#39;AudioBox 1818 VSL Clock Selector Capture Sw&#39;&#xA;  Simple mixer control &#39;AudioBox 1818 VSL Clock Selector Capture Sw&#39;,0&#xA;  Capabilities: pswitch&#xA;  Playback channels: Front Left - Front Right - Rear Left - Rear Right - Front Center - Woofer - Side Left - Side Right - Rear Center - ? - ? - ? - ? - ? - ? - ?&#xA;  Mono:&#xA;  Front Left: Playback [on]&#xA;  Front Right: Playback [on]&#xA;  Rear Left: Playback [on]&#xA;  Rear Right: Playback [on]&#xA;  Front Center: Playback [on]&#xA;  Woofer: Playback [on]&#xA;  Side Left: Playback [on]&#xA;  Side Right: Playback [on]&#xA;  Rear Center: Playback [off]&#xA;  ?: Playback [off]&#xA;  ?: Playback [off]&#xA;  ?: Playback [off]&#xA;  ?: Playback [off]&#xA;  ?: Playback [off]&#xA;  ?: Playback [off]&#xA;  ?: Playback [off]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Wait a fucking minute!!! Something is off? Let&amp;rsquo;s make it on:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;amixer -c 1 set &#39;AudioBox 1818 VSL Clock Selector Capture Sw&#39; &#39;on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Guess what? Every reboot works like a charm now. I have no idea why Presonus&#xA;reports these to be off on the first run, but that&amp;rsquo;s the fix. If you have&#xA;similar problems, I hope this is the solution. Next, record album, finally!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Hell</title>
      <link>https://meka.rs/blog/2015/05/14/the-hell/</link>
      <pubDate>Thu, 14 May 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/05/14/the-hell/</guid>
      <description>&lt;p&gt;Everyone hates the hospitals, I&amp;rsquo;m sure, but recent events made me wonder if I&#xA;ever noticed how bad health care in my country is. It made me so sad to see the&#xA;great clinic of Belgrade, the clinic where all worst cases are sent to, is in&#xA;such a bad shape. Sad and eager to do something. I still don&amp;rsquo;t know what, but a&#xA;hacker in me can&amp;rsquo;t sit still. The hard part is that my beloved one is in it&#xA;right now. I can&amp;rsquo;t make up my mind if that&amp;rsquo;s a good or bad thing. We know she&#xA;needs an operation for some time now, and that clinic is the best place in the&#xA;country to do it, but I&amp;rsquo;ve seen how it looks. One of the terms that hits my&#xA;mind a lot is really not nice. It&amp;rsquo;s 4:30 in the morning, and I can&amp;rsquo;t sleep. I&#xA;will be hitting the road in today, and I can&amp;rsquo;t make myself sleep. I&amp;rsquo;ll be tired&#xA;like hell, nervous, angry and all in all fucked up. Sometimes I wish I&amp;rsquo;m blind.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Hackerspace</title>
      <link>https://meka.rs/blog/2015/04/01/hackerspace/</link>
      <pubDate>Wed, 01 Apr 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/04/01/hackerspace/</guid>
      <description>&lt;p&gt;I think it&amp;rsquo;s about 15 years now that I want a hackerspace in my town, and today&#xA;that dream become reality. The hackerspace or makerspace (I never could tell&#xA;the difference) is and will be alternate place for acquiring knowledge.&#xA;Let&amp;rsquo;s go to the beginnings and see how it all unfolded.&lt;/p&gt;&#xA;&lt;h1 id=&#34;inspiration&#34;&gt;Inspiration&lt;/h1&gt;&#xA;&lt;p&gt;I started dreaming about hackerspace more seriously about 2 years ago. What was&#xA;the real trigger is the last year&amp;rsquo;s &lt;a href=&#34;https://2k14.balccon.org&#34;&gt;BalCCon&lt;/a&gt;. One of&#xA;our guests was Mitch Altman. If you never heard of the guy, I recommend his &lt;a href=&#34;https://www.youtube.com/watch?v=WkiX7R1-kaY&#34;&gt;TED&#xA;talk in Brussels&lt;/a&gt;. The man is one&#xA;of those smiley faces that radiates out &amp;ldquo;it&amp;rsquo;s easy if you really want it&amp;rdquo;&#xA;message. One night we were sitting in the basement of the museum where the&#xA;BalCCon was held and talked about starting a hackerspace in Novi Sad. He had a&#xA;lot to say, but only one thing he said stuck in my head: &amp;ldquo;Out of 60k&#xA;hackerspaces round the globe, not single one ever failed because of lack of&#xA;funding&amp;rdquo;. It took me two weeks to process that. To be more precise, I live in a&#xA;place and time where people are happy if they have any job. Let me repeat that,&#xA;it&amp;rsquo;s important: &amp;ldquo;ANY JOB&amp;rdquo;. That&amp;rsquo;s the reason I couldn&amp;rsquo;t just accept the truth&#xA;about hackerspace funding. Once I accepted that in my mind, I was ready for the&#xA;the next step.&lt;/p&gt;&#xA;&lt;p&gt;You might think that the next step would be opening the hackerspace, but no. I&#xA;had to talk to a lot more people (on BalCCon, of course) who had experience with&#xA;this matter. I&amp;rsquo;ve heard all kinds of squat stories, funding initiatives,&#xA;creative ways of persuading landlords how to keep the rent low, and such, but&#xA;one man was really standing out: Arnd from&#xA;&lt;a href=&#34;http://techinc.nl/&#34;&gt;Technologia Incognita&lt;/a&gt; (sorry, Arnd, I don&amp;rsquo;t know your&#xA;online identity). Although Mitch is inspiring, Arnd gave me tons of stories from&#xA;his hackerspace experience that really pushed me forward. With all of these&#xA;educational stories, I&amp;rsquo;ve set my path.&lt;/p&gt;&#xA;&lt;h1 id=&#34;diy&#34;&gt;DIY&lt;/h1&gt;&#xA;&lt;p&gt;As always, we tried asking for resources from other organizations and&#xA;foundations with no luck. At one point I was pissed of by my incompetence to&#xA;start a hackerspace. All other people are able to do it, but not me. I took it&#xA;really personal, so I sit down and realized one simple fact: I have my own flat,&#xA;but if I didn&amp;rsquo;t have it, I would be forced to rent one, like most of my friends&#xA;do, and it&amp;rsquo;s the same with the hackerspace. So I decided to change the client,&#xA;and the minimal salary I would be satisfied with, and I made it. Don&amp;rsquo;t get me&#xA;wrong, there are friends of mine that give moral and financial support, I was&#xA;just sick of planing projects to fund a hackerspace (in short, begging), and I&#xA;was determined to be able to fund it on my own, if everything else fails.&lt;/p&gt;&#xA;&lt;h1 id=&#34;result&#34;&gt;Result&lt;/h1&gt;&#xA;&lt;p&gt;In short, the result is &lt;a href=&#34;http://tilda.center&#34;&gt;Tilda Center&lt;/a&gt;. I&amp;rsquo;m sitting in the&#xA;hackerspace of my town while writing this post with Internet connection provided&#xA;by the kind people of NS Wireless. We have our own 67 square meters of space to&#xA;gather, hack, talk, exchange knowledge and welcome new people. Come, visit us!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Life Together</title>
      <link>https://meka.rs/blog/2015/03/18/life-together/</link>
      <pubDate>Wed, 18 Mar 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/03/18/life-together/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m trying to keep my private life private, but this is just too weird and works&#xA;too good to hide. For few years I&amp;rsquo;m living with my girlfriend and things are&#xA;sometimes good, sometimes bad, as in any relationship (love or otherwise). To be&#xA;honest, I got sick of bad times, because in most cases the reason for the&#xA;situation to become bad is ridiculous: &amp;ldquo;you forgot to&amp;hellip;&amp;rdquo;, &amp;ldquo;you didn&amp;rsquo;t&amp;hellip;&amp;rdquo; and&#xA;so on.&lt;/p&gt;&#xA;&lt;p&gt;It&amp;rsquo;s not that I never lived with someone, it&amp;rsquo;s just that I&amp;rsquo;m the only child of&#xA;the only child, so you might think of how much work I didn&amp;rsquo;t do. I don&amp;rsquo;t know&#xA;how is it to live with someone, but I do know something else: Scrum! You might&#xA;find it weird, but it works. My girlfriend and I are having daily scrum&#xA;meetings, sync calendars and plan the day. My idea was, if I know how to lead&#xA;the project, and don&amp;rsquo;t know how to have a life with someone, then pretend it&amp;rsquo;s a&#xA;project. It can&amp;rsquo;t be worse than this. :o)&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Responsive sites</title>
      <link>https://meka.rs/blog/2015/03/10/responsive-sites/</link>
      <pubDate>Tue, 10 Mar 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/03/10/responsive-sites/</guid>
      <description>&lt;p&gt;Probably this &lt;a href=&#34;http://motherfuckingwebsite.com/&#34;&gt;mother fucking web site&lt;/a&gt; sums&#xA;it all up. With colorful vocabulary and down to earth arguments, it makes a&#xA;good point. What my experience showed me is that designers are so rarely&#xA;starting with &amp;ldquo;function first, looks second&amp;rdquo;. When I say &amp;ldquo;function&amp;rdquo; I mean make&#xA;it user friendly. I think the fancy term for it is &amp;ldquo;user experience&amp;rdquo;. Once I&#xA;stumbled upon a page explaining what user experience really is. Unfortunately,&#xA;I can not find the link to it now. One of the examples was &amp;ldquo;don&amp;rsquo;t ask for a&#xA;type of credit card&amp;rdquo;. When you read about it, Visa cards start with digit 4,&#xA;MasterCard start with 51 or 53. There were tons of suggestions like that, but&#xA;basically every site should ask for as less interaction with the user as&#xA;possible.&lt;/p&gt;&#xA;&lt;p&gt;To conclude with the quote from the mother fucking web site: &amp;ldquo;Good design is as&#xA;little design as possible&amp;rdquo;. Think about it!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Troubles with pull requests</title>
      <link>https://meka.rs/blog/2015/02/27/troubles-with-pull-requests/</link>
      <pubDate>Fri, 27 Feb 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/02/27/troubles-with-pull-requests/</guid>
      <description>&lt;p&gt;Imagine two repos with a pull request from one to another. What you&amp;rsquo;re actually&#xA;doing when accepting pull request is equivalent of &lt;code&gt;git merge&lt;/code&gt;, so your &lt;code&gt;HEAD&lt;/code&gt;&#xA;will point to the merge commit upon accepting the pull request.  Nothing new&#xA;there, right? But what if you have hundreds of commits and you find a bug?&#xA;Well, that sure thought you to merge more often, for start. If not, leave the&#xA;Internet!&lt;/p&gt;&#xA;&lt;p&gt;One thing I don&amp;rsquo;t like about merges is that &lt;code&gt;git log&lt;/code&gt; is funky. We as humans can&#xA;not think in jumps, which is the way computers and git commit parent work. We&amp;rsquo;re&#xA;stranded in &lt;code&gt;git log&lt;/code&gt;, and that&amp;rsquo;s all that our brain can really comprehend. We&#xA;have to draw the tree and curves representing merges and whatnot. Now just&#xA;imagine you have thousands of commits. To be honest, yeah, there is information&#xA;which commit is merge and which is &amp;ldquo;normal&amp;rdquo;, you can filter them out or show&#xA;only merges and filter by different criteria, but what we all really want is&#xA;&amp;ldquo;tell me what&amp;rsquo;s wrong&amp;rdquo; button/command. Listing all those thousands of commits&#xA;one after the other really doesn&amp;rsquo;t tell you much.&lt;/p&gt;&#xA;&lt;p&gt;But what if you rebase, or cherry-pick one commit at a time? Then the first&#xA;commit that breaks the code will be spotted right away. Yes, it&amp;rsquo;s more painful&#xA;because some conflicts you&amp;rsquo;re having with rebase don&amp;rsquo;t show up when doing merge.&#xA;The reason to do it is that you really don&amp;rsquo;t want to think in jumps, which merge&#xA;commits really are. Imagine continuous stream of commits (read: &lt;code&gt;git log&lt;/code&gt;) which&#xA;you don&amp;rsquo;t have to imagine in your head as trees and branches. No double parent&#xA;commits, only pure code, one commit after another. It would be much easier to&#xA;read, but to be honest, I have no idea how would someone implement it. As it is,&#xA;merge commits (which pull requests really are) are the least evil we have.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Modern WEB applications</title>
      <link>https://meka.rs/blog/2015/02/22/modern-web-applications/</link>
      <pubDate>Sun, 22 Feb 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/02/22/modern-web-applications/</guid>
      <description>&lt;p&gt;Who am I to tell you about WEB applications? Even worse, modern ones? I am&#xA;system administrator, right? Well, not exactly. The reason I never liked WEB&#xA;programming is that I could never see the point of trying to shoot HTML through&#xA;the WEB server, load balancer and browser to tons of different devices with who&#xA;knows what resolution and ratio. How can you even dream of supporting the jungle&#xA;of devices capable of running a browser? Deep down I always felt that&amp;rsquo;s wrong.&#xA;I never had an alternative, so I kept my mouth shut, but admit it, it&amp;rsquo;s a design&#xA;level flaw.&lt;/p&gt;&#xA;&lt;p&gt;That&amp;rsquo;s a few years old story of mine. Now I think different. With frameworks&#xA;like &lt;a href=&#34;https://angularjs.org/&#34;&gt;AngularJS&lt;/a&gt; and &lt;a href=&#34;http://canjs.com/&#34;&gt;CanJS&lt;/a&gt;, to name&#xA;the few, it all changed. First, frontend is finally in the front. I mean, what&#xA;frontend is capable of doing now is calculate the height and width of the&#xA;elements based on resolution, because the code is running where it&amp;rsquo;s most&#xA;suitable for this kind of calculations: the browser. Yes, I know you could alter&#xA;the page with javascript before single page application frameworks saw the light&#xA;of the day, but it was hackish and ugly.&lt;/p&gt;&#xA;&lt;p&gt;One more thing changed. Backend became &amp;ldquo;only&amp;rdquo; the REST API, or the fancy word&#xA;&amp;ldquo;DB with some minimal code&amp;rdquo;. If your application is only changing the models in&#xA;the backend, you might look at the whole backend as the DB with the REST&#xA;interface. That means no more DB procedures, you&amp;rsquo;ve got a proper scripting&#xA;language at your disposal with multiple supported DB types, portable code and&#xA;properly decoupled code and the DB. Single page application frameworks didn&amp;rsquo;t&#xA;bring this to the table, but modern WEB app design and REST did.&lt;/p&gt;&#xA;&lt;p&gt;While we&amp;rsquo;re at it, REST brought some optimization, too. Well, JSON did it, but&#xA;it&amp;rsquo;s almost the same thing, as almost all REST implementations use JSON as a&#xA;format. As only data that is really necessary to fill the template is&#xA;transmitted.&lt;/p&gt;&#xA;&lt;p&gt;One thing I always hated about WEB applications is authentication. Session?&#xA;Cookie? That&amp;rsquo;s just plain and simple wrong. In the age when every application is&#xA;behind a load balancer, how do you balance authentication? One solution is&#xA;saving the session in the DB. Just think about it for a second. You&amp;rsquo;ll be saving&#xA;a temporary information in a DB, which saves the data forever. The modern way of&#xA;dealing with this is forgetting the session and the cookies, and using&#xA;&lt;a href=&#34;http://openid.net/specs/draft-jones-json-web-token-07.html&#34;&gt;JSON WEB Tokens&lt;/a&gt;,&#xA;or JWT for short. Simplified, you obtain the token by POSTing to a&#xA;authentication endpoint, that token is transfered in a HTTP header on every&#xA;request, thus allowing the backend to know who you are. The token itself is just&#xA;a very long string. It does have the structure and rules how to generate one,&#xA;but I&amp;rsquo;m not going into that now, as it&amp;rsquo;s too much detail for this post. If all&#xA;your backend servers generate and use the token in the same way, there&amp;rsquo;s no&#xA;difference which server actually generated the token, which enables you to have&#xA;proper load balancing.&lt;/p&gt;&#xA;&lt;p&gt;This is just my point of view. It will evolve over time, I&amp;rsquo;m sure. You may find&#xA;I made mistakes in my judgment. I&amp;rsquo;ll admit it right away, I&amp;rsquo;m not experienced&#xA;in this field as much as I&amp;rsquo;d like, but I still do know the principles.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>CCC Summary</title>
      <link>https://meka.rs/blog/2015/01/01/ccc-summary/</link>
      <pubDate>Thu, 01 Jan 2015 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2015/01/01/ccc-summary/</guid>
      <description>&lt;p&gt;To be honest, this CCC was mental healing for me. I went on a trip with a lot&#xA;on my mind and I just couldn&amp;rsquo;t relax. I didn&amp;rsquo;t relax until the last day of the&#xA;congress. Why? For 8.5 years of my professional carrier as a system&#xA;administrator, I&amp;rsquo;ve never heard &amp;ldquo;good job, man&amp;rdquo; in as many words as &amp;ldquo;what did&#xA;you fuck up?&amp;rdquo; kind of critics, so it finally got to me. On the other hand, CCC&#xA;is all about sharing knowledge and telling interesting stories to other people.&#xA;It relaxed me because I realized that, although I&amp;rsquo;m totally weird for people in&#xA;my country, I&amp;rsquo;m nothing strange on the conference. I was accepted. FINALLY!!!&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s start from the beginning. My fiancé was so excited about CCC. I still&#xA;can&amp;rsquo;t understand her, as she&amp;rsquo;s something like a child psychologist. There are&#xA;topics covering e-learning and stuff like that, but she understands hacking,&#xA;programming, administration, security, privacy, etc. So, for the first time in&#xA;my life I&amp;rsquo;m with the girl I don&amp;rsquo;t have to explain what my job and hobbies are&#xA;all about. What a relief! Second, she booked us tickets for hacker tour of&#xA;&lt;a href=&#34;http://desy.de&#34;&gt;DESY&lt;/a&gt;, particle accelerator. What? My girlfriend not only&#xA;understands me, she&amp;rsquo;s pushing me in the right direction? I must be dreaming.&#xA;Let me repeat. My fiancé was excited about seeing particle accelerator more&#xA;then buying new camera (she&amp;rsquo;s also amateur photographer). How cool is that?&lt;/p&gt;&#xA;&lt;p&gt;OK, we&amp;rsquo;re at the airport. As I&amp;rsquo;ve never flew in an airplane before, I had no&#xA;idea what to expect. It was fun, of course. Seeing the clouds from above,&#xA;seeing the Sun, as it&amp;rsquo;s winter and it&amp;rsquo;s cloudy every day. The G force when&#xA;taking off was something I should have anticipated, but I was so surprised. And&#xA;most of all, the size of Munich and Hamburg airports was astonishing. Let me&#xA;explain. I was born and I still live in a town of 300k people. We don&amp;rsquo;t even&#xA;have an airport, so seeing something that huge was great. Oh, and seeing that&#xA;even Germans get some things too late was so precious to me.&lt;/p&gt;&#xA;&lt;p&gt;We&amp;rsquo;re in Hamburg. As my fiancé and I can&amp;rsquo;t speak German, it&amp;rsquo;s fun. It&amp;rsquo;s so well&#xA;organized that we can not comprehend it. It took me 4 days to figure out how to&#xA;properly read S bahn maps. Germans are looking at us like Martians when we ask&#xA;something like &amp;ldquo;in which direction is Dammtor station?&amp;rdquo;, because it&amp;rsquo;s so&#xA;obvious to them. Let me tell you, I don&amp;rsquo;t mind. I come from a different&#xA;culture, if you can call it a culture at all, and having diversity in almost&#xA;everything is something I find useful. Of course, you feel like a jerk at&#xA;first, but it&amp;rsquo;s an adventure.&lt;/p&gt;&#xA;&lt;p&gt;We&amp;rsquo;re at the Congress Centrum Hamburg, finally. It&amp;rsquo;s so huge I didn&amp;rsquo;t get to&#xA;know my way around it in 4 days. I still couldn&amp;rsquo;t find my way around, and we&#xA;heard from an older W Holand member that they maybe return CCC to Berlin, but&#xA;to a proper congress center big enough for 50k people. I was like &amp;ldquo;What? That&amp;rsquo;s&#xA;1/6 of the population of my town! Do you rent a bike to go around it?&amp;rdquo;. Anyway,&#xA;they have few solutions in mind when CCH becomes too crowded (it&amp;rsquo;s already a&#xA;bit crowded). You can download all lectures from &lt;a href=&#34;https://ftp.ccc.de/congress/31C3/&#34;&gt;CCC&#xA;FTP&lt;/a&gt;. To be honest, I can point at only&#xA;one lecturer, a friend of ours from Varaždin, Croatia:&#xA;&lt;a href=&#34;https://ftp.ccc.de/congress/31C3/h264-hd/31c3-5966-en-de-UNHash_-_Methods_for_better_password_cracking_hd.mp4&#34;&gt;UNHash - Methods for better password&#xA;cracking&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;After congress, we had new year eve celebration at our friends house from&#xA;Hamburg who speaks really good Serbian, so we finally could forget English. He&#xA;was super nice and prepared beer and dinner I will never forget. Even if it was&#xA;the worst night ever I would still have to say it was the best ever, because of&#xA;his kick boxing black belt. No kidding with this guy. :o)&lt;/p&gt;&#xA;&lt;p&gt;For the end, I have few things anyone traveling to Germany and not knowing&#xA;German language should know. First, Turkish food is THE BEST! Sorry folks from&#xA;other countries, but Turks prepare insanely large and delicious dishes. You&#xA;can&amp;rsquo;t compete with that. Second is, if you want to ask a random dude on the&#xA;street for directions or help in English, ask the black guy, as Germans and&#xA;English are not really tight. It&amp;rsquo;s not about racism, it&amp;rsquo;s just that there&amp;rsquo;s a&#xA;huge chance that black guy is actually from USA and can understand you. Of&#xA;course, we decided to take German classes once we get home. Ideally, knowing&#xA;English, German, Spanish and Chinese, you&amp;rsquo;re prepared for the world. We&amp;rsquo;ll see&#xA;how good we&amp;rsquo;ll become at learning new languages, but hey, I learn new&#xA;programming languages once a year. What&amp;rsquo;s a new spoken language compared to&#xA;that. :o) We&amp;rsquo;re preparing for the flight home, as tomorrow morning we&amp;rsquo;re&#xA;departing. It was nice, useful, helpful and fun. Thank you for all the fish!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>CCC</title>
      <link>https://meka.rs/blog/2014/12/29/ccc/</link>
      <pubDate>Mon, 29 Dec 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/12/29/ccc/</guid>
      <description>&lt;p&gt;Of course, I&amp;rsquo;m talking about &lt;a href=&#34;http://ccc.de&#34;&gt;CCC&lt;/a&gt;. As there&amp;rsquo;s a lot of talk&#xA;about hacking this and that on a technical level, I will try to avoid that.&lt;/p&gt;&#xA;&lt;p&gt;It&amp;rsquo;s the third day of the congress, and, as expected, I&amp;rsquo;ve seen all kinds of&#xA;crazy lectures. The variety of topics is astonishing. For example, I&amp;rsquo;m&#xA;currently sitting next to the ring making workshop with people hammering metal&#xA;for hours. We&amp;rsquo;ve seen food hacking base, where you can learn how to cook like a&#xA;hacker: using arduino to control temperature of kefir and such. You can see&#xA;lectures like &amp;ldquo;copy wrong&amp;rdquo; dealing with weirdness of copyright laws and&#xA;licensing (hint: you can take panorama pictures of Eiffel tower by day, but not&#xA;by night because lights on it are made by architect that is not &amp;ldquo;dead + 100&#xA;years&amp;rdquo;). You can also leave your kid in the area with rubber balls and toys, so&#xA;parents can watch their favorite lecturer. You can learn how to solder and work&#xA;with arduino for TV B Gone. You can hear what&amp;rsquo;s the real problem with quantum&#xA;computers where camera man asked some really technical questions, and the girl&#xA;from the crowd knows so much more then I do! Don&amp;rsquo;t get me wrong, I don&amp;rsquo;t think&#xA;it&amp;rsquo;s bad that girls know such things, but with my background of growing up in&#xA;and old fashioned society, that&amp;rsquo;s weird, and I like it! And my favorite,&#xA;creating your own audio devices and programming firmware and software for it&#xA;(hint: software like &lt;a href=&#34;http://puredata.info/&#34;&gt;pure data&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;Let me also tell you that all the people are super nice. Everybody is&#xA;collecting trash, either someone else&amp;rsquo;s or their own. Everybody is environment&#xA;friendly, helping the neighbor or spreading awareness of all kinds of crazy&#xA;cultural topics (hint: there&amp;rsquo;s a &amp;ldquo;medical advice: please wash your hands!&amp;rdquo;).&#xA;For the end, do I need to tell you I didn&amp;rsquo;t expect this?&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Presonus Audiobox 1818VLS 2</title>
      <link>https://meka.rs/blog/2014/12/15/presonus-audiobox-1818vls-2/</link>
      <pubDate>Mon, 15 Dec 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/12/15/presonus-audiobox-1818vls-2/</guid>
      <description>&lt;p&gt;And it finally arrived. First, right channel on the headphones didn&amp;rsquo;t work. I&#xA;made a peace with myself that I have to spend some more money for sending it to&#xA;Thomman to replace it with a working one. I tried everything that came to my&#xA;head and couldn&amp;rsquo;t figure out what&amp;rsquo;s wrong. As my friend brought it for me, we&#xA;were not at my home, so on the way home I figured out that I didn&amp;rsquo;t check the&#xA;pan. While unpacking it, there was a trillion of &amp;ldquo;please be the pan&amp;rdquo; prayers.&#xA;I&amp;rsquo;ve connected it, fired it up, and everything was just working. I still have&#xA;no idea how or why. And now for the technical details.&lt;/p&gt;&#xA;&lt;p&gt;The reason I wanted this card is because it&amp;rsquo;s the only USB 2.0 audio interface&#xA;that is seamlessly supported under GNU/Linux that I know of. You just plug it&#xA;in, start JACK, and you have 18 inputs and 18 outputs. Just so you know, 1+2&#xA;outputs are the main, 7+8 are headphones and 9+10 are S/PDIF. As for inputs,&#xA;9+10 are S/PDIF and the rest is as it&amp;rsquo;s numerated. My setup is that in first&#xA;input I have my guitar (1st and 2nd are mic/instrument combo, others are&#xA;mic/line). The guitar is always routed to S/PDIF output, and that output goes&#xA;to my guitar processor&amp;rsquo;s (Line 6 POD X3 Pro) input. S/PDIF output of POD is&#xA;returned into S/PDIF input on the card. This setup enables me to record dry and&#xA;wet guitar at the same time, as POD always gets it&amp;rsquo;s input from Presonus, I&#xA;never have to change inputs or outputs with it, and I can reamp dry tracks. One&#xA;of the problems I had with a previous setup was that audio card didn&amp;rsquo;t have&#xA;guitar input, so I had to use POD for everything. This means, that while&#xA;recording dry guitar, I would listen to analog output of POD with full&#xA;simulation of amp for monitoring, and send dry signal through S/PDIF. Once I&#xA;record it, I had to switch input to S/PDIF, which is the last item on the menu&#xA;where you choose your input. Guess what&amp;rsquo;s the first option: guitar input, of&#xA;course. So I spent a lot of time going back and forth through the menu which&#xA;doesn&amp;rsquo;t go to first item once you&amp;rsquo;ve passed the last one. What a hassle! And&#xA;that&amp;rsquo;s not enough. Because previous card, M-Audio Delta 1010LT can not be&#xA;worldclock master, I had to switch the master every time I wanted to switch to&#xA;&amp;ldquo;studio mode&amp;rdquo; or back to normal mode. Switching to studio means POD is the&#xA;master, I switch to S/PDIF sync on Delta and everything works. The trouble is&#xA;going back, because you can&amp;rsquo;t just switch the sync source. You have to stop&#xA;JACK, switch the sync source, start JACK and start all programs that don&amp;rsquo;t&#xA;handle JACK stopping well. If I just power off POD while it&amp;rsquo;s sync master,&#xA;Delta just dies. One reboot later you&amp;rsquo;re good to go. That was a pain! Now I can&#xA;even bring my studio anywhere and record. That means that I can finally have&#xA;the same setup and latency no matter where I record (we used my guitar player&amp;rsquo;s&#xA;laptop and audio interface for vocals).&lt;/p&gt;&#xA;&lt;p&gt;Now for some fine tuning. First, every USB interface should have 3 as number of&#xA;periods, compared to all other interfaces which have 2. You really want&#xA;linux-image-lowlatency. My stable setup with a xrun now and then dropped from&#xA;10.5ms to 2.7ms. On 10.5ms you can notice the latency if you play something&#xA;fast, and we do. Of course, I use maximum sampling frequency of 96k. I&#xA;recommend using KXStudio repository, Cadence for JACK management, Ardour3 for&#xA;recording and SoundCloud for sharing tunes. Hear ya soon!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Life is a Dream</title>
      <link>https://meka.rs/blog/2014/12/09/life-is-a-dream/</link>
      <pubDate>Tue, 09 Dec 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/12/09/life-is-a-dream/</guid>
      <description>&lt;p&gt;Ever heard of it? Life is a dream? Did you ever think about it? I did. A lot!&#xA;And I can tell you it is. Just look at what we do, create, transform and&#xA;whatnot. Just by wishing something it comes true. Just by work you get results.&#xA;When you think about it, you could do everything differently in your life. You&#xA;could shape yourself, your life, your surrounding. Any of us could. I mean,&#xA;even quantum physics says that anything is possible. What do we do with that?&#xA;Dress up and go to boring work. Are we insane? Are we media oriented? Are we&#xA;blind? In a word, fuck you, life. I publicly express my regret for existing in&#xA;this world. I regret I&amp;rsquo;m incompetent to change the world (not really, but it&#xA;involves starting from scratch). I&amp;rsquo;m sorry, but the mediocrity of the world got&#xA;to me. Where do I sign up for a &lt;a href=&#34;http://www.mars-one.com&#34;&gt;mission to Mars&lt;/a&gt; or&#xA;exploration of black holes?&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Presonus Audiobox 1818VLS</title>
      <link>https://meka.rs/blog/2014/12/07/presonus-audiobox-1818vls/</link>
      <pubDate>Sun, 07 Dec 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/12/07/presonus-audiobox-1818vls/</guid>
      <description>&lt;p&gt;For years I have &lt;a href=&#34;http://www.m-audio.com/products/view/delta-1010lt#.VIS-oN_0_RY&#34;&gt;M-Audio Delta&#xA;1010LT&lt;/a&gt;. It&amp;rsquo;s&#xA;great, but it lacks some things I need now. One of the things is being&#xA;worldclock master. Second is Hi-Z input. All of that is covered with &lt;a href=&#34;http://www.presonus.com/products/AudioBox-1818VSL&#34;&gt;Presonus&#xA;Audiobox 1818VLS&lt;/a&gt;. As a&#xA;consequence, I can use my &lt;a href=&#34;http://line6.com/legacy/podx3pro&#34;&gt;Line 6 POD X3 Pro&lt;/a&gt;&#xA;without switching who&amp;rsquo;s the master on a card (it kills all audio programs, too)&#xA;and without ever changing the routing or setup. What it basically means is that&#xA;POD can run in stereo mode in which it expects two guitars on the inputs, and&#xA;each guitar has only one channel (left or right). The reason I want this is so&#xA;I can route from &lt;a href=&#34;https://ardour.org/&#34;&gt;Ardour&amp;rsquo;s&lt;/a&gt; outputs of clean guitars to&#xA;POD when doing playback, and route one Audiobox&amp;rsquo;s input to two inputs of POD,&#xA;emulating two guitars. Why am I telling you this? I&amp;rsquo;ve ordered Presonus, and I&#xA;can&amp;rsquo;t wait to hear how it works with my Ubuntu. It&amp;rsquo;s almost Christmas :o) Once&#xA;it&amp;rsquo;s in my posession, I&amp;rsquo;ll tell you all about routing audio signals via&#xA;&lt;a href=&#34;http://jackaudio.org/&#34;&gt;JACK&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>PCEngines APU</title>
      <link>https://meka.rs/blog/2014/12/02/pcengines-apu/</link>
      <pubDate>Tue, 02 Dec 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/12/02/pcengines-apu/</guid>
      <description>&lt;p&gt;I had TP-Link provided by ISP for years, and I never bothered to replace it. It&#xA;does work, but sometimes it&amp;rsquo;s just a pain in the ass. For example, the closer&#xA;my laptop is to the router, more packet drops I have. I finally decided to grab&#xA;a new router, and, of course, I got an &amp;ldquo;underground one&amp;rdquo;. I mean, who ever&#xA;heard of PCEngines? Their model APU has variant with 4GB of RAM. Impressive,&#xA;right? :o) There is no particular reason I decided for 4GB. It was there and I&#xA;didn&amp;rsquo;t want to think what I can and can&amp;rsquo;t do. It&amp;rsquo;s loaded with 16GB SSD hard&#xA;drive and Atheros WiFi card with 2 antennas. It has 3 gigabit ports and serial&#xA;console. ALIX, former model had VGA, also, which made things much easier,&#xA;because finding null terminated USB to RS232 cable is near to impossible (thank&#xA;you &lt;a href=&#34;http://www.ktehnika.co.rs/&#34;&gt;KT&lt;/a&gt;). So, I grabbed pfSense USB image with&#xA;serial console, dd&amp;rsquo;ed it to USB stick and install is pretty straight forward.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s take a step back. You get all the pieces and it&amp;rsquo;s not tricky to assemble&#xA;it if you follow &lt;a href=&#34;http://www.pcengines.ch/apucool.htm&#34;&gt;instructions&lt;/a&gt;. Trust me,&#xA;it&amp;rsquo;s not hard even the first time (I&amp;rsquo;ve never had anything similar before). For&#xA;pfSense installation, follow [Gooze&#xA;instructions](&lt;a href=&#34;http://www.gooze.eu/howto/pfsense-installation-on-alix-apu-board-h&#34;&gt;http://www.gooze.eu/howto/pfsense-installation-on-alix-apu-board-h&lt;/a&gt;&#xA;owto) and you&amp;rsquo;re set. Next few tips are just to get you there easier.&lt;/p&gt;&#xA;&lt;p&gt;First, APU&amp;rsquo;s serial port is on baud of 115200, and pfSense installation is on&#xA;baud of 9600, so you boot on one baud, configure device, switch to lower baud,&#xA;do the installation of pfSense and switch back to higher baud. Once you install&#xA;the device, you don&amp;rsquo;t have to change baud ever again. Second &amp;ldquo;trick&amp;rdquo; is that in&#xA;order to use WiFi card as AP, you have to assign ath0 interface as optional&#xA;interface, then rename OPT1 to WIFI in order to find it easier in the future,&#xA;and configure the same filter rules like those for LAN. That should be enough&#xA;for you to start using WIFI. On software side, you only need minicom configured&#xA;with /dev/ttyUSB0 on your laptop, and pfSense installation. Hardware: USB&#xA;stick, APU, USB to RS232 converter and F2F (meaning &amp;ldquo;female to female&amp;rdquo;) serial&#xA;cable. Have fun! :o)&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Freelancing and USA company</title>
      <link>https://meka.rs/blog/2014/11/27/freelancing-and-usa-company/</link>
      <pubDate>Thu, 27 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/27/freelancing-and-usa-company/</guid>
      <description>&lt;p&gt;Sorry, folks, but I&amp;rsquo;ve got nothing nice for this post. Last night I got an&#xA;email that made me laugh and angry, at the same time. I tried to negotiate some&#xA;freelance job, and after a week of talk I get &amp;ldquo;send me a Word copy of your&#xA;resume and a copy of your drivers license or passport&amp;rdquo;. Right. Word? For Linux&#xA;administrator? First big fail by the company. OK, I copy/paste my&#xA;&lt;a href=&#34;https://meka.rs/resume&#34;&gt;resume&lt;/a&gt; into LibreOffice, do some minor editing and send it with &amp;ldquo;My&#xA;Word copy of a resume is attached &amp;hellip; I can&amp;rsquo;t send one (copy of a passport,&#xA;that is) to random people on the Internet just because they ask me to. Sorry&amp;rdquo;.&#xA;Am I being I jerk? I don&amp;rsquo;t think so. Think about it. You can reset almost&#xA;anything with a copy of a passport and email address. Almost anything, for&#xA;example, was my password for a credit card site. I might be crazy, but I&amp;rsquo;m not&#xA;dumb. What&amp;rsquo;s their excuse? &amp;ldquo;We&amp;rsquo;re going to give you root login, and we&amp;rsquo;re&#xA;serious US company&amp;rdquo; (in much more words, so I&amp;rsquo;m paraphrasing). So that should&#xA;give you credibility to ask people for passport? Right! Naturally, they&#xA;canceled the job. To be honest, they just got to a job post first, otherwise I&#xA;would do it.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s go back a little. Let&amp;rsquo;s say I want to hire you and I say &amp;ldquo;I&amp;rsquo;m a&#xA;representative of a US company&amp;rdquo;. Would you give me your passport? How do you&#xA;know I do have a company? Internet site? Or I&amp;rsquo;m really registered. It&amp;rsquo;s easy to&#xA;do that even in my shit hole of a country where you usually need tons of&#xA;papers, but not for a company, they want to get your tax money as soon as&#xA;possible. Just think what all you can do with someone&amp;rsquo;s ID or passport. Now add&#xA;to that the fact that I&amp;rsquo;m a hacker, meaning I spend my time thinking about&#xA;intrusion, malware, viruses, social engineering and who knows what else. Why?&#xA;Because I&amp;rsquo;m usually hired to think about that and come up with a protection. In&#xA;a word, I&amp;rsquo;m dealing with all kinds of lies and deceiving people, but all of a&#xA;sudden, if you happen to have a USA company, I should trust you? I mean, why&#xA;even emphasize your in the USA? World terrorist number one country in the world&#xA;should give me some fuzzy feeling and I fall into hypnotic state and trust you&#xA;completely? Get the fuck out!&lt;/p&gt;&#xA;&lt;p&gt;And let me tell you, I did think this through. I didn&amp;rsquo;t want to say who they&#xA;are, but fuck you retards from [Epic Farts](http =//epicforce.net/). If you mark&#xA;me as &amp;ldquo;not smart enough&amp;rdquo; when declining my application, I can be jerk, too, you&#xA;dumb ass.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cloud Computing Basics 7</title>
      <link>https://meka.rs/blog/2014/11/21/cloud-computing-basics-7/</link>
      <pubDate>Fri, 21 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/21/cloud-computing-basics-7/</guid>
      <description>&lt;p&gt;There&amp;rsquo;s been so much talk about Consul-template and I&amp;rsquo;ve never shown you any&#xA;examples. Consul-template is what gives Docker container the knowledge when&#xA;something is changed in Consul. It does it by having a template for&#xA;configuration file filled with Consul data and command to run when template is&#xA;generated. Let&amp;rsquo;s take a look at my Dockerfile for NginX:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FROM nginx:latest&#xA;MAINTAINER Goran Mekić &amp;lt;meka@lugons.org&amp;gt;&#xA;&#xA;ENV DEBIAN_FRONTEND noninteractive&#xA;ADD consul /app/consul&#xA;ADD consul-template /usr/bin/consul-template&#xA;ADD run.sh /run.sh&#xA;&#xA;CMD /run.sh&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It&amp;rsquo;s a bit dirty as I get consul-template out of the sky, but kids, don&amp;rsquo;t be&#xA;like me. :o) Yeah, always works!&lt;/p&gt;&#xA;&lt;p&gt;I have my run.sh:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#!/bin/bash&#xA;&#xA;set -e&#xA;&#xA;rm /etc/nginx/conf.d/*&#xA;consul-template -config /app/consul/nginx.conf&#xA;sleep 1&#xA;tail -f /var/log/nginx.log&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Great. So Consul-template does all the work. Let&amp;rsquo;s see the config.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;consul = &amp;quot;172.17.42.1:8500&amp;quot;&#xA;&#xA;template {&#xA;    source = &amp;quot;/app/consul/nginx.tmpl&amp;quot;&#xA;    destination = &amp;quot;/etc/nginx/conf.d/onelove.conf&amp;quot;&#xA;    command = &amp;quot;service nginx restart&amp;quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Remember I&amp;rsquo;ve told you that Consul is available on 172.17.42.1 on all hosts?&#xA;This is where it comes handy. It is achieved through docker0 interface. Ensure&#xA;you have the same IP on all hosts and that Consul is bind to it, and that&amp;rsquo;s it.&lt;/p&gt;&#xA;&lt;p&gt;Second part is the template. What, where and how are the questions it answers.&#xA;What source template I should use? Where to put the output? How to notify the&#xA;service. Yeah, I&amp;rsquo;m aggressive, I restart instead of reload because of simplicity.&#xA;The problem I had was with the run.sh. If you look closely, only thing I really&#xA;call is &lt;code&gt;consul-template&lt;/code&gt;. I never start nginx by hand or automatically inside&#xA;the container, so if I have used &lt;code&gt;reload&lt;/code&gt;, there would be nothing to reload&#xA;initially (read: container doesn&amp;rsquo;t boot).&lt;/p&gt;&#xA;&lt;p&gt;There are two thing you can do to ensure that your load balancers don&amp;rsquo;t reboot&#xA;all at the same time. First one is to explore&#xA;(wait parameter)[https://github.com/hashicorp/consul-template#usage] and restart&#xA;with random delay. Second one is to initialize the config, start services, and&#xA;watch for changes. When there is a change, reinitialize config and reload&#xA;service. Example of it is&#xA;&lt;a href=&#34;https://github.com/one-love/api/blob/master/bin/run.sh&#34;&gt;One Love API&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#!/bin/bash&#xA;&#xA;set -e&#xA;&#xA;export COMMAND=&amp;quot;consul-template -config /app/consul/api.conf&amp;quot;&#xA;&#xA;echo -n &amp;quot;Waiting for initial config &amp;quot;&#xA;until $COMMAND -once; do&#xA;    echo -n &amp;quot;.&amp;quot;&#xA;    sleep 3&#xA;done&#xA;echo &amp;quot; done&amp;quot;&#xA;&#xA;uwsgi --ini /app/uwsgi.ini&#xA;python /app/manage.py migrate --noinput&#xA;python /app/manage.py collectstatic --noinput&#xA;&#xA;$COMMAND &amp;amp;&#xA;sleep 1&#xA;tail -f /var/log/uwsgi.log&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you know everything I know about the cloud computing. This is my way of&#xA;doing things, and my view. You don&amp;rsquo;t have to agree on everything. I&amp;rsquo;m not going&#xA;to agree with these posts in a year! What I didn&amp;rsquo;t describe is Docker HUB, but&#xA;go to site, register, and add your repository. Play with it, it&amp;rsquo;s dead simple. I&#xA;gave my best to give you posts that have no bull shit talk, because I was mad on&#xA;todays media representing the cloud. I hope I did it. Happy dockering!&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2014/11/20/cloud-computing-basics-6/&#34;&gt;previous&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Real Time Feedback</title>
      <link>https://meka.rs/blog/2014/11/21/real-time-feedback/</link>
      <pubDate>Fri, 21 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/21/real-time-feedback/</guid>
      <description>&lt;p&gt;As I&amp;rsquo;m learning about WEB development, I&amp;rsquo;m learning how not to do it. Anyone can&#xA;do it, but only few can find so many solutions that are bad and know why they&#xA;are bad. That means that those few will nag big time about most of the solutions,&#xA;but once they shut up, you know you&amp;rsquo;re doing it right. I&amp;rsquo;m lazy. I know it&amp;rsquo;s my&#xA;strength and my weakness. That&amp;rsquo;s the reason I tend to automate everything. The&#xA;trouble is that I also tend to optimize a lot. I hate inefficient procedures.&#xA;That&amp;rsquo;s my reason for two monitors. Think about it. I&amp;rsquo;m writing every post in&#xA;&lt;a href=&#34;http://www.vim.org/&#34;&gt;vim&lt;/a&gt;. That means I have no idea how my post will look like.&#xA;But if you take a look at&#xA;&lt;a href=&#34;https://github.com/mekanix/meka.rs/tree/master/_posts&#34;&gt;the code&lt;/a&gt;, you&amp;rsquo;ll notice&#xA;it is folded on 80th character. We&amp;rsquo;re all crazy in our own way, I just accepted&#xA;my weirdness. :o)&lt;/p&gt;&#xA;&lt;p&gt;OK, now the important stuff. When you write in vim, you realize you can execute&#xA;a script on every save. What if you&amp;rsquo;re editing a post, the script you&amp;rsquo;re&#xA;running remembers the window which has the focus, focuses chromium window, sends&#xA;it &amp;ldquo;CTRL+r&amp;rdquo;, and returns back? Basically, you&amp;rsquo;ll have your post rendered every&#xA;time you change the post. And what if you have two monitors? You could see the&#xA;change almost while you&amp;rsquo;re typing. That&amp;rsquo;s pretty close to real time feedback.&#xA;And if you have real time feedback, you can see what you&amp;rsquo;re doing, which is&#xA;great. Now tell me, isn&amp;rsquo;t this the best reason you&amp;rsquo;ve ever heard for a monitor&#xA;purchase? :o)&lt;/p&gt;&#xA;&lt;p&gt;All you need is vim config like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;au BufWritePost * silent !/home/meka/bin/vim-reload-chromium.sh&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the script&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#!/bin/bash&#xA;&#xA;exec 1&amp;gt;/dev/null&#xA;exec 2&amp;gt;/dev/null&#xA;&#xA;ACTIVE_WINDOW=$(xdotool getactivewindow)&#xA;CHROMIUM_WINDOW=$(xdotool search --name &#39;^.* - Chromium$&#39;)&#xA;&#xA;sleep 2&#xA;xdotool windowactivate ${CHROMIUM_WINDOW}&#xA;xdotool key &amp;quot;CTRL+r&amp;quot;&#xA;xdotool windowactivate ${ACTIVE_WINDOW}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now go, prepare for Christmas! :o)&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cloud Computing Basics 6</title>
      <link>https://meka.rs/blog/2014/11/20/cloud-computing-basics-6/</link>
      <pubDate>Thu, 20 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/20/cloud-computing-basics-6/</guid>
      <description>&lt;p&gt;Docker here, Docker there, and no Docker build anywhere. That&amp;rsquo;s not fair. How&#xA;about we create the first docker? Docker image is built from &lt;code&gt;Dockerfile&lt;/code&gt;.&#xA;The syntax of &lt;code&gt;Dockerfile&lt;/code&gt; is almost the same as &lt;code&gt;Bash&lt;/code&gt;. This is an example of&#xA;Dockerfile:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FROM debian:jessie&#xA;MAINTAINER Goran Mekić &amp;lt;meka@lugons.org&amp;gt;&#xA;RUN touch /some-file.txt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To build it run &lt;code&gt;docker build -t username/repo .&lt;/code&gt; in a directory containing&#xA;Dockerfile. It&amp;rsquo;s advisable to have a &lt;a href=&#34;https://registry.hub.docker.com/&#34;&gt;HUB&lt;/a&gt;&#xA;username, as registration is free and has autobuild capabilities. We&amp;rsquo;ll deal&#xA;with simple builds for now, and leave autobuild for some future post.&lt;/p&gt;&#xA;&lt;p&gt;To upload your image issue this command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;docker push username/repo&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Docker will ask you for username/password/email combination. Fill it up, wait&#xA;for upload to finish and that&amp;rsquo;s it. You have your first Docker image. Let&amp;rsquo;s give&#xA;it a spin.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;docker run --rm -i -t username/repo /bin/bash&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What it does is (simplified):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;--rm&lt;/code&gt;: remove container when it stops&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;-i&lt;/code&gt;: this will be interactive container (read: someone will type commands in it)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;-t&lt;/code&gt;: give me a terminal emulation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Note that every command in Dockerfile will create additional layer. It means&#xA;that Docker images are organized as multiple file system layers which have&#xA;dependencies. Much like a git repo branch is pointer to commit which has its&#xA;own dependencies, Docker image remembers which file system layer is on top. As&#xA;every layer remembers which layer it depends on, you can have dependency line.&#xA;In the example above, there will be at least 3 layers: FROM, MAINTAINER and RUN&#xA;lines make them. This has consequences you have to be aware of. First, if the&#xA;line in Dockerfile and dependent layers didn&amp;rsquo;t change from last build, Docker&#xA;will use last build&amp;rsquo;s layer, not build it (read: cache). Second, EVERY line in&#xA;Dockerfile creates layer. So, if you create 1GB file on one line, delete it on&#xA;the other, you&amp;rsquo;ll have a small layer (from deleting 1GB) dependent on a big&#xA;layer (where you created 1GB), although lower layer is unusable, because upper&#xA;layer effectively masked it.&lt;/p&gt;&#xA;&lt;p&gt;The &amp;ldquo;trick&amp;rdquo; I use is to have a build script which will cause 2 lines in&#xA;Dockerfile: one for ADD and one for RUN. I start with debian:jessie, add all&#xA;build tools, build my app, remove build tools and do the cleanup. The build&#xA;does last much longer, but you end up with MUCH smaller images. I managed to&#xA;shrink &lt;a href=&#34;https://github.com/one-love/api&#34;&gt;One Love API&lt;/a&gt; image from 1GB to 298MB just using this. What I think would be&#xA;the optimal solution are two images, one for building, one for using application.&#xA;And guess what. There are. For example, you have&#xA;&lt;a href=&#34;https://registry.hub.docker.com/_/python/&#34;&gt;python:latest and python:onbuild&lt;/a&gt;&#xA;images.&lt;/p&gt;&#xA;&lt;p&gt;I leave it up to you how to build your applications, these are just some ideas.&#xA;Idealy, you can base your application on busybox environment, and use images as&#xA;small as 5MB. If not, lurk around for your perfect solution.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2014/11/17/cloud-computing-basics-5/&#34;&gt;previous&lt;/a&gt;&#xA;&lt;a href=&#34;https://meka.rs/blog/2014/11/21/cloud-computing-basics-7/&#34;&gt;next&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cloud Computing Basics 5</title>
      <link>https://meka.rs/blog/2014/11/17/cloud-computing-basics-5/</link>
      <pubDate>Mon, 17 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/17/cloud-computing-basics-5/</guid>
      <description>&lt;p&gt;You hear me talk about thousands of servers and never about how to get to the&#xA;point where you make 10,000 servers go up. The fancy word is &amp;ldquo;provisioning&amp;rdquo;. I&#xA;don&amp;rsquo;t even know what&amp;rsquo;s it supposed to mean, but for me it means &amp;ldquo;make a recipe&#xA;which will make machine configured for a purpose&amp;rdquo;. As we&amp;rsquo;re talking about cloud&#xA;computing and Docker, what we need is a machine that is Consul and Registrator&#xA;ready. Getting to that point on multiple servers is not such a short task, but&#xA;it&amp;rsquo;s repetitive. And, along comes &lt;a href=&#34;http://www.ansible.com/home&#34;&gt;Ansible&lt;/a&gt;. Over&#xA;the years people realized that they want a language for specifying server&#xA;configuration that is declarative, so Ansible uses &lt;a href=&#34;http://www.yaml.org/&#34;&gt;YAML&lt;/a&gt;&#xA;for that. We also need a language to describe the configuration of different&#xA;services, and&lt;a href=&#34;http://jinja.pocoo.org/docs/dev/&#34;&gt;Jinja2&lt;/a&gt; offers that. On top of&#xA;that, it&amp;rsquo;s Python, so it has extra plus on my scale. As you can&amp;rsquo;t just apply&#xA;something on your servers and hope for the best, you need some development&#xA;environment. I think &lt;a href=&#34;https://www.vagrantup.com/&#34;&gt;Vagrant&lt;/a&gt; has no competition&#xA;in that field, yet. Let&amp;rsquo;s see on the example of this blog how to use it. Clone&#xA;&lt;a href=&#34;https://github.com/mekanix/meka.rs&#34;&gt;meka.rs&lt;/a&gt;, and execute &lt;code&gt;vagrant up&lt;/code&gt;. It&#xA;should download CentOS 7 box, create new virtual machine in VirtualBox and&#xA;provision it with Ansible. What it does is not that important right now. Let&amp;rsquo;s&#xA;start with example Ansible task:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;- name: install docker&#xA;  sudo: yes&#xA;  yum:&#xA;      pkg: docker&#xA;      state: latest&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Yeah, it&amp;rsquo;s that simple and readable. That&amp;rsquo;s fine, but let&amp;rsquo;s dive into the&#xA;details. First, there&amp;rsquo;s a&#xA;&lt;a href=&#34;https://github.com/mekanix/meka.rs/blob/master/provision/site.yml&#34;&gt;site.yml&lt;/a&gt;&#xA;file. You can see the title of Ansible playbook, hosts on which it will be run&#xA;on and roles it will apply. As I have &lt;a href=&#34;https://github.com/mekanix/meka.rs/tree/master/provision/roles&#34;&gt;two roles&lt;/a&gt;&#xA;but mention only one in site.yml, it means that role &lt;code&gt;common&lt;/code&gt; is a dependency&#xA;of &lt;code&gt;meka&lt;/code&gt;. That dependency is noted in&#xA;&lt;a href=&#34;https://github.com/mekanix/meka.rs/blob/master/provision/roles/meka/meta/main.yml&#34;&gt;meta&lt;/a&gt;.&#xA;There&amp;rsquo;s only one thing missing: list of servers that this playbook applies to.&#xA;Vagrant will generate that list on the fly depending on the configuration inside&#xA;Vagrantfile, like number of machines. Nice thing about Vagrant is that it will&#xA;share directory of the repo as &lt;code&gt;/vagrant&lt;/code&gt; inside virtual machine. Basically this&#xA;means that you can code on your laptop/desktop with your favorite editor and see&#xA;those changes on the same distribution that is used in production, on the same&#xA;docker that is used in production. Idea is to have almost identical environment&#xA;in all stages, like development, testing, pre-production, production, &amp;hellip; It&#xA;enables developers to make less bugs that are caused by differences in&#xA;environments.&lt;/p&gt;&#xA;&lt;p&gt;Ansible is such an important and easy to use tool, that I have no more words to&#xA;describe it but &amp;ldquo;read all from the&#xA;&lt;a href=&#34;https://github.com/mekanix/meka.rs/tree/master/provision&#34;&gt;provision directory&lt;/a&gt;&amp;rdquo;.&#xA;It&amp;rsquo;s simple and powerful.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2014/11/16/cloud-computing-basics-4/&#34;&gt;previous&lt;/a&gt;&#xA;&lt;a href=&#34;https://meka.rs/blog/2014/11/20/cloud-computing-basics-6/&#34;&gt;next&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cloud Computing Basics 4</title>
      <link>https://meka.rs/blog/2014/11/16/cloud-computing-basics-4/</link>
      <pubDate>Sun, 16 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/16/cloud-computing-basics-4/</guid>
      <description>&lt;p&gt;So, you&amp;rsquo;ve seen how &lt;a href=&#34;https://consul.io/&#34;&gt;Consul&lt;/a&gt; and&#xA;&lt;a href=&#34;https://github.com/progrium/registrator&#34;&gt;Registrator&lt;/a&gt; can be combined in&#xA;&lt;a href=&#34;https://meka.rs/blog/2014/11/15/cloud-computing-basics-3/&#34;&gt;previous post&lt;/a&gt;. How about we get&#xA;down and dirty, finally? One way to start a docker container is to run it with&#xA;&lt;a href=&#34;http://www.freedesktop.org/wiki/Software/systemd/&#34;&gt;systemd&lt;/a&gt;. It&amp;rsquo;s my favorite&#xA;way, so let&amp;rsquo;s take a look how does Consul service looks like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[Unit]&#xA;Description=Consul&#xA;After=docker.service network.target&#xA;Requires=docker.service&#xA;Wants=network.target&#xA;&#xA;[Service]&#xA;TimeoutStartSec=0&#xA;ExecStartPre=/usr/bin/docker pull progrium/consul&#xA;ExecStart=/usr/bin/docker run -h site -p 8500:8500 -p 53:53/udp --rm --name consul progrium/consul -server -bootstrap -advertise 192.168.33.33&#xA;ExecStop=/usr/bin/docker stop consul&#xA;&#xA;[Install]&#xA;WantedBy=multi-user.target&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There are small, almost hidden but important pieces of this code. First, you&#xA;see there are multiple ports published, and that is:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;8500: HTTP&lt;/li&gt;&#xA;&lt;li&gt;53: DNS&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;There are at least 4 more ports exposed on consul Docker image, but this is&#xA;more than enough. In previous posts you could read that Consul&amp;rsquo;s HTTP interface&#xA;has REST API and UI. If you visit &lt;a href=&#34;http://192.168.33.33:8500&#34;&gt;Vagrant IP&lt;/a&gt;,&#xA;you&amp;rsquo;ll see all the services that are registered. That&amp;rsquo;s the port that&#xA;Registrator uses to do it&amp;rsquo;s magic. But more interesting port is 53. First,&#xA;notice it&amp;rsquo;s UDP, not TCP. Second, that port is DNS. In other words, if you run&#xA;container which publishes port 80, Registrator will pick it up and  register it&#xA;in Consul. That means that you can ask Consul&amp;rsquo;s DNS where is your new created&#xA;container like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;dig @172.17.42.1 web.service.consul&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;IP of 172.17.42.1 is interesting because it&amp;rsquo;s IP of docker0 interface which is&#xA;available on every host. As Consul is distributed among all hosts, and that IP&#xA;is available on every host, you can tell all containers to use 172.17.42.1 as&#xA;DNS:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[Unit]&#xA;Description=PostgreSQL&#xA;After=registrator.service network.target&#xA;Requires=registrator.service&#xA;Wants=network.target&#xA;&#xA;[Service]&#xA;TimeoutStartSec=0&#xA;ExecStartPre=-/bin/mkdir -p /var/lib/docker/volumes/postgresql&#xA;ExecStartPre=/usr/bin/docker pull paintedfox/postgresql:latest&#xA;ExecStart=/usr/bin/docker run --dns 172.17.42.1 -P -e SERVICE_TAGS=master -e DB=onelove -e PASS=password -v /var/lib/docker/volumes/postgresql:/data --rm --name postgresql paintedfox/postgresql&#xA;ExecStop=/usr/bin/docker stop postgresql&#xA;&#xA;[Install]&#xA;WantedBy=multi-user.target&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Notice &lt;code&gt;--dns&lt;/code&gt; option. Now, this is the flow of DNS data/queries. Every&#xA;container will ask Consul for .consul domains. If FQDN container is asking for&#xA;is not subdomain of .consul, Consul will ask external DNS, which is usually&#xA;&lt;code&gt;8.8.8.8&lt;/code&gt;. In the previous example, I&amp;rsquo;ve set a service tag to master. Because it&#xA;is a service for PostgreSQL, which might be part of DB cluster, you must have a&#xA;master server. Although there&amp;rsquo;s only one DB server here, I still like to set&#xA;master just in case I decide to scale later. On DNS side it means you&amp;rsquo;ll get&#xA;&lt;code&gt;master.postgresql.service.consul&lt;/code&gt; records. As a matter of fact, you&amp;rsquo;ll get two&#xA;records: A and SRV. First one will only return IP address, while second has&#xA;richer structure which includes IP and port. So, if your application depends on&#xA;DNS only, you can still dockerize it. Nice thing is that queries are super fast&#xA;and are not cached.&lt;/p&gt;&#xA;&lt;p&gt;For the last, one trick I use lately. My DB host is always &lt;code&gt;master.postgresql.service.consul&lt;/code&gt; and I don&amp;rsquo;t even generate it on change with Consul-template. Fact is&#xA;that when DNS records change, as DNS is not cached, application server will hit&#xA;new DB server the second it&amp;rsquo;s in DNS. For some other neat tricks, check out&#xA;&lt;a href=&#34;http://www.consul.io/docs/index.html&#34;&gt;Consul documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2014/11/15/cloud-computing-basics-3/&#34;&gt;previous&lt;/a&gt;&#xA;&lt;a href=&#34;https://meka.rs/blog/2014/11/17/cloud-computing-basics-5/&#34;&gt;next&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cloud Computing Basics 3</title>
      <link>https://meka.rs/blog/2014/11/15/cloud-computing-basics-3/</link>
      <pubDate>Sat, 15 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/15/cloud-computing-basics-3/</guid>
      <description>&lt;p&gt;So I&amp;rsquo;ve scratched the surface of a service discovery in a&#xA;&lt;a href=&#34;https://meka.rs/blog/2014/11/14/cloud-computing-basics-2/&#34;&gt;previous post&lt;/a&gt;. Let&amp;rsquo;s dream on. Up&#xA;to now, I&amp;rsquo;ve only written about running a single container on a single host.&#xA;But I&amp;rsquo;m poor, I want multiple things on the same hardware. Let&amp;rsquo;s go back a&#xA;little. Docker containers are like tiny virtual machines. They have IP address,&#xA;disk space, running processes, &amp;hellip; Strictly speaking, docker isn&amp;rsquo;t a virtual&#xA;machine, but it almost is. There&amp;rsquo;s one quirk about containers: they can open&#xA;PostgreSQL port on a random port. Here&amp;rsquo;s the reasoning. If you want to host&#xA;multiple PostgreSQL instances, they can&amp;rsquo;t all be on the same port. &amp;ldquo;Not a&#xA;problem&amp;rdquo;, one would say, &amp;ldquo;I&amp;rsquo;ll configure different PostgreSQL instances on&#xA;different ports&amp;rdquo;. There&amp;rsquo;s only one problem: you&amp;rsquo;re running all PostgreSQL&#xA;containers from the same image. Yes, you can put configuration at runtime, but&#xA;remember, we have 10,000 hosts. You just can&amp;rsquo;t do it efficiently. OK, this is&#xA;how Docker does it. PostgreSQL is, by default, listening on port 5432. If you&#xA;just do &lt;code&gt;docker run postgres&lt;/code&gt;, you won&amp;rsquo;t even open a port. That&amp;rsquo;s Docker&amp;rsquo;s&#xA;weirdness about ports. Docker images are built with predefined ports to be&#xA;opened in a container. But that same port doesn&amp;rsquo;t get mapped unless you&#xA;explicitly say so with -p or -P. Here&amp;rsquo;s an example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;docker run -p 5432:5432 --rm postgres&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What it does is tell Docker to bind container&amp;rsquo;s port 5432 to all interfaces on&#xA;the host on the port 5432. In one word, you have your 5432 port open on the&#xA;host. You can do something like &lt;code&gt;-p 127.0.0.1:5432:5432&lt;/code&gt; to listen on localhost&#xA;only. You can, also, do things like &lt;code&gt;-p 127.0.0.1::5432&lt;/code&gt; and Docker will bind&#xA;container&amp;rsquo;s 5432 port to a random port on localhost. But how do you know where&#xA;to find it? You can use &lt;code&gt;docker port &amp;lt;container&amp;gt; 5432&lt;/code&gt; and it will tell you. I&#xA;agree it&amp;rsquo;s not the most elegant way of figuring out a port, but it works. You&amp;rsquo;re&#xA;able to put multiple docker images with the same open port, and they will be&#xA;happy to run together. Also, you will probably want to use private network IP&#xA;instead of 127.0.0.1 and have all your hosts on that network.&lt;/p&gt;&#xA;&lt;p&gt;If your containers are secure enough, and they never are, you can expose all&#xA;ports on all interfaces. This means that every port is accessible on any network&#xA;interface of the host. To do that&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;docker run -P --rm postgres&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;docker port&lt;/code&gt; command will still work and everything else remains the same.&lt;/p&gt;&#xA;&lt;p&gt;By now you probably wonder how Docker knows which ports are open on the&#xA;container. No, it doesn&amp;rsquo;t seek all open ports. You must specify which ports will&#xA;be opened (or exposed, in Docker terminology). That&amp;rsquo;s part of the build process&#xA;which I will cover in some later post. For now, just remember that one line of&#xA;Dockerfile for PostgreSQL is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;EXPOSE 5432&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Two old problems remain:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;how to run it in 10,000 servers environment&lt;/li&gt;&#xA;&lt;li&gt;how to tell application container the DB info&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;No wonder, it has something to do with Consul. One really neat container is&#xA;&lt;a href=&#34;https://github.com/progrium/registrator&#34;&gt;Registrator&lt;/a&gt;. It listens for Docker&#xA;events and every time new container runs, it registers container&amp;rsquo;s exposed ports&#xA;to Consul. After that, let Consul-template do the rest.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m starting to go in &amp;ldquo;WTF&amp;rdquo; direction, again. I have a proof this is not an&#xA;empty story. If you clone&#xA;&lt;a href=&#34;https://github.com/one-love/vagrant-one-love&#34;&gt;One Love&lt;/a&gt; and follow the&#xA;instructions on that page, you&amp;rsquo;ll get my project (in early alpha at the time of&#xA;writing this post) which utilizes all I was talking about. It takes a fair&#xA;amount of time for it to download everything, but once it does, you have my&#xA;application in virtual machine, but that&amp;rsquo;s not the reason I told you to do this.&#xA;The reason is that you have Consul&amp;rsquo;s WEB interface available at&#xA;&lt;a href=&#34;http://192.168.33.33:8500&#34;&gt;Vagrant VM&lt;/a&gt;. Now go and play with it :o)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2014/11/14/cloud-computing-basics-2/&#34;&gt;previous&lt;/a&gt;&#xA;&lt;a href=&#34;https://meka.rs/blog/2014/11/16/cloud-computing-basics-4/&#34;&gt;next&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cloud Computing Basics 1</title>
      <link>https://meka.rs/blog/2014/11/13/cloud-computing-basics-1/</link>
      <pubDate>Thu, 13 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/13/cloud-computing-basics-1/</guid>
      <description>&lt;p&gt;The first critic I&amp;rsquo;ve got for a blog was &amp;ldquo;Yeah, it&amp;rsquo;s all nice and shinny, but&#xA;WTF? Where are examples, documentation, &amp;hellip; ? How do I do it?&amp;rdquo; Let&amp;rsquo;s go back a&#xA;little. Cloud is extremely complicated network of hardware and virtual machines&#xA;where one second your server is in New York, next second is in Amsterdam, if&#xA;you happen to believe the media and PR &amp;ldquo;experts&amp;rdquo;. In reality, yes, sometimes&#xA;it might happen that your machine gets migrated to another data center, but&#xA;why would anyone do it if there&amp;rsquo;s no need? What cloud provides is easy migration&#xA;of machines, it doesn&amp;rsquo;t enforce them! In other words, just because you can&#xA;scratch your nose, doesn&amp;rsquo;t mean you have to scratch it all the time, but when&#xA;you do, it&amp;rsquo;s better if you&amp;rsquo;re able to do it in seconds. That&amp;rsquo;s all there is&#xA;about the cloud. The logic is simple. If you can have a number of machines that&#xA;are basically junk, you can create highly redundant WEB site if all machines are&#xA;on the fast network. You don&amp;rsquo;t mirror all the data between them, but download&#xA;virtual machines or docker images fast when you need it and hope nobody noticed.&lt;/p&gt;&#xA;&lt;p&gt;That&amp;rsquo;s where &lt;a href=&#34;https://docker.com/&#34;&gt;Docker&lt;/a&gt; comes in. Docker images are made to&#xA;be as small as possible. For example,&#xA;&lt;a href=&#34;https://registry.hub.docker.com/u/progrium/consul/&#34;&gt;Consul&lt;/a&gt; image is ~50MB,&#xA;&lt;a href=&#34;https://registry.hub.docker.com/u/progrium/registrator/&#34;&gt;Registrator&lt;/a&gt; image is&#xA;~20MB. Of course, not all images can be that small, and I did mention two of the&#xA;smallest images I know of, but maybe your application can sit on top of it&#xA;(base image is called&#xA;&lt;a href=&#34;https://registry.hub.docker.com/u/progrium/busybox/&#34;&gt;busybox&lt;/a&gt;). Or you might&#xA;need big image only to build your application, but not to run it? Docker&#xA;optimization and security are separate and hot topics these days, and I&amp;rsquo;m&#xA;trying to give you the basics here :o)&lt;/p&gt;&#xA;&lt;p&gt;What marketing around cloud technologies will tell you is that &amp;ldquo;On hardware&#xA;level we have multiple machines working as a unit to run your code on, so if&#xA;one fails, some other takes over&amp;rdquo;. Right. Let&amp;rsquo;s say you have two machines with&#xA;docker. One is your main site, and the other one is just a spare. Main one dies.&#xA;And what then? How does the spare becomes the main? Let&amp;rsquo;s say it&amp;rsquo;s a simple&#xA;modification of DNS record. OK, we got our new IP registered. But we had docker&#xA;container running on the old main computer only. Docker Hub is a service which&#xA;offers hosting docker images, so your spare machine can, in case of this blog,&#xA;run this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;docker pull mekanix/blog&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Docker will do the magic of downloading and updating the image, if you had an&#xA;old one, for you. As a matter of fact, why don&amp;rsquo;t you try it? Clone the&#xA;&lt;a href=&#34;https://github.com/mekanix/meka.rs&#34;&gt;repository of this blog&lt;/a&gt;, install&#xA;&lt;a href=&#34;https://www.vagrantup.com/&#34;&gt;Vagrant&lt;/a&gt; and&#xA;&lt;a href=&#34;https://www.virtualbox.org/&#34;&gt;VirtualBox&lt;/a&gt;, and run:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;git checkout no-ansible&#xA;vagrant up&#xA;vagrant ssh&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;First line is there just to make sure you don&amp;rsquo;t need Ansible, yet. I&amp;rsquo;ll cover&#xA;Ansible, provisioning and deployment in some of the later posts. To setup a&#xA;docker:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo yum install docker&#xA;sudo gpasswd -a vagrant docker&#xA;sudo systemctl enable docker&#xA;sudo systemctl start docker&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Your docker is now running, and you can control it. You control the cloud! To&#xA;pick up the changes on vagrant account you have to logout and run the container:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;vagrant ssh&#xA;docker pull mekanix/blog&#xA;docker run -p 80:80 --rm mekanix/blog&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And that&amp;rsquo;s it. Go to &lt;a href=&#34;http://192.168.33.33/&#34;&gt;Vagrant IP&lt;/a&gt; and you should see this&#xA;blog. If you want to update the image, stop the container (CTRL+C) and&lt;/p&gt;&#xA;&lt;p&gt;docker pull&#xA;docker run&lt;/p&gt;&#xA;&lt;p&gt;Happy docking :o)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2014/11/14/cloud-computing-basics-2/&#34;&gt;next&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cloud Computing Basics 2</title>
      <link>https://meka.rs/blog/2014/11/12/cloud-computing-basics-2/</link>
      <pubDate>Wed, 12 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/12/cloud-computing-basics-2/</guid>
      <description>&lt;p&gt;So I&amp;rsquo;ve scratched the surface of a cloud in a&#xA;&lt;a href=&#34;https://meka.rs/blog/2014/11/13/cloud-computing-basics-1/&#34;&gt;previous post&lt;/a&gt;. Let&amp;rsquo;s dream on. Let&amp;rsquo;s&#xA;say you&amp;rsquo;re hosting a &lt;a href=&#34;https://www.djangoproject.com/&#34;&gt;Django&lt;/a&gt; site. For start,&#xA;let&amp;rsquo;s assume that everything is inside one big container: Django, PostgreSQL,&#xA;NginX, &amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;After few months, your site grows and one machine is not enough. How do you&#xA;add another, when your docker image has all included, and you should share the&#xA;DB? So, you decide to have PostgreSQL in a separate docker, or someone is&#xA;hosting it for you. The only thing you need from Django perspective are DB&#xA;credentials. You end up with working Django cluster, but how do you register it&#xA;in DNS? DNS is slow. If you kill one machine and start another, with different&#xA;IP, DNS can take days to propagate.&lt;/p&gt;&#xA;&lt;p&gt;So you decide to put a load balancer in&#xA;front of those Django machines, because load balancer reconfiguration and&#xA;restart can take 5 minutes or less if you know what to do. Much faster than DNS&#xA;propagation. But now, you have a problem. If that load balancer fails, you don&amp;rsquo;t&#xA;have a site. So you start yet another load balancer and have it proxy the&#xA;requests for two Django machines, so if one load balancer fails, there&amp;rsquo;s another.&lt;/p&gt;&#xA;&lt;p&gt;Over the following months your company and app grow, and you find your self in a&#xA;position where you need 5 application servers, 3 DB servers and 2 load balancers.&#xA;Imagine you have to change the password. You would do it on all 5 servers by&#xA;hand, restating each when done. Or you&amp;rsquo;ve already discovered Ansible (or Puppet,&#xA;or Chef, or SaltStack, or &amp;hellip;) and do it automatically. But imagine you have&#xA;10,000 servers. It would take an hour, I suppose, to update all the machines.&#xA;That means, when you change DB password, it will take you an hour to get to the&#xA;last machine. That hour the last machine uses old DB password, which renders it&#xA;non useful. It would be nice if machines could agree on a set of parameters that&#xA;are needed and distributed. In our case, it would be nice if every machine could&#xA;remember DB user/pass combination, so wherever you start you Django docker, it&#xA;knows how to connect to DB. That&amp;rsquo;s exactly what &lt;a href=&#34;https://consul.io/&#34;&gt;Consul&lt;/a&gt;&#xA;does.&lt;/p&gt;&#xA;&lt;p&gt;Consul is an application with integrated WEB UI, REST API, DNS, RPC and&#xA;tons of other things, but interesting for us is it&amp;rsquo;s ability to cluster and&#xA;remember settings. I start it as a docker container on every host of the fleet.&#xA;If you have 6 machines with clustered Consul, changing variable on one host makes&#xA;it mirror to all other machines. That&amp;rsquo;s great, but it doesn&amp;rsquo;t tackle with docker&#xA;containers, so Consul alone is not enough for your 10,000 machines data center.&#xA;&lt;a href=&#34;https://github.com/hashicorp/consul-template&#34;&gt;Consul-template&lt;/a&gt; is small utility&#xA;which sits in your Django container and connects to Consul. When Consul variable&#xA;changes, consul-template will generate the configuration from a template you&#xA;provide and Consul data, and restart your Django. To be technically correct, it&#xA;will execute command you configured it with, but you want that command to do the&#xA;restart of you application once the configuration is generated. Now DB user/pass&#xA;changes can be effective in seconds instead of hours.&lt;/p&gt;&#xA;&lt;p&gt;Why stop there? You can have your DB docker react on changing the DB user/pass&#xA;combination in Consul. In other words, if you add DB user to Consul, DB&#xA;container will create it (if you &amp;ldquo;restart&amp;rdquo; consul-template script is smart&#xA;enough). You can go wild with Consul variables and cloud setup. It&amp;rsquo;s up to you&#xA;and your team to find what should be shared through Consul, and what should be&#xA;part of on-disk configuration.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://meka.rs/blog/2014/11/13/cloud-computing-basics-1/&#34;&gt;previous&lt;/a&gt;&#xA;&lt;a href=&#34;https://meka.rs/blog/2014/11/15/cloud-computing-basics-3/&#34;&gt;next&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Service Discovery</title>
      <link>https://meka.rs/blog/2014/11/09/service-discovery/</link>
      <pubDate>Sun, 09 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/09/service-discovery/</guid>
      <description>&lt;p&gt;Yes, docker is my new favorite toy, and it is big word on the Internet. So I&#xA;have my hands in the gutter trying to figure out the optimal way to configure&#xA;my cloud. What&amp;rsquo;s the big deal? For start, etcd is not my best friend, any more.&#xA;I like Consul implementation and features much more. Hence, CoreOS is not the&#xA;perfect distribution. I&amp;rsquo;m using Debian Jessie which is in beta2 stage in the&#xA;time of writing this post. The reson for this switch is Registrator. Consul,&#xA;Registrator and Consul-Template are 3 projects that make service discovery a&#xA;piece of cake.&lt;/p&gt;&#xA;&lt;p&gt;Consul is something like a distributed database. It stores key/value pairs. It&#xA;sounds like &amp;ldquo;not much&amp;rdquo; but it&amp;rsquo;s built on top of Serf, so it&amp;rsquo;s built to be&#xA;distributed. Consul, also, has built in DNS server, so key/value pairs can be&#xA;A or SRV records. In one word &amp;ldquo;where is my postgresql docker container&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;Registrator is just crazy. You give it Docker&amp;rsquo;s socket file to listen for&#xA;events, and every time new docker container is up, it automaticly registares&#xA;them in Consul, and deregisters them when container is down. This means that&#xA;every time new application container is up, you can query it via Consul&amp;rsquo;s DNS&#xA;protocol. If you start your containers with -P, for example, Registrator will&#xA;register the ports your container is bind to.&lt;/p&gt;&#xA;&lt;p&gt;Consul-Template is golang program that listens for changes in Consul, generates&#xA;configuration of a service (say, nginx), and runs a command (say, service nginx&#xA;restart). Why is this cool? Just imagine you have your load balancer,&#xA;application server and database server running. You have a peak, and you start&#xA;one more application server, which needs to be added to load balancer, and&#xA;configured with database connection. With consul-template, it&amp;rsquo;s as easy as&#xA;starting new application container. Because Registrator will pick up on which&#xA;IP and port it is awailable, consul-template on load balancer is able to&#xA;regenerate configuration and restart nginx. If hosting provider has&#xA;autoscaling support (I know AWS has it), you have your cloud dynamicly scaling.&#xA;How cool is that?&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cloud Computing - intro</title>
      <link>https://meka.rs/blog/2014/11/02/cloud-computing-intro/</link>
      <pubDate>Sun, 02 Nov 2014 22:00:00 +0000</pubDate>
      <guid>https://meka.rs/blog/2014/11/02/cloud-computing-intro/</guid>
      <description>&lt;p&gt;As &lt;a href=&#34;http://www.youtube.com/watch?v=ecZL4Q2EVuY&#34;&gt;nobody understands the cloud&lt;/a&gt;,&#xA;it became obvious to me I will hack something out of it. And I did. A job. My&#xA;latest toy is &lt;a href=&#34;https://coreos.com/&#34;&gt;CoreOS&lt;/a&gt;. It features two nice things a man&#xA;doesn&amp;rsquo;t need until he faces big amount of servers. First being collective&#xA;consciousness, aka etcd, allowing storing information about the services,&#xA;like which upstream servers for your load balancers are on which IP addresses.&#xA;Second is fleetd, which uses etcd to store and read data. It starts docker&#xA;containers on your CoreOS instances. Actually, it starts systemd services,&#xA;which is even better! :o) Oh, did I mention cloud computing these days is all&#xA;about running containers? &lt;a href=&#34;https://www.docker.com/&#34;&gt;Docker&lt;/a&gt; containers in my&#xA;case. Lastly, in dynamic environment of the cloud, you need dynamic&#xA;configuration. But what application in the world has dynamic configuration?&#xA;None that I know. Despite that fact, cloud computing and docker containers&#xA;are thriving. There&amp;rsquo;s a secret ingredient:&#xA;&lt;a href=&#34;https://github.com/kelseyhightower/confd&#34;&gt;confd&lt;/a&gt;. What it does is poll etcd&#xA;every 10 seconds or so, checking if there are changes on some of the keys in it&#xA;and if there is, generates the configuration of your application and restarts&#xA;it. Confd uses templates and etcd data to generate the configuration, so once&#xA;you have your fleet running, changing master DB host is as easy as&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;etcdctl set /my/app/db/server 192.168.0.4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and all containers having confd will pick up the changes. Just imagine, one&#xA;command and thousand services change their configuration accordingly. This is&#xA;small step for cloud, but huge step for a man, because it&amp;rsquo;s hard to start&#xA;thinking about &amp;ldquo;configuration is in the cloud&amp;rdquo;. Once you grasp that idea,&#xA;you&amp;rsquo;re on a great way to cloud computing.&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
