1 year, 8 months ago.

Using MAC filter with MeshInterface (Thread Mesh)

Hello guys,

i am working with the Mbed Thread Stack to build wireless sensor networks. Now I need the possibility to filter nodes (maybe based on their MAC address) so they can not communicate with each other, even if there are in range. I need this to set up a certain topology. I found the mac_filter_api.h which looks promising:


To call the mac_filter_start ()-function I need an Interface_ID. Sadly my mesh-interface (https://os.mbed.com/docs/mbed-os/v5.13/mbed-os-api-doxy/class_mesh_interface.html) doesnt support the ".get_network_id()".

MeshInterface *mesh;

Starting MAC-filter with interface-id set to 0, 1, 2 .. dont cause any error but doesnt show any effect eigther. I'm using the standard "mesh-minimal-example" (https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal/), which is set up to use the Thread Stack.

Does anyone have another idea how to block nodes?

Best regards, Sebastian

1 Answer

1 year, 8 months ago.

Hello Sebastian,

You get Network interface ID when you create / start network. It is different than network ID. Interface ID is for that purpose that you have more than one mesh network in the same device - practically newer used. Because you have only one interface = Thread, it is most probably number 1. You can try that meanwhile I will try to find a correct way to find it out.

Regards, Pekka

Hello Pekka,

thanks for your infos. Nevertheless the filter isnt working. Not with Interface_ID 1, 0, 2 or 42. This is my code to set the filter up:

uint8_t MAC1[8] = {0xf4, 0xce, 0x36, 0x8a, 0xcc,0x4a, 0x0e, 0xef};

uint8_t MAC2[8] = {0xf4, 0xce, 0x36, 0x49, 0x94 ,0x8b, 0xdf, 0xb9};

int8_t IntID = 1;

printf("%d\n", mac_filter_start(IntID, MAC_FILTER_BLOCKED));

printf("%d\n", mac_filter_add_long(IntID, MAC1, MAC_FILTER_BLOCKED));

printf("%d\n", mac_filter_add_long(IntID, MAC2, MAC_FILTER_BLOCKED));

The "printf()" displays me a 0 to the CLI, so there should be no Errors. (>0: Error)

Regards, Sebastian

posted by Sebastian Miethe 23 Sep 2019