Re: PF_LLC sockets working code on 2.6.17

From: Stephen Hemminger
Date: Wed Aug 02 2006 - 14:22:23 EST


On Wed, 2 Aug 2006 14:12:11 -0300
"Evandro Clivatti Dall'Agnol" <evandrocd@xxxxxxxxx> wrote:

> Hi all, sorry if this question has another more pertinent list to
> send, but I guess this is the one.
>
> I'm trying to use PF_LLC sockets on 2.6.17 based on llcping examples
> of the now gone www.linux-sna.org (http://www.vanheusden.com/sna/old/)
> but I'm not getting success.
>
> Specifically, the bind() command returns < 0 and perror returns "No
> such device".
>
> Since that code was working apparently only with patches for 2.4
> series, does anybody knows another place I can get working examples of
> PF_LLC for 2.6? Or anybody has a working code?

Since there can be multiple devices in the system and LLC does no routing,
you probably need to bind your application to a specific device mac address.

Something like this would set address to match command line arg.
struct ifreq ifr;
...
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, argv[1], IFNAMSIZ);
if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
fprintf(stderr, "%s: get address failed: %s\n",
argv[1], strerror(errno));
return 1;
}

...
memcpy(localaddr.sllc_mac, ifr.ifr_hwaddr.sa_data, IFHWADDRLEN);
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html