Few notes on UPC/Virgin Media Ireland's Technicolor TC7200

Update 2015/10/03: It’s Virgin Media now? Alrighty then. updates title

Update 2015/01/03: You are probably here for one reason: how to use SNMP to switch this router to bridge mode? As this is unsupported by UPC Ireland, let’s hope they don’t spoil the fun for us. (After posting the main body of the post, I actually got a proper DD-WRT friendly router and have started using this.) So here’s what you’re interested in.

To switch the device into pure modem, non-routing mode, you use:

snmpset -v2c -c public 192.168.100.1 1.3.6.1.4.1.4413.2.2.2.1.7.1.1.0 i 1

Additionally, concerning IPv6, at no later time have I observed receiving an IPv6 globally routable address, so I guess that was a lucky hiccup.


Based on this thread which I ran into here. These are just notes; if you can learn something from them, do so; but please be careful and fully aware that these are not instructions — merely notes for my own personal use in the future. I do not recommend you follow the notes; quite the opposite.

Despite (according to their reps on Twitter) telnet being unsupported by UPC, you can easily telnet 192.168.100.1 and use username: webstar, password: webstar to log into the console. There isn’t much to do there, sadly. Apparently you may be able to use the set command to control SNMP settings.

Some configuration of hidden features can be done via SNMP. I highly advise you not to do that. This is unsupported by UPC, and you might be unable to restore settings to the previous state.

To switch the device into pure modem, non-routing mode, supposedly you use:

snmpset -v2c -c public 192.168.100.1 1.3.6.1.4.1.4413.2.2.2.1.7.1.1.0 i 1

This didn’t work for me immediately. It seems to work immediately after reboot. Also worth noting is the snmpwalk command:

snmpwalk -v2c -c public 192.168.0.1 1.3.6.1.4.1.4413.2.2.2.1.7.1.1.0

Note that the value of “1” means “modem mode” (also known as “bridge mode”), while “2” means “ordinary NAT+routing mode”.

Be very careful. Turning on “modem mode” breaks Wi-Fi. You may need to bring up a separate access point for Wi-Fi. You may have trouble restoring the setting. PUBLISHING OF THESE NOTES DOES NOT CONSTITUTE ENDORSEMENT TO ACTUALLY USE THEM.

Also, I was unable to restore the setting to “2” using SNMP. Hard reset by holding the reset button for 30 seconds worked. Unless you use it strictly as a modem, with another device that performs NAT and IPv6 routing, it isn’t worth switching to NAT mode. So please don’t do this unless you’re fully prepared for breakage of service and possibly annoying UPC (since they obviously don’t want people to play with this).

It’s interesting that UPC does assign a public, fully routable IPv6 /64 prefix. Too bad that it’s not exposed to regular users locked behind a NAT who cannot get direct access to the public Internet, and who have been locked out of it by a firmware that is seemingly arbitrarily restricted compared to the one used in Netherlands. UPDATE: Two sources have told me that they did not receive an IPv6 prefix or address. As I am not keeping my device in bridge mode, and I do not advise readers to do so either (unless they have very good reasons), I cannot and won’t verify this. You can opt to leave a comment on your success, but I want to be clear that neither my text, nor any comments below, represent any advice on my part.

It’s also interesting that the setting seems to have survived a factory reset through the web interface. Factory reset through web interface has, however, restored WiFi functionality, and it seems that WiFi and LAN are getting separate IP addresses. Factory reset by holding the reset button for 30 seconds is the actual hard reset and cleans up the setting for “modem mode”.

Switched to nginx

I’ve switched the server to nginx. I don’t have too many htaccess-based rules, and overall the Apache2 configuration was very simple to begin with. I installed php5-fpm, followed tutorials on configuring nginx (moving what’ll be common among 15ish virtual hosts into a separate file), configured proxying for XMPP BOSH and finally improving SSL security.

Apache2 now sleeps quietly and the RAM usage is down a bit. Hopefully the server won’t suffer any more hard crashes due to lack of RAM like it did immediately after I moved to the new host.

Overall, nginx seems like a much lighter and easier to understand solution for my very simple needs; if you’re running a simple server, I recommend it (as long as you read a bit about its security, if you intend to use it for serving PHP!).

On the referendum

For me, the issue was not (bluntly) whether the gay marriage is good or not.

The issue is whether stupidity and ignorance will prevail.

Well, now we see how damaging can changing referendum rules be. You see, some time before Croatia entered EU, constitution was amended to permit referendum to be valid without 50% voter turnout.

Croatia voted to enter EU with 43% turnout.

Today, with 37% turnout, Croatian voters demonstrated inability to separate their anxiety from good judgement.

And it’s simultaneously funny and sad; I’d love to see the reaction of people who said: “If 57% of voters can’t be bothered to turn out at the voting booths, then it’s okay to ignore their votes.” The same people have probably voted ‘against’, and are now widely disappointed.

I’m saddened by the fact that 24% of Croatian population has successfully demonstrated that a well-orchestrated brainwashing campaign of fear, uncertainty and doubt can succeed perfectly in Croatia. I’m saddened because this type of population is right for getting an oppressive but populist regime in place. 24% activists + 62% passives. Think of those numbers.

Reading articles on Croatian news portals from the distant Ireland, I see that there’s already talks about a referendum on “cyrillic”, a script whose presence in Vukovar, a city heavily damaged in the war during attacks by a cyrillic-using nation, offends a lot of people. So now not only are we taking away rights that didn’t exist in the first place, but we’ll have a referendum on a script, and waste 5 million more euros.

It’s sad that this thing managed to pass even with a disgusting brainwashing campaign run by certain large newspapers opposing the referendum question.

It’s sad that this thing managed to pass even among the international voters.

I’m happy that Croats in my new home, Ireland, voted ‘against’.

When leaving, I simply *knew* I’d be coming back some day. Now, I’m saddened that 24% of people manage to be misinformed and misled. I’m saddened that 62% find their vote to be irrelevant. And I’m questioning whether I can count on finding the 12% that has been both active and reasonable.

Oh scratch that; considering the campaigns against the referendum, the “reasonable” part is actually much smaller.

To the world: I’m sorry.

To my homeland: I hope you will heal some day.

Noogler

Just a short note that I’ve went to Dublin on November 6th, and I started working for Google on November 11th. Well, not quite working — training.

I won’t post work related stuff to avoid wrath of the security people 🙂 but I’ll try to expand a bit more on my impressions of Dublin, a bit on the overall atmosphere of the workplace (no confidential or even work-related stuff), and similar “safe” things.

What I can tell you is that — I can recommend Ireland, and it’s great at work training.

Some things I learned about OpenGL and OpenGL ES

I have done some stuff with OpenGL and OpenGL ES in the past. I generally tried to stick with fixed function pipeline; I never had good reasons to dig deeply into features provided post-GL1.4 (most of the time, GL1.1) and OpenGL ES 1.x. So the client for an MMORPG I worked on (both the 2D and 3D) did not need anything more. Nor did the simplistic unfinished spacesim. Neither did the zombie squishing game for iPhone.

For a few months now, I’ve had access to one of the “major league” game engines (which shall remain unnamed for now!), so I had to expand my knowledge a bit. I didn’t succeed as much as I should have, but here are a few interesting things I have learned.

They may be obvious, but I’ve only learned about them very recently. And it wasn’t trivial to figure them out exactly, at least based on queries I typed in Google. “What does this OpenGL feature do and how do I put it into OpenGL ES?”

Internal texture formats

We all know the incantation:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureData);

So I knew there was talk about the first GL_RGBA involving an “internal format”, and the second GL_RGBA and GL_UNSIGNED_BYTE specified how the textureData argument was, well, formatted. If we replaced them with GL_RGB, we’d drop the alpha from the image. But what did all that mean?

Yesterday I ran into GL_RGB8. And GL_RGBA16. And GL_RGBA4. And GL_RGB565, and more. These can be passed as the first argument, and determine how the desktop OpenGL implementation will store the texture. If you pass GL_RGB, you’re letting the implementation determine the optimal pixel component size in bits. If you get more detailed, you get more strict about the internal format you want the implementation to use for the pixels you passed.

Today I dug into a document I ran into yesterday, from 2007, which discussed that with OpenGL ES the implementation gets to decide, and tries to honor the internalFormat argument based on the format and type arguments.

GL_BGRA is an extension

On desktop, it got promoted to core OpenGL. On OpenGL ES, it’s called GL_BGRA_EXT.

Oh, and GL_HALF_FLOAT_OES does exist on OpenGL ES.

Protip: you do want to look into headers, especially the extension header (glext.h, gl2ext.h or such), whenever you can’t find if something exists and you’re sure it should.

Reverse formats

What the hell is GL_UNSIGNED_INT_8_8_8_8_REV? How does it relate to GL_UNSIGNED_BYTE and GL_UNSIGNED_INT_8_8_8_8?

This is strictly as far as I understand it! My understanding may be wrong and I would love it if someone clarified this in the comments! (For reference, the APPLE_packed_pixels extension talks about these.)

Once again, I may be wrong. Read the above links.

Alright, so let’s imagine you passed the source format of GL_BGRA in combination with the above. You’re specifying that the data you have passed has actually not been stored in the BGRA order — but in the reverse. That’s what REV means. Reverse. So you’re telling OpenGL you’re actually passing a texture stored in the ARGB order.

Notably, that doesn’t exist in OpenGL ES 2.0, so one may end up using GL_UNSIGNED_SHORT_4_4_4_4_REV. Without actually playing with that, I suspect that would mean also having to pass data with 16 bits per pixel, which kind of defeats the purpose of not having to convert ARGB textures. You could bake the data at build time, sure, but still…

Just red, just red and green

There are GL_RG* and GL_R* formats. For example, GL_RG8, GL_RG16 and GL_R8. Yip yip.

More?

Of course, I learned even more things. And I didn’t dig into everything I want to know (what’s GL_LUMINANCE and GL_LUMINANCE_ALPHA as a texture format, and why do I want to use that?).

Less than a week before I start the new job. Looking forward to spending some of the remaining time after my Wednesday trip on studying some of the interesting things such as these OpenGL features…

About downtime on my blog: lack of RAM and swap! Also, what is "swappiness"

Over the last few days I had a bit of downtime. I have no monitoring set up for the services, and I didn’t have problems on the previous server. But having migrated to DigitalOcean, it turns out that its default configuration does not provide a swap partition, and that 512mb is too little for Apache2 and MySQL (at least with configurations I had on the previous server).

Even after a bit of reconfiguration to tell both Apache2 and MySQL to back off a bit, every few hours Linux would choose MySQL as the “less important” process to kill, due to lack of memory. And MySQL would not automatically restart (because it’s not set up to do so).

So I’ve done some deleting of old hosted files (freeing up a bit of disk space) and have set up a 1gb swapfile (note that the instructions are intended for 256mb servers, hence creating a 512mb swapfile).

In the process, I learned about sys.vm.swappiness, which is a kernel setting that apparently controls when the kernel will decide to swap things to the swap partition or swap file. By default set to 60, as the article instructs I’ve set it to 0 (which makes sense, as I want swap to be used as rarely as possible). IBM also suggests 0 in KVM-based virtual machines which is also what DigitalOcean uses.

This article from 2007 suggests you may even want to increase it in some cases (when you have a lot of inactive jobs waiting to be run), and force kernel to more aggressively find unused memory pages that it can swap to the disk. This AskUbuntu answer has a good explanation on what swappiness means: a setting of 60 means that at 40% usage kernel will attempt to find inactive pages to swap, and a setting of 10 means that at 90% usage kernel will attempt to find inactive pages to swap. Wikipedia also has an article, which sadly does little to explain the actual mechanisms.

A better solution would be to force MySQL and Apache2 to use appropriate amounts of RAM (and abide by some absolute limits, such as 196mb+196mb). But that’s something I’ll play with on another day… there are more important things to work on right now. 😉