PF_LLC sockets working code on 2.6.17

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

The simple code to listen to LLC I'm trying to make work follows below.

Thanks in advance.
Evandro Clivatti Dall'Agnol

#include <sys/socket.h>

/* for LLC sockets */
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <linux/llc.h>

#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>

#ifndef AF_LLC
#define AF_LLC		26
#define PF_LLC		AF_LLC
#endif

#ifndef SOL_LLC
#define SOL_LLC		268

int main(int argc, char **argv) {
	int ret;
	int sock;
	struct sockaddr_llc localaddr;

	memset(&localaddr, 0, sizeof(localaddr));

	localaddr.sllc_family = AF_LLC;
	localaddr.sllc_sap = LLC_SAP_NULL;
	localaddr.sllc_arphrd = ARPHRD_ETHER;

	if( (sock = socket(PF_LLC, SOCK_STREAM, 0)) < 0){
		perror("socket");
		return sock;
	}
	
	if( (ret = bind(sock, (struct sockaddr *)&localaddr, sizeof(localaddr))) < 0 ){
		perror("bind");
		close(sock);
		return ret;
	}

	if( (ret = listen(sock, 10)) < 0 ){
		perror("listen");
		return ret;
	}
	return 0;
}
-
: 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

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux