GARP packets not sent out for interfce up - linux

I am working custom platform based on x86_64 running 3.10 kernel,
Recently I found an issue related to GARP. It seems like no GARP
packets are being sent out when an Interface is made up. But I also
noticed that only when I use "arping" tool only then it sends out any
GARP packet.
I also try setting the net variable "arp_notify" then I see the
arp_send() function is being called after that I am unable to track
further.
Could you please help me, what could be issue, Is it a valid
expectation that during interface up the linux kernel should send out
GARP packet? If so, am I missing any kernel configuration related to
it?
Thanks in Advance.

Related

zeroconf implementation on an embedded linux system

I have an embeeded system that I like to add zeroconf to it. The aim is:
Auto assign an IP to itself if there is no dhcp available.
It respond to mdns request and identify itself correctly.
It responds to dns-ds and broadcast its capability correctly.
Is there any library that can help me on this?
I found Avahi (http://avahi.org/) but it seems there is no development on it for some years. Is it still a good solution?
My device has Linux 2.x on it.
Avahi seems to be the de-facto standard implementation of Zeroconf for Linux and it is used pretty much everywhere. The last release is from 2012 but this does not mean it is dead -- it may just mean that it is mature and stable enough and there has been no need for additional releases yet.

how to configure the gpio.h file in order to request for irq

I am using the LPC1788 evb cortex board manufactured by emcraft.
In that the linux source which is provided along with the board is not configured for IRQ.
this I came to know by seeing the /mach-board/mach/gpio.h file. but in my project I need to control the device using interrupts.
I am creating my custom device driver and the driver is unable to get IRQ number, as according to me this is due to gpio.h file I feel.Please guide me to over come this issue.
thanks
any suggestion and links for reference are much needful to me.

Best way to inject packets into linux kernel to emulate ethernet packet arrival

I am writing a linux kernel module for some tunnelling activity. The module will get packets from the networking stack and perform some operations on it. What is the best possible way to inject packets into the stack from the bottom(emulate ethernet packet arrival on wire) so that the packet traverses the entire receive path and is delivered to my module.
My module uses the kernel br_handle_frame_hook hook to get the packet which means that it cannot co-reside with the linux native bridge module. Any ideas will be appreciated.
Consider using NetFilter
http://www.phrack.org/issues.html?issue=61&id=13
TAP would be great, if you're working in user space, which you're not
I believe that TAP device is what you are looking for - a nice way to send/receive Ethernet packets from user-space
I recommend tap like #raber before me. I also recommend reading this excelet tutorial: http://backreference.org/2010/03/26/tuntap-interface-tutorial/ .
You asked whether you can make the tap non-programatically and then replay traffic into it. The answer is yes. Look for the 'persistency' options (which b.t.w. can also be done programatically with a short tool you can write yourself if you prefer not to download tools that can already do it). You may also want/need to define the user that may use the tap (or otherwise just sudo your operations).

How to debug the network stack in linux

I am trying to inject a packet into the network using raw sockets, but somehow can't seem to get a receiver to capture this packet. How do i check whether the packet is being dropped by the linux network stack? Could someone point out some tools for doing this?
I don't know about accessing the network stack directly (not saying it's impossible, just that I don't know how to do it if you can), but you could probably use Wireshark or something similar to see if the NIC on the receiving end is receiving the packets. You could also use it on the sending end to check if the packets are being sent out properly (or are actually being sent out in the first place, if that's the issue), as it allows you to examine the fields/etc. of individual packets. Quite a useful tool, really.
http://www.wireshark.org/
Note that the website doesn't have direct downloads for Linux builds, but does list third-party packages for various Linux distros.
Options include wireshark and tcpdump, or tcpdumping into a pcap file and then analyzing that using wireshark. One option probably is also to use strace or similar tool to trace the system calls that do the sending.
Another option is to use BPF to instrument the TCP stack in the kernel. You can take a look at some of the already existent scripts for TCP, e.g. tcplife:
https://github.com/iovisor/bcc/blob/master/tools/tcplife.py
http://manpages.ubuntu.com/manpages/bionic/man8/tcplife-bpfcc.8.html
http://www.brendangregg.com/blog/2016-11-30/linux-bcc-tcplife.html

Implementing a kernel debugging module for a Linux guest OS inside a VmWare VM

Sorry for the rather long post.
I need some input regarding a project that I am going to undertake.
I am trying to make an application that collects kernel debugging information from a guest Linux OS, located inside a VmWare Virtual Machine, and send them to a host OS efficiently.
So far, I have found a similar project, but written for Windows[1].
The author of the project wrote a DLL that is loaded into memory, and replaces the implementation of the KdSendPacket and KdReceivePacket functions, to use the VmWare GuestRpc[2] mechanism, instead of the slow serial port.
The data are then send to a debugging application on the host(Kd or WinDbg) trough a named pipe.
The author claims that there is a speed-up up to 45%, by avoiding the serial port transmission.
I am trying to achieve something similar ,but for Linux, and try to make the debugging process a little faster, than using the serial port.
My concrete questions are :
Do any similar applications exist?
I didn't manage to find any.
Would such an application be worth it ,comparing its functionality to netconsole[3], for example?
What method of intercepting printk messages would you suggest ?
Is there an equivalent of KdSendPacket/KdReceivePacket on Linux ?
[1]. http://virtualkd.sysprogs.org/dox/operation.html
[2]. http://articles.sysprogs.org/kdvmware/guestrpc.shtml
[3]. http://www.kernel.org/doc/Documentation/networking/netconsole.txt
Using the serial port is really suboptimal.. even the (virtual) network would be preferable to that, but getting back to host-guest IPC channels, VMware's VMCI comes to mind.
many approaches can use to achieve your goal, below methods can be applied if network is connected:
use syslog service and transfer log though network to your server:
syslogd, syslogng seems support sending log to a log server with some filter critiera.
directly call tcp/udp socket functions in your kernel module to sends your collected data back to server.
other approaches, you may write application on host machine that calls hypervisor's share memory access function to read the memory buffer of your kernel module. However, the xen/kvm hypervisor both support these apis and i am not sure about weather vmware have this kind of library.

Resources