arping | specific IP address on the LAN is 'taken ' and what MAC | TCP library

 by   ThomasHabets C Version: Current License: GPL-2.0

kandi X-RAY | arping Summary

kandi X-RAY | arping Summary

arping is a C library typically used in Networking, TCP applications. arping has no bugs, it has no vulnerabilities, it has a Strong Copyleft License and it has low support. You can download it from GitHub.

Arping is a util to find out if a specific IP address on the LAN is 'taken' and what MAC address owns it. Sure, you could just use 'ping' to find out if it's taken and even if the computer blocks ping (and everything else) you still get an entry in your ARP cache. But what if you aren't on a routable net? Or the host blocks ping (all ICMP even)? Then you're screwed. Or you use arping.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              arping has a low active ecosystem.
              It has 321 star(s) with 59 fork(s). There are 28 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 7 open issues and 33 have been closed. On average issues are closed in 590 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of arping is current.

            kandi-Quality Quality

              arping has 0 bugs and 0 code smells.

            kandi-Security Security

              arping has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              arping code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              arping is licensed under the GPL-2.0 License. This license is Strong Copyleft.
              Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.

            kandi-Reuse Reuse

              arping releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of arping
            Get all kandi verified functions for this library.

            arping Key Features

            No Key Features are available at this moment for arping.

            arping Examples and Code Snippets

            No Code Snippets are available at this moment for arping.

            Community Discussions

            QUESTION

            Why is sendto returning zero with raw sockets?
            Asked 2022-Jan-11 at 23:42

            The following program uses a PF_PACKET socket to send a TCP SYN packet to web server read from a file which is a list of web server IPv4 addresses - one address per line. The code is quite long because it takes a lot of code to obtain the gateway router MAC and IP address necessary for filling in the ethernet and IP headers. The good news is you can just skip all the functions in the preamble and just go to main which is where the problem is.

            My program works perfectly for the first iteration of the while loop in main. Here is the output:

            ...

            ANSWER

            Answered 2022-Jan-11 at 23:42

            If you are going to use PACKET_TX_RING, then you must play by its rules: that means you can't use the same buffer spot over and over: you must advance to the next buffer location within the ring buffer: build the first packet in slot 0, the second in slot 1, etc. (wrapping when you get to the end of the buffer).

            But you're building every packet in slot 0 (i.e. at ps_header_start) but after sending the first packet, the kernel is expecting the next frame in the subsequent slot. It will never find the (second) packet you created in slot 0 until it has processed all the other slots. But it's looking at slot 1 and seeing that the tp_status in that slot hasn't been set to TP_STATUS_SEND_REQUEST yet so... nothing to do.

            Note that your sendto call is not providing a buffer address to the kernel. That's because the kernel knows where the next packet will come from, it must be in the next slot in the ring buffer following the one you just sent.

            This is why I suggested in your other question that you not use PACKET_TX_RING unless you really need it: it's more complicated to do correctly. It's much easier to just create your frame in a static buffer and call sendto(fd, buffer_address, buffer_len, ...). And if you are going to call sendto for each created frame, there is literally no advantage to using PACKET_TX_RING anyway.

            Source https://stackoverflow.com/questions/70660468

            QUESTION

            Why is my non blocking raw sockets program running so slowly?
            Asked 2022-Jan-11 at 20:59

            I have a program which uses PF_PACKET raw sockets to send TCP SYN packets to a list of web servers. The program reads in a file which has an IPv4 address on each line of a web server. The program is the beginnings of an attempt to connect to multiple servers in a high performance manner. However, currently the program is only sending about 10 packets/second. This despite the program using non blocking socket. It should be running orders of magnitude faster. Any ideas why it could be running so slowly.

            I include a full code listing below. Warning - the code is quite long. That's because it takes a surprisingly large amount of code to get the IP and MAC address of the gateway router. The good news is you can skip all the functions before main because they just do the necessary work of getting the IP and MAC address of the router as well as the local IP address. Anyway, here's the code:

            ...

            ANSWER

            Answered 2022-Jan-11 at 20:59

            If I follow the code correctly, you're redoing a ton of work for every IP address that doesn't need to be redone. Every time through the main loop you're:

            • creating a new packet socket
            • binding it
            • setting up a tx packet ring buffer
            • mmap'ing it
            • sending a single packet
            • unmapping
            • closing the socket

            That's a huge amount of work you're causing the system to do for one packet.

            You should only create one packet socket at the beginning, set up the tx buffer and mmap once, and leave it open until the program is done. You can send any number of packets through the interface without closing/re-opening.

            This is why your top time users are setsockopt, mmap, unmap, etc. All of those operations are heavy in the kernel.

            Also, the point of PACKET_TX_RING is that you can set up a large buffer and create one packet after another within the buffer without making a send system call for each packet. By using the packet header's tp_status field you're telling the kernel that this frame is ready to be sent. You then advance your pointer within the ring buffer to the next available slot and build another packet. When you have no more packets to build (or you've filled the available space in the buffer [i.e. wrapped around to your oldest still-in-flight frame]), you can then make one send/sendto call to tell the kernel to go look at your buffer and (start) sending all those packets.

            You can then start building more packets (being careful to ensure they are not still in use by the kernel -- through the tp_status field).

            That said, if this were a project I were doing, I would simplify a lot - at least for the first pass: create a packet socket, bind it to the interface, build packets one at a time, and use send once per frame (i.e. not bothering with PACKET_TX_RING). If (and only if) performance requirements are so tight that it needs to send faster would I bother setting up and using the ring buffer. I doubt you'll need that. This should go a ton faster without the excess setsockopt and mmap calls.

            Finally, a non-blocking socket is only useful if you have something else to do while you're waiting. In this case, if you have the socket set to be non-blocking and the packet can't be sent because the call would block, the send call will fail and if you don't do something about that (enqueue the packet somewhere, and retry later, say), the packet will be lost. In this program, I can't see any benefit whatsoever to using a non-blocking socket. If the socket blocks, it's because the device transmit queue is full. After that, there's no point in you continuing to produce packets to be sent, you won't be able send those packets either. Much simpler to just block at that point until the queue drains.

            Source https://stackoverflow.com/questions/70644332

            QUESTION

            How to build the resultant docker image file directory?
            Asked 2021-Dec-20 at 17:41

            I have the following Dockerfile:

            ...

            ANSWER

            Answered 2021-Dec-05 at 23:05

            Does it make sense to iterate through layers like this and keep adding files (to some target, does not matter for now) and deleting the added files in case they are found with a .wh prefix? Or am I totally off and is there a much better way?

            There is a much better way, you do not want to reimplement (with worse performances) what Docker already does. The main reason is that Docker uses a mount filesystem called overlay2 by default that allows the creation of images and containers leveraging the concepts of a Union Filesystem: lowerdir, upperdir, workdir and mergeddir.

            What you might not expect is that you can reproduce an image or container building process using the mount command available in almost any Unix-like machine.

            I found a very interesting article that explains how the overlay storage system works and how Docker internally uses it, I highly recommend the reading.

            Actually, if you have read the article, the solution is there: you can mount the image data you have by docker inspecting its LowerDir, UpperDir, WorkDir and by setting the merged dir to a custom path. To make the process simpler, you can run a script like:

            Source https://stackoverflow.com/questions/70176754

            QUESTION

            meson: determine running tests as root
            Asked 2021-Nov-12 at 05:41

            In tests for ping from iputils certain tests should fail for non-root but pass for root. Thus I need a detection whether user running tests is root or not. Current code:

            ...

            ANSWER

            Answered 2021-Nov-12 at 05:41

            This is really a case for skipping rather than expected failure. It would be easy to wrap your tests in a small shell or python script that checks the effective UID and returns the magic exit code 77 (which meson interprets as skip)

            Something like:

            Source https://stackoverflow.com/questions/69901167

            QUESTION

            Can't import Scapy arping() method
            Asked 2021-Nov-05 at 20:56
            from scapy.layers.l2 import arping
            from scapy.all import *
            
            def scan(ip):
                scapy.layers.l2.arping(ip)
            
            scan('192.168.0.1')
            
            ...

            ANSWER

            Answered 2021-Nov-05 at 20:56

            If you import as you have there, you'd use the name arping directly:

            Source https://stackoverflow.com/questions/69828422

            QUESTION

            ARP packets with scapy are unanswered
            Asked 2021-Jan-07 at 19:07

            I'm building a network scanner with Python using Scapy. I've been trying to send ARP packets but for some reason they don't get responded to.

            ...

            ANSWER

            Answered 2021-Jan-07 at 19:07

            arp_request/broadcast is incorrect. The outer-most protocols go on the left. If you use Wireshark to see what's going on (the first thing you should do when something like this happens), you can see that it's not what you'd expect it to be:

            It's essentially a malformed packet. You need broadcast / arp_request; although specifying the Ether layer is optional. You can use simply ARP (and sr).

            Use Wireshark. It's an invaluable tool. You should only run it on networks that you have control over/permission to snoop, but it really is indispensable.

            Source https://stackoverflow.com/questions/65618296

            QUESTION

            Android init service error invalid keyword 'u:object_r:system_file:s0
            Asked 2020-Jan-13 at 15:40

            I want to run a service on few tablets (VONINO NAVO P) that they will serve as a photo frame for digital ads. What i'm trying to achieve is to run some commands at boot and i'm stuck. I have created digitalads.rc in system/etc/init which will execute /system/bin/digitalads.sh from where i need to run some commands like:

            ...

            ANSWER

            Answered 2020-Jan-13 at 15:40

            It seems your .rc files misses the seclabel keyword. Your service declaration should look like this:

            Source https://stackoverflow.com/questions/59708831

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install arping

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/ThomasHabets/arping.git

          • CLI

            gh repo clone ThomasHabets/arping

          • sshUrl

            git@github.com:ThomasHabets/arping.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular TCP Libraries

            masscan

            by robertdavidgraham

            wait-for-it

            by vishnubob

            gnet

            by panjf2000

            Quasar

            by quasar

            mumble

            by mumble-voip

            Try Top Libraries by ThomasHabets

            simple-tpm-pk11

            by ThomasHabetsC++

            ssh-scripts

            by ThomasHabetsPython

            injcode

            by ThomasHabetsC++

            cmdg

            by ThomasHabetsGo

            monotonic_clock

            by ThomasHabetsC