Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6248805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:07:35+00:00 2026-05-24T13:07:35+00:00

Please don’t criticise the solution. It’s not my design and yes, it sucks. On

  • 0

Please don’t criticise the solution. It’s not my design and yes, it sucks.

On a computer running Linux, and using C, we need to verify that a TCP connection made to a process is from the same machine. Doing it by IP address is problematic since the OS is generating two IP addresses and the process only knows one. Anyway, verifying by IP address is a bit poor.

We want to do the verification by comparing the “remote” MAC address to the local MAC address. We already get the local MAC address. All I need to know is how to get the “remote” MAC address. It’s in the packet that gets sent when forming the connection (and in all subsequent ones too). How do we drag it out of the ethernet layer?

Before anyone says this again, I KNOW you cannot get the MAC address of the remote host if it’s not on the same subnet/LAN. That’s fine. Presumably we’ll get something like 00:00:00:00:00:00 and since that is different to the local MAC address it will be different – just what we want.

—

So, to summarise, we have a TCP connection socket fd, we’ve received a data packet, how do we then find the MAC address of the remote host, the MAC address that was in the packet’s header?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:07:36+00:00Added an answer on May 24, 2026 at 1:07 pm

    If I understand correctly, you are not trying to tell remote machines apart, but to use the idea that the source and destination MAC would match on traffic sent from a machine to itself in order to allow only local traffic.

    This seems rather roundabout, and has been pointed out, insecure.

    A somewhat better idea might be to have the TCP client listen only on the loopback interface (127.0.0.1) and not on INADDR_ANY. Or go a step further and use a unix-domain socket instead of a TCP one (a common method used by X servers today to prevent the possibility of remote connections)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: Using a 3rd party tab system is not an option so please don't
I'm working on a web crawler (please don't suggest an existing one, it's not
I am using Visual Basic 6 (please don't laugh), and I would like to
I'm sort of a newbie--please don't hate. The method compiles, but I'm not sure
I'm a real newbie regarding mod_rewrite so please don't laugh. I am using this
I'm using the HTML5 pattern attribute for client side validation (please don't tell me
I'm extremely new to using jQuery/JavaScript, so please don't judge me if this is
Some stupid question about DOM, please don't hate me For some reasons I need
Important: we really need the stated functionality, so please don't start suggesting alternatives. We're
Please don't confuse with the title as it was already asked by someone but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.