GithubHelp home page GithubHelp logo

Comments (8)

ThomasHabets avatar ThomasHabets commented on June 11, 2024

The generated packet shows up as:

11:51:10.506344 12:34:56:78:9a:bc > ba:98:76:54:32:10, ethertype ARP (0x0806), length 58: Reply 192.168.0.100 is-at 12:34:56:78:9a:bc, length 44

It's been a while since Iooked at the spec, but essentially seems to mean "me".

So it's not so much a bug as a missing feature. "Target" here does intend to mean, and does mean, where to send the ethernet frame. A different address in the ARP reply target field needs a different option.

Did you try -U?

But yes, it's not possible to set that ARP field to something specific at the moment. Maybe it should be, with another option.

from arping.

NatasFX avatar NatasFX commented on June 11, 2024

I've read your code and changed this line: (line 1128 of arping.c)

unsolicited ? (uint8_t*)ethxmas : (uint8_t*)ethnull,

to

unsolicited ? (uint8_t*)ethxmas : send_reply ? dstmac : (uint8_t*)ethnull,

So that when replying, set the target address the same as the destination address; but when not replying (requesting) just let that field be nulls.

image

The image shows the altered code working correctly to set the Target MAC Address, inspected with Wireshark. (You can use wireshark using the original version to see the Target MAC Address is not set using -t, only the Ethernet destination mac)

-U will set all bits on Target MAC Address (Broadcast).

May i open a pull request for this?

from arping.

ThomasHabets avatar ThomasHabets commented on June 11, 2024

Did you try if -U was sufficient? Are you saying it works with your patch, but not with -U?

If that's the case, then yeah a PR sounds good. Place some parenthesis for ease of reading, though.

from arping.

NatasFX avatar NatasFX commented on June 11, 2024

Yes, i works with my patch but not with -U. As i'm replying, it can't be unsolicited because a machine made the request, and i'm replying so i shouldn't be using -U anyways.

Placing -U in the command will set the Target MAC Address as FF:FF:FF:FF:FF:FF, when it should be ba:98...

The code i modified does a simple thing: When -U, Target MAC Address is broadcast. If replying, the Target MAC Address will be the MAC address of the target machine (I've never seen an ARP Reply with Target MAC Address null, so it should be this way). if none then it is a normal request so the field needs to be blank.

If you agree i'll proceed to make a pull request for this. (happy to contribute!)

from arping.

ThomasHabets avatar ThomasHabets commented on June 11, 2024

Yeah, makes sense. I'm only being careful in case someone, somewhere, is relying on it. But sending replies is rare with arping, so Should Be Fineβ„’.

Just the parenthesis thing, and all good.

from arping.

NatasFX avatar NatasFX commented on June 11, 2024

Sounds right. Prolly they don't exist or if they exist, the machine being replied to doesn't check the if the Target MAC Address matches their machine (which is improbable).

About the parenthesis, is this alright to you? Couldn't really figure out exactly how you wanted.
unsolicited ? (uint8_t*)ethxmas : (send_reply ? dstmac : (uint8_t*)ethnull),

from arping.

ThomasHabets avatar ThomasHabets commented on June 11, 2024

Yeah, like that. No need for reader to have to think about operator precedence and associativity.

(PHP's ternary operator is incorrectly associative. Fun fact)

from arping.

NatasFX avatar NatasFX commented on June 11, 2024

Closed this issue by PR #46. Thanks!

from arping.

Related Issues (20)

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.