Elizafox's Ramblings

The blag/dumping ground of Elizabeth Ōkami

I spent literally all day yesterday trying to figure out how to get a jail to route an IPv4 IP given to me by Vultr using vnet (I was having bizarre issues with IPv6 and the host stack; vnet fixed them).

It sounds like an easy problem, and to people who are super experienced... it probably is, and the answer is obvious in hindsight. But even 16 years of BSD experience couldn't help me here.

The problem in detail

The problem was routing an additional IPv4 IP that Vultr gave me, that wasn't in the same subnet as my main IP. It works fine on the host without issue:

ifconfig <external_interface> inet <second_address> alias

That's because the default route is already configured.

You'd think that in the jail, it'd be a matter of doing the same and it'd all Just Work™. Nope!

(Note with the below: not all attempts are logged, just the major ones I remember... I tried a lot of things, for 8 hours)

Adding the route: try 1

When you try it in the jail, like so:

route add default <host_gateway> -iface eth0

You get an error like:

route: writing to routing socket: Network is unreachable
add net default: gateway via fib 0: Network is unreachable

Bummer.

So I tried this in the jail:

route add <host_gateway> -iface eth0
route add default <host_gateway>

But nothing would route out of the jail.

Adding the route: try 2

I even tried this in the jail:

route add -net <host_gateway>/<host_subnet> -iface eth0
route add -host default <host_gateway>

And that was even worse. Now everything said “no route to host.” Gah.

I also kept getting this weird issue where I'd add a default route, and it would get corrupted into some gobbledygook in netstat -4rn like so:

Destination        Gateway        Flags Netif Expire
0.0.0.0&0x68150581 104.207.142.1  US    eth0
104.207.142.0/23   link#2         US    eth0

Maybe some kind of bug?

Adding the route: try 3

I went back to the former solution, and did tcpdump on the host. I was seeing traffic coming out of the jail, but it wasn't coming back. I could arping the host, and the gateway, but still couldn't route things.

So I figured it was a host issue.

I tried this on the host (not the jail):

sysctl net.inet.ip.forwarding=1
route add -net <second_ip> -inet bridge1

Nope.

Adding the route: try 4

At this point I was super confused. So in desperation, I even tried this on the host:

route add -net <second_ip> -inet epair1a

Still nothing.

Adding the route: try 5

I was pretty much despondent at this point. I had spun my wheels on this problem for 8 hours, brainstorming answers, trying literally everything I could think of, picking other's brains who were just as confused as I was.

So in an act of extreme desperation, I tried the one thing I hadn't tried on the host:

route add -net <second_ip> -inet <external_interface>

And then...

It worked.

Holy crap, it worked. I bowed down, thanked the heavens, and felt so much relief, I went and made Taco Hamburger Helper (I'm poor, okay?).

Making it all work

So here's how you can make this work in your environment, too, on Vultr and probably other hosting providers, if you're in the same situation:

Jail

cat >>/etc/rc.conf <<EOF
static_routes="default_router"
route_default_router="-host <host_gateway> -iface eth0"
defaultrouter="<host_gateway>"
ifconfig_eth0="inet <host_ip>/<host_subnet>"  # For me it was /32
EOF
route -host <host_gateway> -iface eth0
route default <host_gateway>

Host

cat >>/etc/rc.conf <<EOF
gateway_enable="YES"
static_routes="jail0"
route_jail0="-host <second_ip> -iface <external_interface>"
EOF
sysctl net.inet.ip.forwarding=1  # This just does what the line in rc.conf does on reboot
route add -host <second_ip> -iface <external_interface>

Addenum

If you have a provider that restricts the original MAC where something came from, you can replace <host_gateway> above with your host machine's IP. I tested that, and it all Just Works™. It should then route through your host machine to the outside world, and the jail's MAC in theory shouldn't be visible.

Conclusion

I hate IPv4 more than I hate IPv6 at this point. It's always been like this, whereas IPv6 has mostly been pretty good (minus ISP/modem issues... I once had a horrible Siemens DSL modem that wouldn't pass 6to4, but that's a story for another day).

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

I get lonely a lot.

I mean, it's natural. I live alone.

I sort of got alienated from most of my friends here due to my own mistakes and missteps (although I cut off a lot of toxic people too). Those are mine to live with. But I have a few left here, and they've stuck by me.

It's probably for the better. A lot of them were just dead weight to me.

I know I need to rebuild my friend circle.

Being comfortable with yourself

I think something I've learnt how to do throughout all this is how to be comfortable with just me. I haven't lived alone ever in my life, until now. It's definitely an interesting experience.

I feel like it's a little isolating, but it's fine. It's teaching me valuable lessons about myself, and helping me grow more comfortable in my own skin. I really needed this, even if I didn't want it.

Will I ever live with someone again?

🤷‍♀️

I don't know what the future holds. I know right now, I'm not looking for new roommates, especially because the last one was an utter disaster, for me and for the people I was close to (and this is partially how I lost them).

I do know this: living alone means I don't have to live up to anyone's expectations or anything.

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

I wanna talk a bit about something I discussed in therapy.

Guilt alone changes nothing. It doesn't help you, nor the people you've hurt.

What matters is empathy.

Guilt leads to self-pity.

The only thing guilt leads to, is self-pity.

Self-pity is not constructive. In fact, it is incredibly destructive, and leads to fatalism. All you do when you pity yourself is proclaim, “it cannot be helped; I clearly cannot change, because I am a bad person.”

This is false and leads you to repeating the same patterns over and over.

Empathy leads to change

Put yourself in the shoes of the people you hurt. Do you genuinely think they want you to punish yourself repeatedly as penance, and feel endless remorse, or do you think they want you to change and not do it again?

I'm willing to bet it's the latter.

Wallowing in guilt will only make things worse. What good does self-punishment do if you've made no commitment to avoid repeating the mistake?

You're probably not a bad person

You have much to offer others. You may do bad things, but so do we all. The mark of a good person is one who learns from their mistakes and puts in the effort to change their behaviour.

Guilt alone is neutral. Most people experience it. It isn't anything special, and as I said above, it doesn't help.

Nothing can substitute actions.

As my Latin teacher said: results, not excuses.

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

I wanna vent a bit about dependencies and their hidden cost.

We all know the usual Dependency Hell problems, but there is a much more subtle problem, one I've run into time and time again.

Abandonware

Oftentimes, you run into a library (call it a crate, package, egg, gem, you could call it a poopsock for all I care), and it turns out to be abandoned and hasn't been updated in years. Worse, it may have bugs that you can't work out. So you're stuck forking it, or just copying the code and maintaining it locally in a sort of de facto fork. Yuck.

Variable quality

The biggest problem I've found, however, is variable quality. Oftentimes you think you've found this great library, that meets all your needs... and then you discover it has a terrible interface, or terrible documentation, or is riddled with bugs, or is designed for a completely different application domain.

Gah.

This is literally the worst. It's super annoying too, when the library implements functionality you really don't want to waste too much time implementing yourself, or handles a lot of boilerplate, or what have you.

The case for “batteries included”

I appreciate Python's approach (that they're seemingly abandoning gradually) of “batteries included.”

Stuff included in the standard library usually has many, many eyes on it. It gets audited frequently. It gets reviewed more often. And it's guaranteed not to break, it will work essentially “forever” or until it's deprecated (which you will get plenty of warning about).

Even if nobody is “touching” the code, code doesn't magically stop working when you're not looking at it. As long as bugs get fixed, and it does what it needs to do, it doesn't matter.

If wishes were fishes

I wish Rust's standard library was less minimalist for this reason. But I guess I can dream.

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

Stop repeating mainstream news for clout.

This is a short rant.

What the title says. I don't want to have to unfollow people, but I will.

I'm sick of hearing the same bad news forcibly injected into my brain.

May I refer you to Death Grips' take on this?

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

Some people ask me this, and if you don't know me well, there is a reason they ask this.

So this will function as a sort of “FAQ” about it.

How do I pronounce it?

Many people get this wrong.

It is pronounced /əˈlaɪzə.fɒks/ (eh-lie-zuh-FOCKS).

What's the deal with the Eliza/Elizabeth vs Elly thing?

I have always preferred those close to me call me Elly. Those I don't know very well should always call me Eliza or Elizabeth. Professionally, I go by Elizabeth.

This may seem unusual, but think about how many people have nicknames like this. “I'm Thomas, call me Tom,” “I'm Cynthia, call me Cindy,” etc.

It's a shame English doesn't have T-V distinction anymore. That would be cool. My name is kinda like that, though, with “Elly” being the “T” form, and “Eliza”/“Elizabeth” being the “V” form.

Side note about Early Modern English

If this were Early Modern English, this would be a relevant style guide:

  • T form: “Elly, I'm speaking to thee!”
  • V form: “Elizabeth, I'm speaking to you!”
  • T form: “Elly, what art thou doing‽”
  • V form: “Eliza, what are you doing‽”

But I don't want to get too deeply into the weeds of Early Modern English conjugation and all that.

What forms of your name are acceptable?

As stated above, Elly is preferred if we're close or if I ask you to call me that; otherwise, Eliza or Elizabeth.

Please do not call me “Liz,” “Lizzie,” or any other variant.

If you require disambiguation with another Elizabeth/Eliza/Elly, ask me for a preferred form. I'm not unreasonable.

“Why are you so picky about capitalisation?,” or, “How do I capitalise your name?”

The style of my name is invariant: the first letter is capitalised, the rest is lowercase.

Acceptable variants: – Elly – Eliza – Elizabeth

Unacceptable variants: – elly – ELLY – ELIZA – eliza – eLiZa

If you're just shitposting though, I probably won't get my shorts in a wad about it. I'm not that stubborn.

What's the deal with your British English spelling?

This has nothing to do with my name, but I get asked that a lot anyway.

That's how I was raised to spell things.

How did you come about your name?

I picked it out of a hat. Literally. I just got a baseball cap, filled it with random slips of paper with names I liked, and chose it.

I chose it when I was about 18 years old or so, so a very long time ago.

What are your pronouns?

This section is tentatively normative, but subject to change.

This is tangential to my name, so I'll include it.

I've experimented with different pronouns (and even trying just my name) in the past, I'm not totally happy with the status quo, but this is the happiest I've been in a while, so we'll go with this for now.

You may call me she/her, or they/them. Either is fine. I have no real preference.

I used to be pickier about this, asking strangers to call me they/them and for those close to me to use she/her, but I've softened my stance since. I just found I didn't mind being called she/her.

What's your middle name?

Aurora.

I don't want to explain how I came about that name in a blog post, that's private.

It follows the same style guide as the rest of my name, first letter always capitalised, the rest lowercase. Please do not shorten it.

It used to be Jennifer, but that's long since deprecated.

What's your last name?

It's at the top of the blog, dummy!

It's Myers.

This last name is descended from a Scottish planter who became a mayor of a town in what is now Northern Ireland. However, I do not really identify with this part of my heritage, it's just where my last name comes from. I may change it in the future.

What is your name in other languages?

In Japanese, I prefer the name 直美. This was given to me by my sensei who taught me elementary Japanese.

In French, Elisa and Elisabeth are acceptable variants. Elly is the same, though I usually spell it Ellie in French.

In Spanish and Portuguese, Elisabeth/Isabel/Isabella is acceptable. Elly is the same, though Isabel is fine for an informal version too.

Otherwise, ask me!

Side note on T-V distinction

In languages like French with T-V distinction, I ask that those who don't know me use the V form, and use the T form if we know each other or if that's the standard form in the language. They're usually the same rules that apply for Eliza/Elizabeth vs. Elly. All V forms should use “Eliza” or “Elizabeth” or a localised variant, and all T forms should use “Elly” or a localised variant of my choosing.

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

I think Rust needs a GC type, like what @ was supposed to be.

I don't mean a reference-counted type, I mean an opt-in garbage-collected type, akin to Rc or Arc.

My case

It's quite simple.

Cyclic data structures

Sometimes you have cyclic data structures in Rust. Said reference cycles mean you need to manually implement Drop. Sometimes you find yourself fighting the borrow checker over these cycles.

It's horrific pain and nobody should have to go through it.

We can avoid all this by having a Gc or Agc type that doesn't care how many cycles there are, it just does the right thing.

Garbage-collected languages

Implementing a garbage collector is basically mandatory for implementing any garbage-collected language, like JavaScript.

For Rust to be usable in these contexts, you either have to implement a GC yourself (which is horrific pain), or use an existing crate (none of them are ideal).

A built-in Gc and Agc type would help everyone in this.

Avoiding dangling pointers on Drop

When dropping to the level of pointers (which you basically have to do to implement anything with reference cycles), you run the risk of all sorts of problems associated with them.

I didn't choose Rust only to be forced into using it like C! It brings back the spectre of memory errors, use-after-free, off-by-one, etc.

We can avoid this whole mess with a Gc type.

But isn't there the gc crate?

Well, yes. But it can be quite a pain to use, and it's not as nice as something integrated into the language.

It also isn't thread-safe. Ideally, a GC type should be thread-safe.

But GC is evil!!!!!11111oneone!1!11

Yes, I know the arguments against GC. I am aware they tend to be non-deterministic, have the embarrassing pause, etc.

But I digress

For 99% of use cases, you absolutely do not need a GC. There's absolutely no reason to use one most of the time and in most applications.

But when you need one, you need one.

I genuinely hope this can become a thing someday in Rust.

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

I'm kind of struggling to pay the bills right now. I'm still looking for work.

If you want to help, there's a few ways.

Employment

The main way you can help me is by employing me.

I'm looking for tech work in Seattle (specifically software engineering or systems administration, open to DevOps positions), although I will relocate if the price is right. I'm primarily looking for remote/WFH, but I will work at an office if you absolutely insist. I will give my résumé on request.

I am also accepting contracts. If you need something done in a project, FOSS or not, drop me a line. I'll happily do it for you. My rates are relatively reasonable. We can negotiate it.

If you want to contact me about employment opportunities, drop me a line.

Background

I'm a software engineer/system administrator/devops person with a wide variety of experience, particularly in systems programming. For languages, I know Rust, Python, C, C++, a bit of Java, and I can probably learn your weird language in short order. For systems, I am experienced with Linux (Debian, Ubuntu, Arch, Gentoo, Fedora, you name it), FreeBSD, NetBSD, and a bit of Windows.

I am a very, very fast learner!

Tip jar

This is the less preferred option, but it still helps me a lot.

You can toss a few bucks in the tip jar: PayPal, CashApp, or LiberaPay.

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

I think about VM's a lot.

I don't mean the kind you run an OS in (a system virtual machine), I'm talking about process virtual machines.

Maybe you do too, or you wanna know more.

So, I'm going to dump the things I've discovered into a blog post, to help inform others how the sausage is made.

And yes, I have made VM's before. I have made both stack and register-based VM's. I'm actually thinking about making a JIT'ed VM, just to brush up my low-level platform skills.

Register vs stack-based VM's

For those who don't know, there are two main kinds of VM's: stack-based and register-based.

Stack-based VM's

Stack-based VM's manipulate a stack to store all data. It's not the most efficient way, but it works and is very simple to implement. CPython, PyPy, Perl, Ruby, CLR, PostScript, the JVM, and most others you'll encounter are stack-based.

Register-based VM's

Register-based VM's use registers to store data. They're not quite as common because they can be quite complex (more on that in a bit). A few register-based VM's you may know of are LLVM, BEAM (used by Elixir and Erlang), Dalvik, and Lua.

Side note

Many register-based VM's do have a stack to spill registers. Likewise, with a JIT, stack-based VM's often do register allocation. The difference can be quite muddied and sometimes not always so clear.

Personal opinion

You know, I really like register-based VM's in concept, but I can kinda see why register VM's aren't as popular.

I like registers much more than I like a stack. This is just a personal preference, but I've always found registers more easy to reason about than stacks.

Register-based VM's tend to be faster, because they're closer to how the machine actually works. However, they're harder to write a good JIT for.

JIT for a stack-based VM

A stack-based VM JIT is relatively straightforward. You can just “cache” hot stack elements in a register and operate on them, without having to repeatedly manipulate the stack. You know how many registers the hardware has, so you know how much you can cache. And when you need to spill back to the stack, it's relatively straightforward.

JIT for a register-based VM

This isn't so clear.

You often have thousands of registers to contend with, and you need to decide what needs to be spilled and what doesn't.

You get 6-7 registers on x86_32 to play with, so register allocation is obviously much more annoying on this platform. x86_64 has 16, and most RISC-y architectures have at least 32, so it's not as big of a problem on these.

Deciding where things should go on the actual hardware stack, what to keep in registers, etc. is not as straightforward. It's not like, intractable, it's just much more of an art (although optimal register allocation is an NP-complete problem, you don't need perfection, you just need it to be good enough).

Conclusion

I don't really have a conclusion for anything. I think stack-based and register-based VM's both have a place in this world. I think they're both neat! I have my biases, but I think that VM's are fascinating and I enjoy thinking and reasoning about them.

I hope I've learnt you some stuff about them too! 💜

If you have any questions, comments, corrections, etc. drop me a line on fedi. This blog is also available on Fedi at @elizafox@blog.elizafox.space.

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay

Content Warning: politics; if you don't like politics, or wanna hear about them, you may wanna skip this one.

I've never really put pen to paper about my political beliefs in a single coherent document. I guess there's no time like the present.

WARNING: my beliefs do evolve over time. I can't promise that this will be authoritative in a month, let alone a year. This is merely a snapshot in time.

A rough overhead view from geostationary orbit

I am probably best described as a leftist. I believe in no true dogmas, but obtain my beliefs from a variety of sources. I believe there is no one source of truth.

I refuse labels like “Anarchist,” “Communist,” “Socialist,” etc., but if you really insist on putting me in a box, “Anarcho-Socialist” would probably be close.

Specific views

Though there is of course nuance to my beliefs, I will do my best to give a rough outline of what I believe here, based on economics, social equity, and governance.

Economics

I believe in equity for all. I also believe that achievement should be rewarded, but no reward should come from the backs of exploitation.

Those who cannot work do not deserve to live in penury. They are valuable members of the community and deserve our support.

Society is nowhere near full automation and we are absolutely reliant on labour. It's foolish to say we can abolish all work at this time. However, those who can work, should not be made to work beyond what they are capable of doing. If that means they only work a few hours a week, so be it.

We should endeavour to match people to jobs that use their talents to the best of their ability. Labour comes in many forms and does not necessarily mean that all work must be profit-motivated. A well-motivated amateur can outclass a jaded professional, every time. The tireless open-source contributor is as valuable as any professional.

Avoidance of burnout is paramount to maintaining productivity. Chasing endless productivity is a fruitless endeavour and at some point, productivity is waste. However, too little productivity does have negative consequences. Balance must be struck.

Working conditions should be as safe as possible. Safety must be job #1. Preventable deaths are a tragedy. There is no acceptable level of death in the name of productivity. Anyone who tells you otherwise should be made to work in a coal mine and then we'll see how they feel about safety.

Those who have too much should be taxed proportionally and help pay for improvements to society. I believe this is an imperative to ensure the survival and well-being of our species. Billionaires should not exist, and any philanthropic niche they fill should be filled by other means. We don't need Bill Gates to cure malaria, anything he can do, we can do.

Social equity

Bigotry of any kind, including racism, sexism, any kind of -ism, any kind of -phobia, is a blight and must be destroyed. The senseless belief in superiority over others is an illusion and is born out of inequality and scapegoating.

I believe everyone deserves to have their needs provided for, and some of their desires.

I don't think that means we should give everyone a toilet made out of solid gold. I also don't think we should give to those who already have or don't need it.

This means we should provide housing, healthcare (including mental healthcare), food, water, electricity, Internet, and basic entertainment.

I believe that rehabilitation services should be made more widely available for those who wish to (re-)enter the workforce. Few people truly wish to remain idle; often they're just stuck in a rut or need a helping hand.

We should work to help those who have trouble connecting with their communities to do so. Helping people make friends is the number one thing we can do to help with happiness and productivity. We are a social species, and we rely on each other to survive.

I believe governments should stay out of private lives unless harm is being committed. This means marriage should not be defined by the government, nor the shape a relationship should take, or anything of the sort.

I believe universal education, and the access thereof, is the key to a well-informed and critically thinking society. We must work to educate people in the way they learn best. Oftentimes, “learning disabilities” are simply the inability to learn based on outmoded and terrible methods that work poorly for many.

Governance

I'm still not sure how we can make an equitable government.

I don't think elections are the way forward, but instead appointing by lottery is the way to go. It may seem counterintuitive, but this selection process works for juries. If we do this for government, we can solve the cronyism problem.

I believe those who are appointed and turn out to be incompetent or corrupt should be able to be removed by popular vote, however.

I don't usually believe in hierarchies, but I also recognise the value in cooperation at multiple levels. I also recognise people often don't do very well without some kind of leadership and tend to wander aimlessly or bicker pointlessly without it. The question of how to ensure leadership doesn't become corrupt is an open one. I believe leadership should be as narrow and limited as possible, and only serve as a place where the buck stops and as a guidepost for where to go, based on the input of others. Leadership does not mean power vested in one person, however. It can be a committee or a group.

I believe in consensus-based governance. This doesn't mean that everyone agrees 100% on everything, just that a general consensus on how to proceed is achieved.

I do not believe in political parties or partisanship. People are multi-dimensional. Parties wind up representing narrow interests of a specific group and do not represent everyone.

I think the way “democracy” presently works is fundamentally flawed and stacks the deck in favour of the wealthy and powerful. Governments at present do not represent the will of the people, and oftentimes they make it transparent that they don't, in the name of some vague “greater good” that usually just means someone is making a buck. I also recognise that any form of elective democracy means the person with the most charisma will usually win, not the person with the most competence.

Conclusion

I hope I wrote my thoughts out coherently. I could write more, but I don't want to right now. I think I've written enough.

I hope this clarifies my positions on some things to people who were curious.

— Elizabeth Myers (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay