wg-quick: linux: only touch net.ipv4 for v4
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
		
							parent
							
								
									cf7ec31d2d
								
							
						
					
					
						commit
						a59aa6c404
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -194,9 +194,11 @@ add_default() {
 | 
				
			||||||
	cmd ip $proto route add "$1" dev "$INTERFACE" table $table
 | 
						cmd ip $proto route add "$1" dev "$INTERFACE" table $table
 | 
				
			||||||
	cmd ip $proto rule add not fwmark $table table $table
 | 
						cmd ip $proto rule add not fwmark $table table $table
 | 
				
			||||||
	cmd ip $proto rule add table main suppress_prefixlength 0
 | 
						cmd ip $proto rule add table main suppress_prefixlength 0
 | 
				
			||||||
 | 
						if [[ $proto == -4 ]]; then
 | 
				
			||||||
		while read -r key _ value; do
 | 
							while read -r key _ value; do
 | 
				
			||||||
			[[ $value -eq 1 ]] && sysctl -q "$key=2"
 | 
								[[ $value -eq 1 ]] && sysctl -q "$key=2"
 | 
				
			||||||
		done < <(sysctl -a -r '^net\.ipv4.conf\.[^ .=]+\.rp_filter$')
 | 
							done < <(sysctl -a -r '^net\.ipv4.conf\.[^ .=]+\.rp_filter$')
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue