net: check for TUNSETOFFLOAD support before trying to enable offload features
This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message on kernels without TUNSETOFFLOAD support. Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
							parent
							
								
									6720b35b81
								
							
						
					
					
						commit
						2e50326c44
					
				| @ -131,6 +131,11 @@ void tap_fd_set_offload(int fd, int csum, int tso4, | |||||||
| { | { | ||||||
|     unsigned int offload = 0; |     unsigned int offload = 0; | ||||||
| 
 | 
 | ||||||
|  |     /* Check if our kernel supports TUNSETOFFLOAD */ | ||||||
|  |     if (ioctl(fd, TUNSETOFFLOAD, 0) != 0 && errno == EINVAL) { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     if (csum) { |     if (csum) { | ||||||
|         offload |= TUN_F_CSUM; |         offload |= TUN_F_CSUM; | ||||||
|         if (tso4) |         if (tso4) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Pierre Riteau
						Pierre Riteau