@@ -34,6 +34,8 @@ typedef struct _hostif_info_t
34
34
35
35
volatile bool run_thread;
36
36
37
+ std::string name;
38
+
37
39
} hostif_info_t ;
38
40
39
41
std::map<std::string, std::shared_ptr<hostif_info_t >> hostif_info_map;
@@ -194,18 +196,32 @@ void veth2tap_fun(std::shared_ptr<hostif_info_t> info)
194
196
195
197
if (size < 0 )
196
198
{
197
- SWSS_LOG_ERROR (" failed to read from socket %d" , info->packet_socket );
198
- break ;
199
+ SWSS_LOG_ERROR (" failed to read from socket fd %d, errno(%d): %s" ,
200
+ info->packet_socket , errno, strerror (errno));
201
+
202
+ continue ;
199
203
}
200
204
201
205
// TODO examine packet for mac and possible generate fdb_event
202
206
203
207
if (write (info->tapfd , buffer, size) < 0 )
204
208
{
205
- SWSS_LOG_ERROR (" failed to write to tap device %d" , info->tapfd );
206
- break ;
209
+ /*
210
+ * We filter out EIO because of this patch:
211
+ * https://github.com/torvalds/linux/commit/1bd4978a88ac2589f3105f599b1d404a312fb7f6
212
+ */
213
+
214
+ if (errno != ENETDOWN && errno != EIO)
215
+ {
216
+ SWSS_LOG_ERROR (" failed to write to tap device fd %d, errno(%d): %s" ,
217
+ info->tapfd , errno, strerror (errno));
218
+ }
219
+
220
+ continue ;
207
221
}
208
222
}
223
+
224
+ SWSS_LOG_NOTICE (" ending thread proc for %s" , info->name .c_str ());
209
225
}
210
226
211
227
void tap2veth_fun (std::shared_ptr<hostif_info_t > info)
@@ -222,17 +238,22 @@ void tap2veth_fun(std::shared_ptr<hostif_info_t> info)
222
238
223
239
if (size < 0 )
224
240
{
225
- SWSS_LOG_ERROR (" failed to read from tapfd: %d" , info->tapfd );
241
+ SWSS_LOG_ERROR (" failed to read from tapfd fd %d, errno(%d): %s" ,
242
+ info->tapfd , errno, strerror (errno));
226
243
227
- break ;
244
+ continue ;
228
245
}
229
246
230
247
if (write (info->packet_socket , buffer, (int )size) < 0 )
231
248
{
232
- SWSS_LOG_ERROR (" failed to write to socker %d" , info->packet_socket );
233
- break ;
249
+ SWSS_LOG_ERROR (" failed to write to socket fd %d, errno(%d): %s" ,
250
+ info->packet_socket , errno, strerror (errno));
251
+
252
+ continue ;
234
253
}
235
254
}
255
+
256
+ SWSS_LOG_NOTICE (" ending thread proc for %s" , info->name .c_str ());
236
257
}
237
258
238
259
bool hostif_create_tap_veth_forwarding (
@@ -295,6 +316,7 @@ bool hostif_create_tap_veth_forwarding(
295
316
info->run_thread = true ;
296
317
info->e2t = std::make_shared<std::thread>(veth2tap_fun, info);
297
318
info->t2e = std::make_shared<std::thread>(tap2veth_fun, info);
319
+ info->name = tapname;
298
320
299
321
info->e2t ->detach ();
300
322
info->t2e ->detach ();
0 commit comments