When tunnel doesn't PONG, ask to check firewall

This commit is contained in:
nemunaire 2023-03-18 10:42:29 +01:00
parent 8a2405e508
commit 94ed539e01
2 changed files with 14 additions and 0 deletions

View File

@ -371,6 +371,14 @@ func studentChecker(std *adlin.Student, also_check_matrix bool, offline bool) {
})
if err != nil && verbose {
log.Printf("%s: Unable to perform ping to %s: %s", std.Login, stdIP, err.Error())
if tunnel_version, err := minTunnelVersion(std, tun.SuffixIP); err == nil {
if has_test(CheckMap[tunnel_version], Firewalled) {
if e, err := std.GetChallengeError(CheckMap[tunnel_version][Firewalled]); err == nil && len(e.Error) > 0 {
std.RegisterChallengeError(CheckMap[tunnel_version][Firewalled], fmt.Errorf("Your host is unreachable, no more tests are performed. Check that you are not filtering the tunnel (Wireguard uses UDP datagrams), nor ICMPv6 as your host needs to respond to PING."))
}
}
}
}
}
}

View File

@ -135,6 +135,12 @@ func (s *Student) GetStates() (ucs []*UnlockedChallenge, err error) {
}
}
func (s *Student) GetChallengeError(challenge_id int) (uc *ErroredChallenge, err error) {
uc = new(ErroredChallenge)
err = DBQueryRow("SELECT id_st, challenge, time, error FROM student_challenge_errors WHERE id_student = ? AND challenge = ?", s.Id, challenge_id).Scan(&uc.Id, &uc.Challenge, &uc.Time, &uc.Error)
return
}
func (s *Student) GetChallengeErrors() (ucs []*ErroredChallenge, err error) {
if rows, errr := DBQuery("SELECT id_st, challenge, time, error FROM student_challenge_errors WHERE id_student = ?", s.Id); errr != nil {
return nil, errr