In the below code, is it necessary to add the ethernet header to the buffer I am sending through sendto?
"#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include <sys/types.h>
#include <sys/socket.h> 
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <net/if.h>
#include <netinet/ether.h>
#include <time.h>

#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BINARY(byte) \
  ((byte) & 0x80 ? '1' : '0'), \
  ((byte) & 0x40 ? '1' : '0'), \
  ((byte) & 0x20 ? '1' : '0'), \
  ((byte) & 0x10 ? '1' : '0'), \
  ((byte) & 0x08 ? '1' : '0'), \
  ((byte) & 0x04 ? '1' : '0'), \
  ((byte) & 0x02 ? '1' : '0'), \
  ((byte) & 0x01 ? '1' : '0') 



#define BUFFERLEN sizeof(struct iphdr) + sizeof(struct DNSQuery) + sizeof(struct ethhdr)


struct DNSQuery {
    uint16_t id;
    uint8_t msgType_numQueries;
    char queries[8][32];
};

struct DNSResponse {
    uint16_t id;
    uint8_t msgType_numResponses;
    struct {
        uint8_t valid;
        struct in_addr ip;
    } responses[8];
};


int main()
{
    srand(time(NULL));
    struct iphdr iptop, *temp;
    struct DNSQuery simq, *q;
    struct in_addr saddr, daddr;
    iptop.protocol =254;
    iptop.ttl = (64);
    iptop.id = htons(rand() % 0x7FFF);
    iptop.version = 4;
    iptop.frag_off = htons(0);;
    iptop.ihl = 5;
    iptop.tos = 0;
    iptop.tot_len = htons(BUFFERLEN);;
    

    int fd, err;
    struct ifreq ifr;
    char *iface = "wlo1";
    unsigned char *mac;

    fd = socket(AF_INET, SOCK_DGRAM, 0);

    ifr.ifr_addr.sa_family = AF_INET;
    strncpy(ifr.ifr_name , iface , IFNAMSIZ-1);

    err = ioctl(fd, SIOCGIFHWADDR, &ifr);
    if(err < 0)
    {
        perror("ioctl");
        return -1;
    }
    close(fd);
    
    mac = (unsigned char *)ifr.ifr_hwaddr.sa_data;

    printf("MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n" , mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);

    struct ethhdr ethtop, *ethe;
    for(int i = 0; i<ETH_ALEN; ++i)
    {
        ethtop.h_dest[i]=mac[i];
        ethtop.h_source[i]=mac[i];
    }
    printf("Src MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n" , ethtop.h_source[0], ethtop.h_source[1], ethtop.h_source[2], ethtop.h_source[3], ethtop.h_source[4], ethtop.h_source[5]);

    printf("Dest MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n" , ethtop.h_dest[0], ethtop.h_dest[1], ethtop.h_dest[2], ethtop.h_dest[3], ethtop.h_dest[4], ethtop.h_dest[5]);
    ethtop.h_proto = htons(0x0800);
    printf("Size of Ethernet Header is: %d\n",sizeof(struct ethhdr ));

    int sockfd, i, j, one = 1,n, strl;
    void* transform;
    struct sockaddr_in servaddr, cliaddr;
    socklen_t len = sizeof(cliaddr);
    sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
    if(sockfd <= 0)
    {
        perror("Socket creation failed");
        exit(EXIT_FAILURE);
    }
    cliaddr.sin_family = AF_INET;
    cliaddr.sin_port = htons(8181);
    inet_aton( "127.0.0.1", &cliaddr.sin_addr);
    iptop.saddr = htonl(cliaddr.sin_addr.s_addr);
    saddr.s_addr = iptop.saddr;
    printf("%s\n",inet_ntoa(saddr));

    servaddr.sin_family = AF_INET;
    servaddr.sin_port = htons(8182);
    inet_aton( "127.0.0.1", &servaddr.sin_addr);
    iptop.daddr = htonl(servaddr.sin_addr.s_addr);
    daddr.s_addr = iptop.daddr;
    printf("%s\n",inet_ntoa(daddr));


    printf("IP HEADER VALUES:\n");
    printf("IP Version = %d, IP IHL = %d, IP Total_len = %d,\n IP Id = %d, IP Fragoffset = %d,\nIP TTL = %d, IP Protocol = %d, \n IP Srcaddr = %s ,\n IP Destaddr = %s\n",iptop.version, iptop.ihl, iptop.tot_len, iptop.id, iptop.frag_off, iptop.ttl, iptop.protocol, inet_ntoa(saddr), inet_ntoa(daddr));
            


    // err = bind(sockfd, (struct sockaddr *)&cliaddr, len);
    // if(err < 0)
    // {
    //     perror("Socket binding failed");
    //     exit(EXIT_FAILURE);
    // }
    char buffer[BUFFERLEN + 1], query[10], dname[29], dnshead[sizeof(struct DNSQuery) + 1], iphead[21],  dnsq[sizeof(struct DNSQuery) + 1], ethhead[sizeof(struct ethhdr) + 1];

    setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &one, sizeof(one));
    while(1)
    {
        printf("Enter query type: ");
        scanf("%s",query);
        if(strncmp(query, "EXIT",4*sizeof(char)) == 0)
        {
            printf("Exiting...\n");
            shutdown(sockfd, SHUT_RDWR);
            close(sockfd);
            exit(EXIT_SUCCESS);
        }
        else if(strncmp(query, "getIP",5*sizeof(char)))
            continue;
        printf("Enter number of domains: ");
        scanf("%d",&n);
        if(n > 8)
        {
            printf("Too many domain names. Cannot process.\n");
            continue;
        }
        
        simq.id = htons(rand());
        simq.msgType_numQueries = 0b10000000;
        simq.msgType_numQueries |= (n << 4);

        //Taking the domain names as input from the user
        for(i = 0; i < n; ++i)
        {
            bzero(dname,29*sizeof(char));
            printf("Enter %d th domain name:",i);
            scanf("%s",dname);
            if((strlen(dname) <= 28))
            {
                strl = strlen(dname);
                strncpy(simq.queries[i] + 4*sizeof(char),dname,strl);
                simq.queries[i][3] |= strl;
                printf(" The dns name is: ");
                for(j = 4; j<4 + strl; ++j)
                {
                    printf("%c",simq.queries[i][j]);
                }
                printf("\nTis begineth at place %d",simq.queries[i]);
                
                printf("\n The length of dns name is: ");
                int x = 0;
                x |= simq.queries[i][3];
                printf("%d\n",x);

            }
            else
            {
                printf("Detected invalid entry. Nullifying");
                bzero(simq.queries[i],32* sizeof(char));
            }
    }
    for(;i<8;++i)
    {
        bzero(simq.queries[i], 32*sizeof(char));
    }

    //copying ip header and dnsquery header to buffer
    memcpy(buffer + sizeof(struct iphdr) + sizeof(struct ethhdr), &simq, sizeof(struct DNSQuery));

    memcpy(buffer + sizeof(struct ethhdr), &iptop, sizeof(struct iphdr));

    memcpy(buffer, &ethtop,  sizeof(struct ethhdr));

    printf("The msgtype and Numquery: ");
    printf(BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(simq.msgType_numQueries));
    printf("\n");
    printf("Sending...\n");   
    int bytes_send = sendto(sockfd, buffer, BUFFERLEN, 0, (struct sockaddr*)&servaddr, len);
    printf("Sent %d bytes\n\n",bytes_send);
    if(bytes_send < 0)
    {
        perror("Erroneous send");
    }
    int count;
    ioctl(sockfd, FIONREAD, &count);
    printf("The amount of data on the socket is %d\n",count);
    //printing buffer to ensure correct values
            memcpy(ethe, buffer, sizeof(struct ethhdr));

            printf("bufferized Src MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n" , ethe->h_source[0], ethe->h_source[1], ethe->h_source[2], ethe->h_source[3], ethe->h_source[4], ethe->h_source[5]);

            printf("bufferized Dest MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n" , ethe->h_dest[0], ethe->h_dest[1], ethe->h_dest[2], ethe->h_dest[3], ethe->h_dest[4], ethe->h_dest[5]);
    
            memcpy(iphead, buffer + sizeof(struct ethhdr), sizeof(struct iphdr));
            transform = (void*)iphead;
            temp = (struct iphdr*)transform;
            iptop = *temp;
            saddr.s_addr = iptop.saddr;
            daddr.s_addr = iptop.daddr;
            printf("IP Version = %d, IP IHL = %d, IP Total_len = %d,\n IP Id = %d, IP Fragoffset = %d,\nIP TTL = %d, IP Protocol = %d, \n IP Srcaddr = %s ,\n IP Destaddr = %s \n",iptop.version, iptop.ihl, iptop.tot_len, iptop.id, iptop.frag_off, iptop.ttl, iptop.protocol, inet_ntoa(saddr), inet_ntoa(daddr));
            
            memcpy(dnsq, buffer + sizeof(struct iphdr) + sizeof(struct ethhdr), sizeof(struct DNSQuery));
            transform = (void*)dnsq;
            q = (struct DNSQuery*)transform;
            int a, b, c,x = 0,y;
            a = q->id;
            b = (q->msgType_numQueries & 0b10000000)>>7;
            c = (q->msgType_numQueries & 0b01110000)>>4;
            printf("DNSHead ID = %d, \nDNSHead MsgType = %d, \nDNSHead NumQueries = %d\n",a,b,c);
            for(i = 0 ;i < c ; ++i)
            {
                x = 0;
                printf("\n");
                x |= (int)q->queries[i][3];
                printf("The %d th domain name with size %d is:\n",i,x);
                for(j = 4; j < 4 + x; ++j)
                {
                    printf("%c",q->queries[i][j]);
                }
                printf("\n");
            }
            
    }
    printf("Jackadder\n");
    return 0;
}"