Community discussions

MikroTik App
 
majbthrd
just joined
Topic Author
Posts: 17
Joined: Tue Jan 31, 2012 9:17 pm

demo MetaROUTER image to crash RouterOS (with source code)

Mon Oct 10, 2016 4:40 am

This describes a way to cause MetaROUTER to crash RouterOS (either watchdog reset or sometimes it requires a power cycle to start working again).

A few years ago, I created a tiny MetaROUTER image that readily crashed MetaROUTER, and this test image allowed Mikrotik to make some bug fixes to MetaROUTER in RouterOS. See this old forum thread for details if interested.

truly minimal packet-processing MetaROUTER image
http://forum.mikrotik.com/viewtopic.php?t=58936

I dug up that same source code recently to see if MetaROUTER was more mature.

As I wrote more code, I found that I still could make RouterOS crash. Sometimes it watchdog resets, but other times the Ethernet ports stop working and it just hangs.

Testing was done with a hEX PoE lite running v6.37.1, which is the Current stable release.

What the test image should do is just respond to pings, but it also causes RouterOS to die.

I've provided complete source code here (see subdirectory "metaDIE"):

https://github.com/majbthrd/MetaROUTER-apps

There is also a "test.tgz" file in that subdirectory that is a pre-compiled MetaROUTER image.

The test procedure is:

Standard default configuration (NAT eth2-eth5 to masquerade through eth1).

Use a PC connected to one of the NAT ports (eth2-eth5) that configure the Mikrotik and can ping.

Upload the MetaROUTER image to RouterOS "Files" using the method of your choice.

Create a virtual Ethernet interface:

/interface virtual-ethernet add
/interface virtual-ethernet print

Note/write-down: interface name (vif2) and number (2)

Enable that interface:

/interface virtual-ethernet enable 2

Assign static IP address to that interface:

/ip address add interface=vif2 address=192.168.0.1/24

Import the file you uploaded:

/metarouter import-image file-name=test.tgz memory-size=8
/metarouter print

Note/write-down: VM name (mr2) and number (0)

Import enables MetaROUTER image, so disable it:

/metarouter disable 0

/metarouter interface add virtual-machine=mr2 static-interface=vif2
/metarouter interface print

Note/write-down: MAC-ADDRESS (02:1B:7E:B1:B7:E2) of newly created interface

Create an ARP entry for that MetaROUTER interface using an IP address on the same network subnet as the IP address created for the vif interface:

/ip arp add interface=vif2 mac-address=02:1B:7E:B1:B7:E2 address=192.168.0.100

From the point that you enable the MetaROUTER instance, RouterOS will eventually become unstable.

So, only proceed to the next step with care.

From an external PC whose traffic the Mikrotik will route (such as connected to eth2-eth5 on a normal NAT configuration), start:

ping 192.168.0.100

Then, enable the MetaROUTER instance:

/metarouter enable 0

You'll see responses to the ping, and then they will stop.

Mikrotik RouterOS behavior is one of two scenarios:

1) Watchdog reset ("ERROR: Internal Server Error" on WebFig). After a while, the ping responses will resume, and then it will go offline again.

2) all Ethernet ports will turn off (although the LEDs on the RouterBoard remain on), and then nothing happens. In this case, it has to be power-cycled.
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: demo MetaROUTER image to crash RouterOS (with source code)

Wed Oct 12, 2016 12:46 pm

Please send e-mail to support@mikrotik.com, either pointing them at this thread or repeating it for them in the form of an e-mail. They might not see this forum post, and I'm sure there are a lot of people who would appreciate seeing this bug fixed. As a MetaROUTER user, thanks again for going to such lengths to isolate and reproduce the issue with such precision.

-- Nathan
 
majbthrd
just joined
Topic Author
Posts: 17
Joined: Tue Jan 31, 2012 9:17 pm

Re: demo MetaROUTER image to crash RouterOS (with source code)

Wed Oct 12, 2016 6:04 pm

Thanks, Nathan. I've tried submitting a ticket to see if that does anything.
 
sup5
Member
Member
Posts: 359
Joined: Sat Jul 10, 2010 12:37 am

Re: demo MetaROUTER image to crash RouterOS (with source code)

Wed Oct 12, 2016 9:26 pm

Hi majbthrd,

can you create a metarouter with two interfaces that simply forwards any traffic from interface one to interface two?
That might be in form of a bridge, or even better like a kind of a virtual-wire: ie. transmitting each received frame from port 1 to port 2 and vice versa.

This could help in lots of weird configuration, that require connecting bridges, aquiring multiple DHCP-Adresses etc.
 
majbthrd
just joined
Topic Author
Posts: 17
Joined: Tue Jan 31, 2012 9:17 pm

Re: demo MetaROUTER image to crash RouterOS (with source code)

Wed Oct 12, 2016 9:43 pm

Hi sup5,

yes, I'm hoping configurations like those could be possible... but only if MetaROUTER was stable.

I think there are a lot of potential uses.

Unfortunately, the source code I provided shows that RouterOS will crash easily.