libnet_write_link

"Gisle Vanem" <[email protected]> Thu, 3 Jun 2004 18:39:16 +0200
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>
If one tries to send a larger than MTU packet with WinPcap, the PacketSendPacket
function will fail and nothing will be sent. IMHO it's quite allright to truncate a 
frame to 1514 or whatever the MTU is. LAN-drivers to this all the time I think.

What do you think? It easy to query the NDIS interface for the MTU;

static int get_interface_mtu (ADAPTER *adapter, DWORD *mtu)
{
  struct {
    PACKET_OID_DATA oidData;
    DWORD mtu;
  } oid;

  memset (&oid, 0, sizeof(oid));
  oid.oidData.Oid = OID_GEN_MAXIMUM_TOTAL_SIZE;
  oid.oidData.Length = sizeof(oid);

  if (!PacketRequest(adapter, FALSE, &oid.oidData))
     return (FALSE);
  *mtu = *(DWORD*) &oid.oidData.Data;
  return (1);
}

--------

I fell the victim for this "bug" in an older verion of tcptraceroute, but that's fixed
in recent versions.

--gv