raw socket compile error under FreeBSD

E

estantep

Hi,

I have been struggling and googling with no success. I am trying to
code a program to use raw sockets under FreeBSD, but I am getting the
following error when running cc:

$ cc raw.c
raw.c:28: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '.' token
raw.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '.' token


#define SRC_IP "1.1.1.1"

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/igmp.h>
#include <netinet/igmp_var.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <string.h>

/*#include <arpa/inet.h>*/

#define BUF_LEN 1400

int my_socket;
char buffer[BUF_LEN];
struct ip *iph = (struct ip *) buffer;

struct sockaddr_in s_in;
s_in.sin_family = PF_INET; /* line 28 */
s_in.sin_addr.s_addr = inet_addr(SRC_IP); /* line 29 */
/* eof */
Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top