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 7642763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:16:20+00:00 2026-05-31T09:16:20+00:00

I am attempting to find the MAC address using pcap for a small project.

  • 0

I am attempting to find the MAC address using pcap for a small project. As of right now the structure I am working with looks like this:

    struct ethernet_header
    {
         u_char dhost[6];
         u_char shost[6];
         u_short type;
    };

The call int the code simply loosk like:

    void get_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet)
    {
         const struct ethernet_header *ethernet;
         const struct ip_header *ip;
         ethernet = (struct ethernet_header *)(packet);
         ip = (struct ip_header *)(packet + 16);

         printf("Destination MAC: %s\n", ethernet->dhost);
    }

The error I am receiveing is

error: dereferencing pointer to incomplete type

Now as far as I know the packet var is being initalized properly because it is being used in other sections of the code without a problem. In the case of the ip struct, this also works fine with no errors. I know what is being loaded into that particluar address I just can’t figure out whats going on. Anyone have any ideas.

  • 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-31T09:16:21+00:00Added an answer on May 31, 2026 at 9:16 am

    error: dereferencing pointer to incomplete type

    You missed including the header file which defines struct ethernet_header in the c file which has the function void get_packet().

    The error is because the compiler cannot see the definition of the structure, most likely you are just forward declaring it. However, Since you dereference the pointer to structure the compiler must know the layout of the structure and hence must see the definition of the structure.

    So just include it You need to include the header file which contains the definition of the structure in this particular c file.

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

Sidebar

Related Questions

I'm attempting to get google-toolbox-for-mac working with my existing XCode 3.2 iPad project, but
I've been attempting to find / do this for a week now and I
I am attempting to find a binary file in a Linux system using something
I'm writing a Clojure implementation of this coding challenge , attempting to find the
I am attempting to find a place to start debugging this issue at. I
I am attempting to find 'entries' create today (in my current timezone) using the
Using reflection, I'm attempting to find the set of types which inherit from a
I am attempting to find a way to take synthesized speech and record it
For the last few days I have been attempting to find a method to
Okay, so what I'm attempting to do is find out the name of the

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.