wg-quick: make sure we have empty table for both v6 and v4
Otherwise, we wind up not doing the right thing in the v6-only case, or doing something totally borked when v4 and v6 are filled unevenly. Reported-by: Roelf Wichertjes <contact@roelf.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
		
							parent
							
								
									fbf715ea45
								
							
						
					
					
						commit
						1b5234f3d5
					
				@ -141,7 +141,9 @@ DEFAULT_TABLE=
 | 
				
			|||||||
add_default() {
 | 
					add_default() {
 | 
				
			||||||
	if [[ -z $DEFAULT_TABLE ]]; then
 | 
						if [[ -z $DEFAULT_TABLE ]]; then
 | 
				
			||||||
		DEFAULT_TABLE=51820
 | 
							DEFAULT_TABLE=51820
 | 
				
			||||||
		while [[ -n $(ip route show table $DEFAULT_TABLE) ]]; do ((DEFAULT_TABLE++)); done
 | 
							while [[ -n $(ip -4 route show table $DEFAULT_TABLE) || -n $(ip -6 route show table $DEFAULT_TABLE) ]]; do
 | 
				
			||||||
 | 
								((DEFAULT_TABLE++))
 | 
				
			||||||
 | 
							done
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	local proto=-4 src ip
 | 
						local proto=-4 src ip
 | 
				
			||||||
	if [[ $1 == *:* ]]; then
 | 
						if [[ $1 == *:* ]]; then
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user