[2/5] device: add new function device_is_vti6

Message ID 1520187899-5759-2-git-send-email-jonatan.schlag@ipfire.org
State Accepted
Commit bcba5d275fe29d0b23b544f3a88138ab264f7380
Headers
Series [1/5] ip-tunnel: add new function |

Commit Message

Jonatan Schlag March 5, 2018, 5:24 a.m. UTC
  This functions checks if a device is a vti6 device.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 src/functions/functions.device | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Patch

diff --git a/src/functions/functions.device b/src/functions/functions.device
index 2de1ad9..a04111e 100644
--- a/src/functions/functions.device
+++ b/src/functions/functions.device
@@ -286,6 +286,14 @@  device_is_vti() {
 	[ "${type}" = "768" ] && return ${EXIT_OK} || return ${EXIT_ERROR}
 }
 
+device_is_vti6() {
+	local device=${1}
+
+	local type=$(__device_get_file ${device} type)
+
+	[ "${type}" = "769" ] && return ${EXIT_OK} || return ${EXIT_ERROR}
+}
+
 device_get_phy() {
 	local device="${1}"