What's new

Asuswrt GPL Question

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

sbsnb

Very Senior Member
I noticed that Asus' networkmap.c has some code that is cut and pasted from libpcap (even the comments), yet Asus does not supply the sources. I know the BSD license doesn't require distributing the sources, but my understanding was that when you mixed GPL and BSD licenses it required the GPL to apply to the whole. Since a lot of the Asuswrt firmware package is GPL, doesn't that any BSD licensed code also has to be GPL? Is it because networkmap is a standalone executable that GPL doesn't apply to it?

Example from libpcap pcap-linux.c:
Code:
iface_get_id(int fd, const char *device, char *ebuf)
{
struct ifreq ifr;

memset(&ifr, 0, sizeof(ifr));
pcap_strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));

if (ioctl(fd, SIOCGIFINDEX, &ifr) == -1) {
pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
errno, "SIOCGIFINDEX");
return -1;
}

return ifr.ifr_ifindex;
}

/*
* Bind the socket associated with FD to the given device.
* Return 0 on success or a PCAP_ERROR_ value on a hard error.
*/
static int
iface_bind(int fd, int ifindex, char *ebuf, int protocol)
{
struct sockaddr_ll sll;
int ret, err;
socklen_t errlen = sizeof(err);

memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_ifindex = ifindex < 0 ? 0 : ifindex;
sll.sll_protocol = protocol;

if (bind(fd, (struct sockaddr *) &sll, sizeof(sll)) == -1) {
if (errno == ENETDOWN) {
/*
* Return a "network down" indication, so that
* the application can report that rather than
* saying we had a mysterious failure and
* suggest that they report a problem to the
* libpcap developers.
*/
return PCAP_ERROR_IFACE_NOT_UP;
}
if (errno == ENODEV)
ret = PCAP_ERROR_NO_SUCH_DEVICE;
else
ret = PCAP_ERROR;
pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
errno, "bind");
return ret;
}

/* Any pending errors, e.g., network is down? */

if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) {
pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
errno, "getsockopt (SO_ERROR)");
return PCAP_ERROR;
}

if (err == ENETDOWN) {
/*
* Return a "network down" indication, so that
* the application can report that rather than
* saying we had a mysterious failure and
* suggest that they report a problem to the
* libpcap developers.
*/
return PCAP_ERROR_IFACE_NOT_UP;
} else if (err > 0) {
pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
err, "bind");
return PCAP_ERROR;
}

return 0;
}
static int

And Asus' networkmap.c:
Code:
iface_get_id(int fd, const char *device)
{
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
if (ioctl(fd, SIOCGIFINDEX, &ifr) == -1) {
perror("iface_get_id ERR:\n");
return -1;
}

return ifr.ifr_ifindex;
}
/*
* Bind the socket associated with FD to the given device.
*/
static int
iface_bind(int fd, int ifindex)
{
int err;
socklen_t errlen = sizeof(err);

memset(&src_sockll, 0, sizeof(src_sockll));
src_sockll.sll_family = AF_PACKET;
src_sockll.sll_ifindex = ifindex;
src_sockll.sll_protocol = htons(ETH_P_ARP);

if (bind(fd, (struct sockaddr *) &src_sockll, sizeof(src_sockll)) == -1) {
perror("bind device ERR:\n");
return -1;
}
/* Any pending errors, e.g., network is down? */
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) {
return -2;
}
if (err > 0) {
return -2;
}
int alen = sizeof(src_sockll);
if (getsockname(fd, (struct sockaddr*)&src_sockll, (socklen_t *)&alen) == -1) {
perror("getsockname");
exit(2);
}
if (src_sockll.sll_halen == 0) {
printf("Interface is not ARPable (no ll address)\n");
exit(2);
}
dst_sockll = src_sockll;

return 0;
}
static int
 
BTW. The networkmap code you quoted was the open source version from the old code base. The current closed source version is here which presumably doesn't contain any of that code.
 
Right. I had to because that's the only available source that I know of.
 
noticed that Asus' networkmap.c has some code that is cut and pasted from libpcap (even the comments), yet Asus does not supply the sources. I know the BSD license doesn't require distributing the sources, but my understanding was that when you mixed GPL and BSD licenses it required the GPL to apply to the whole.

But networkmap isn't GPL, it's proprietary.
 
But networkmap isn't GPL, it's proprietary.
That's my question. Firmware like this is a complex licensing issue because of all the binaries with mixed licenses and how those libraries and applications interact. I'm just trying to understand how the final licensing is supposed to work.
 
I'm just trying to understand how the final licensing is supposed to work.

I don't think a specific licence can be applied to the product as a whole, as it's made of several totally separate components, with their own licences. But you'd have to hire a team of lawyers to go through this question and come up with any final, legal answer.

This is the point where I feel like licensing in general is going off the rails. The initial goal behind licensing was to protect people against work theft and abuse. When it turns into a topic for rhetorical debates (going borderline religious with some GPL fanatics), then it's becoming more a problem than an actual solution, especially for hobbyist developers like me who don't employ a full-time lawyer who can analyse and explain every single dot and comma within a licence.

My personal rule there is to go with common sense, and respect the work of others. I cannot pretend to be able to fully understand all the BS that is written in any licence agreement published out there. I am more interested in respecting others than going zealously religious about enforcing every single dash and dot written in some cryptic write up written by overpaid lawyers.

The same problem occurs with EULAs. Nobody reads them, because a) nobody but a lawyer can understand them, and b) they are unenforceable. Did you know that the Adobe EULA requires you to uninstall any Adobe products (like Flash Player or Acrobat Reader) before you give away a computer? It was one of these beauties that came up when someone started analyzing a few EULAs to see how much unenforceable content could be found in them.

So personally, the bottom line is: I have respect for the developers, not for the lawyer. :)
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top