mvc: add isLinkLocal() for #6775

This commit is contained in:
Franco Fichtner 2023-09-21 15:12:47 +02:00
parent 79355e3641
commit e29a4e009d

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2017-2022 Deciso B.V.
* Copyright (C) 2017-2023 Deciso B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -62,6 +62,16 @@ class Util
return !empty(filter_var($address, FILTER_VALIDATE_IP));
}
/**
* is provided address an link-locak IPv6 address.
* @param string $address network address
* @return boolean
*/
public static function isLinkLocal($address)
{
return !!preg_match('/^fe[89ab][0-9a-f]:/i', $address);
}
/**
* is provided address a mac address.
* @param string $address network address