View Issue Details

IDProjectCategoryView StatusLast Update
0003192GNUnetportabilitypublic2013-12-24 19:53
Reportershedatc Assigned ToChristian Grothoff Due Date
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformFreeBSDOSFreeBSDOS Version9.2
Product VersionGit master 
Target Version0.10.0Fixed in Version0.10.0 
Summary0003192: FreeBSD: EINVAL returned by sendto() in the client NAT helper
DescriptionOn FreeBSD the IP packet length must be flipped. From PR kern/21737:

An IPPROTO_RAW socket, set with IP_HDRINCL option via setsockopt,
won't let any raw packet out and return EINVAL. This is due to the
fact that FreeBSD kernel uses flipped ip_len to speed up handling,
where the user just supplied a htons'ed one.

Then, a check in rip_output() forbids the case where :

ip->ip_len < m->m_pkthdr.len

A user supplied IP header is seen as 10240 bytes long and denied.
Additional InformationPatch raw-ip-pkt-len.patch is against r31267.
TagsNo tags attached.
Attached Files
raw-ip-pkt-len.patch (847 bytes)   
Index: src/nat/gnunet-helper-nat-client.c
===================================================================
--- src/nat/gnunet-helper-nat-client.c	(revision 31267)
+++ src/nat/gnunet-helper-nat-client.c	(working copy)
@@ -237,7 +237,11 @@
   off = 0;
   ip_pkt.vers_ihl = 0x45;
   ip_pkt.tos = 0;
+#ifdef FREEBSD
+  ip_pkt.pkt_len = sizeof (packet); /* Workaround PR kern/21737 */
+#else
   ip_pkt.pkt_len = htons (sizeof (packet));
+#endif
   ip_pkt.id = htons (PACKET_ID);
   ip_pkt.flags_frag_offset = 0;
   ip_pkt.ttl = 128;
@@ -334,7 +338,11 @@
   off = 0;
   ip_pkt.vers_ihl = 0x45;
   ip_pkt.tos = 0;
+#ifdef FREEBSD
+  ip_pkt.pkt_len = sizeof (packet); /* Workaround PR kern/21737 */
+#else
   ip_pkt.pkt_len = htons (sizeof (packet));
+#endif
   ip_pkt.id = htons (PACKET_ID);
   ip_pkt.flags_frag_offset = 0;
   ip_pkt.ttl = IPDEFTTL;
raw-ip-pkt-len.patch (847 bytes)   

Activities

Christian Grothoff

2013-12-10 22:14

manager   ~0007832

Fixed in SVN 31270 (as suggested). Thanks!!!

Issue History

Date ModifiedUsernameFieldChange
2013-12-10 21:08shedatcNew Issue
2013-12-10 21:08shedatcFile Added: raw-ip-pkt-len.patch
2013-12-10 22:14Christian GrothoffNote Added: 0007832
2013-12-10 22:14Christian GrothoffStatusnew => resolved
2013-12-10 22:14Christian GrothoffFixed in Version => 0.10.0
2013-12-10 22:14Christian GrothoffResolutionopen => fixed
2013-12-10 22:14Christian GrothoffAssigned To => Christian Grothoff
2013-12-10 22:14Christian GrothoffTarget Version => 0.10.0
2013-12-24 19:53Christian GrothoffStatusresolved => closed