Can someone explain the weird behavior I'm seeing from the
program below??
When the program is run, if you ping the IP address from the
local machine, it sees packets. However, if you ping it from
a remote machine, it doesn't see packets.
This is on a 3.4-REL machine.. it also happens on a 4.0-current
machine built on approx Feb. 2.
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <err.h>
int
main(int ac, char *av[])
{
struct sockaddr_in a;
u_char buf[8192];
int r, s;
memset(&a, 0, sizeof(a));
a.sin_family = AF_INET;
a.sin_len = sizeof(a);
if (ac != 2 || inet_aton(av[1], &a.sin_addr) == 0)
errx(1, "Usage: stest ipaddr");
if ((s = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP)) == -1)
err(1, "socket");
if (bind(s, (struct sockaddr *)&a, sizeof(a)) == -1)
err(1, "bind");
while ((r = read(s, buf, sizeof(buf))) > 0)
printf("Rec'd %d byte packet\n", r);
if (r != 0)
err(1, "read");
return (0);
}
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message