소스 검색

BTap: on Windows, don't write frames without an Ethernet header

ambrop7 15 년 전
부모
커밋
5c4b7f0d09
1개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 9 6
      tuntap/BTap.c

+ 9 - 6
tuntap/BTap.c

@@ -304,12 +304,15 @@ void input_handler_send (BTap *o, uint8_t *data, int data_len)
     
     #ifdef BADVPN_USE_WINAPI
     
-    if (!try_send(o, data, data_len)) {
-        // write pending
-        o->input_packet = data;
-        o->input_packet_len = data_len;
-        BReactor_EnableHandle(o->reactor, &o->input_bhandle);
-        return;
+    // ignore frames without an Ethernet header, or we get errors in WriteFile
+    if (data_len >= 14) {
+        if (!try_send(o, data, data_len)) {
+            // write pending
+            o->input_packet = data;
+            o->input_packet_len = data_len;
+            BReactor_EnableHandle(o->reactor, &o->input_bhandle);
+            return;
+        }
     }
     
     #else