[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Manual assignment of mac address for tap interface

2014-08-14 9:52 GMT+01:00 Anil Madhavapeddy <anil@xxxxxxxxxx>:
On 12 Aug 2014, at 15:58, Hwanju Kim <Hwanju.Kim@xxxxxxxxxxxx> wrote:

> Hi,
> I've been playing with mirage-skeleton/static_website with unix backend and tap interface.
> I wonder if there is a right way of assigning a specific mac address to a mirage instance.
> What I want right now is to run multiple instances with different mac addresses using tap interface.
> I saw in mirage-net-unix a mac address is assigned randomly, but with the same seed by default makes all mac addresses the same.

This would certainly be very useful, and we might as well make the MAC mutable at the same time.

I've started the patch here; https://github.com/mirage/mirage-net-unix/pull/8

We also need to modify the type of `devname` to become a tuple of (string, string option) to become the (interface name and mac). This requires a rev of mirage-types, but that can just go into the mirage 2.0-trunk with the other ARM changes.

Cool! I will keep my eyes on it.

One thing that would be helpful is exposing a set_mac interface in ocaml-tuntap -- if you look at tuntap_stubs.c, the C functions for MacOS X and Linux need to use the relevant SIOCSIFHWADDR ioctl to set it as well. Once that's exposed in the tuntap bindings, we can set the rest.

The set interface of Netif is straightforward. Regarding tuntap, however, I wonder what situation makes a tap device also need a specific mac address. I thought they act as a link to each mirage guest and the Netif of a guest is the one that reacts ARP requests. (in addition, multiple taps have different mac addresses already).


> I just tweaked it by adding, in the static_website's main.ml generated by mirage tool, Random.init <a different seed> before Netif.connect "tap0" to get different an address, but I am sure this is not a proper way. Is there any way to do it? (I know that manual assignment of mac address is doable with xen backend).

Once the right functions are available in the tuntap/mirage-net-* libraries, we can just plumb it through directly into the mirage CLI.


MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.