Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am receiving following warnings while compiling my code using gcc.

rawsocket.c:90: warning: cast to pointer from integer of different size
rawsocket.c:91: warning: cast to pointer from integer of different size



C#
unsigned char* CreateEthernetHeader(char *src_mac, char *dst_mac, int protocol)
{
        struct ethhdr *ethernet_header;


        ethernet_header = (struct ethhdr *)malloc(sizeof(struct ethhdr));
   ----> memcpy(ethernet_header->h_source, (void *)ether_aton(src_mac), 6);
   ----> memcpy(ethernet_header->h_dest, (void *)ether_aton(dst_mac), 6);
        ethernet_header->h_proto = htons(protocol);
        return ((unsigned char *)ethernet_header);
}




problomatic lines are shown as ---->
Posted
Comments
[no name] 15-May-15 22:58pm    
What's struct ethhdr?
Richard MacCutchan 16-May-15 4:58am    
Try casting to a unsigned char* rather than void* on the return from ether_aton.
markkuk 17-May-15 17:24pm    
Have you included the header file <netinet/ether.h> where ether_aton() is declared?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900