Re: libiptc, arptables, ebtables plans or so - and header files

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

 



On Monday 2008-11-10 19:53, Rick Jones wrote:

> For some reason, perhaps only to have my daily emily litella moment, the
> discussion of abstraction is reminding me of struct sockaddr_storage vs an IPv4
> or IPv6 sockaddr.

If you have worked with sockets you probably now.
Even though there is a struct/union sockaddr_storage,
you still end up duplicating all the code:

	struct sockaddr_storage p;
	if (af == PF_INET) {
		struct sockaddr_in *q = (void *)&p;
		p->sin_family = PF_INET;
		p->sin_port = htons(1234);
		inet_pton(PF_INET, host, &p->sin_addr);
	} else {
		struct sockaddr_in6 *q = (void *)&p;
		p->sin6_family = PF_INET6;
		p->sin6_port = htons(1234);
		inet_pton(PF_INET6, host, &p->sin6_addr);
	}

it illustrates the problem with libiptc even better than libiptc itself.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux