Coder Social home page Coder Social logo

mitm0's Introduction

mitm0: Man-in-the-middle another Linux network driver Build Status

A concise example of how a NDIS intermediate-like driver on Linux may be implemented. Net device operations are forwarded to the micromanaged network driver. Incoming packets enter the driver first as well before they are passed to the networking stack.

mitm0 (formerly μman) uses the same mechanisms as the Linux switching API to control/mitm/micro-manage a single network interface.

How to use

You can read/write /sys/kernel/debug/mitm0/slave to set the slave interface (echo > /sys/kernel/debug/mitm0/slave to free slave).

Why not use pcap?

pcap does passive sniffing. mitm0 allows for mangling/dropping traffic as well. Even if you don't mangle traffic, using mitm0 to implement your protocol in kernelspace has a tangible effect on latency:

rpi-pollreq-pollres

Figure shows the reaction times of the openPOWERLINK stack when run in userspace using pcap and when run in kernelspace using a mitm-based driver. This was measured on a Raspberry Pi 3 with Linux v4.9 and the PREEMPT_RT patchset. The measurement took an hour, cycle frequency was 200Hz and hackbench was running in the background.

Copyright and License

Copyright (C) 2018 Ahmad Fatoum

This kernel module is free software; you can redistribute it and/or modify it under the same terms as Linux itself. See the accompanying COPYING file for more information.

mitm0's People

Contributors

a3f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

koudis

mitm0's Issues

The macro mitm_slave() does not return a pointer to struct slave

The macro mitm_slave() is used as if it returns a point to 'struct slave'. It returns a pointer to 'struct net_device' instead.

The type was changed on Jan 13 with a commit called 'Use netdevice where appropriate'.

In mitm_master_upper_dev_link(), slave_dev rather than slave is now used as the 3rd argument of netdev_master_upper_dev_link().

A point to struct slave is a pointer to a pointer to the slave_dev, so not the same as a point to net_device.

Thanks

uman0 not seen as master

Hi,

Using busybox ifenslave, the uman0 device is not seen as a master. The ifenslave code is checking IFF_MASTER on uman0.

~# ifenslave uman0 eth0.2
ifenslave: uman0 is not a master
~# 

I'm assuming that ifenslave is correct and that uman0 should be a master.
Appologies if this is not a bug in uman.

Also, my understanding is that an interface may be enslaved either with ifenslave or via
echo "eth0.2" > /sys/kernel/debug/uman0/slave

I'm unclear of the difference, if any.

Thanks

uman_set_carrier() might set carrier down when slave is present

If the carrier is on when entering uman_set_carrier() then it will be off when leaving.

Thanks

_// Assume slave exists and carrier on_
static int uman_set_carrier(struct uman *uman)
{
    struct slave *slave = uman_slave(uman);
    VERBOSE_LOG_FUNENTRY();
    if (!slave)
        goto down;
    _// This condition not true_
    if (!netif_carrier_ok(uman->dev)) {
        netif_carrier_on(uman->dev);
        return 1;
    }
down:
    _// This condition true_
    if (netif_carrier_ok(uman->dev)) {
        _// Carrier set off_
        netif_carrier_off(uman->dev);
        return 1;
    }
    return 0;
}
`..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.