2 * Copyright (C) 2009 Luigi Rizzo, Marta Carbone, Universita` di Pisa
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * $Id: glue.c 4051 2009-11-16 11:30:05Z luigi $
29 * Userland functions missing in linux
36 /* dummy nat functions */
38 ipfw_show_nat(int ac, char **av)
40 fprintf(stderr, "%s unsupported\n", __FUNCTION__);
44 ipfw_config_nat(int ac, char **av)
46 fprintf(stderr, "%s unsupported\n", __FUNCTION__);
51 int optreset; /* missing in linux */
54 #if defined( __linux__ ) || defined(_WIN32)
56 * not implemented in linux.
57 * taken from /usr/src/lib/libc/string/strlcpy.c
60 strlcpy(char *dst, const char *src, size_t siz)
66 /* Copy as many bytes as will fit */
67 if (n != 0 && --n != 0) {
69 if ((*d++ = *s++) == 0)
74 /* Not enough room in dst, add NUL and traverse rest of src */
77 *d = '\0'; /* NUL-terminate dst */
82 return(s - src - 1); /* count does not include NUL */
86 /* missing in linux and windows */
88 strtonum(const char *nptr, long long minval, long long maxval,
91 return strtoll(nptr, (char **)errstr, 0);
95 sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp,
100 #endif /* __linux__ || _WIN32 */