coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
516 stars 258 forks source link

enable-ssdp incompatible with enable-ieee8021q #470

Open colinmcfarlane opened 5 years ago

colinmcfarlane commented 5 years ago

The enable-ssdp compile option includes code in chilli to turn each ssdp multicast packet into multiple unicast packets. This works well and enables a host running chilli to also have miniupnpd running alongside. Without this the ssdp multicast packets are dropped by chilli. Without vlans enabled this code works as expected. I wrote the ssdp patches many years ago.

When the enable-ieee8021q flag is also enabled chilli generates an error in the ssdp code. This is caused by the multicast packets not having a vlan tag and therefore the header being too small (2bytes rather than 18 bytes). It comes from the following bit of code in dhcp.c

LINE 5634 } } else { size_t hdrlen = sizeofeth2(tag); if (pb->offset < hdrlen) { syslog(LOG_ERR, "bad buffer off=%d hdr=%d", (int) pb->offset, (int) hdrlen); return 0; } pkt_buffer_grow(pb, hdrlen); packet = pkt_buffer_head(pb); length = pkt_buffer_length(pb);

I am keen to enhance the ssdp code to support vlans, especially since I wrote it but I am struggling to work out from the code whether I can find the vlan tag for each connected address and how to extend the packet to accommodate it. Any help would be appreciated.