diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2011-09-28 08:14:41 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2011-09-28 08:14:41 +0000 |
commit | 1e26c29b778d4cac65ea2a83f6089e22fe8f8421 (patch) | |
tree | 779b14ae51eee4ed5bde82d3600b03a260319632 /misc.c | |
parent | c00cf9e642bae52ddf629123ecd72ca32d6157d8 (diff) |
Notes
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.84 2010/11/21 01:01:13 djm Exp $ */ +/* $OpenBSD: misc.c,v 1.85 2011/03/29 18:54:17 stevesk Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2005,2006 Damien Miller. All rights reserved. @@ -985,6 +985,19 @@ parse_ipqos(const char *cp) return val; } +const char * +iptos2str(int iptos) +{ + int i; + static char iptos_str[sizeof "0xff"]; + + for (i = 0; ipqos[i].name != NULL; i++) { + if (ipqos[i].value == iptos) + return ipqos[i].name; + } + snprintf(iptos_str, sizeof iptos_str, "0x%02x", iptos); + return iptos_str; +} void sock_set_v6only(int s) { |