npfext_route.c revision 1.1 1 1.1 joe /*-
2 1.1 joe * Copyright (c) 2025 The NetBSD Foundation, Inc.
3 1.1 joe * All rights reserved.
4 1.1 joe *
5 1.1 joe * This code is derived from software contributed to The NetBSD Foundation
6 1.1 joe * by Emmanuel Nyarko.
7 1.1 joe *
8 1.1 joe * Redistribution and use in source and binary forms, with or without
9 1.1 joe * modification, are permitted provided that the following conditions
10 1.1 joe * are met:
11 1.1 joe * 1. Redistributions of source code must retain the above copyright
12 1.1 joe * notice, this list of conditions and the following disclaimer.
13 1.1 joe * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 joe * notice, this list of conditions and the following disclaimer in the
15 1.1 joe * documentation and/or other materials provided with the distribution.
16 1.1 joe *
17 1.1 joe * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 1.1 joe * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 1.1 joe * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 1.1 joe * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 1.1 joe * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 1.1 joe * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 1.1 joe * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 1.1 joe * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 1.1 joe * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 1.1 joe * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 1.1 joe * POSSIBILITY OF SUCH DAMAGE.
28 1.1 joe */
29 1.1 joe
30 1.1 joe #include <sys/cdefs.h>
31 1.1 joe __RCSID("$NetBSD: npfext_route.c,v 1.1 2026/04/08 00:33:06 joe Exp $");
32 1.1 joe
33 1.1 joe #include <sys/types.h>
34 1.1 joe #include <sys/socket.h>
35 1.1 joe #include <sys/ioctl.h>
36 1.1 joe #include <net/if.h>
37 1.1 joe
38 1.1 joe #include <stdio.h>
39 1.1 joe #include <string.h>
40 1.1 joe #include <assert.h>
41 1.1 joe #include <errno.h>
42 1.1 joe #include <err.h>
43 1.1 joe #include <unistd.h>
44 1.1 joe
45 1.1 joe #include <npf.h>
46 1.1 joe
47 1.1 joe int npfext_route_init(void);
48 1.1 joe nl_ext_t * npfext_route_construct(const char *);
49 1.1 joe int npfext_route_param(nl_ext_t *, const char *, const char *);
50 1.1 joe
51 1.1 joe int
52 1.1 joe npfext_route_init(void)
53 1.1 joe {
54 1.1 joe /* Nothing to initialise. */
55 1.1 joe return 0;
56 1.1 joe }
57 1.1 joe
58 1.1 joe nl_ext_t *
59 1.1 joe npfext_route_construct(const char *name)
60 1.1 joe {
61 1.1 joe assert(strcmp(name, "route") == 0);
62 1.1 joe return npf_ext_construct(name);
63 1.1 joe }
64 1.1 joe
65 1.1 joe int
66 1.1 joe npfext_route_param(nl_ext_t *ext, const char *param, const char *val __unused)
67 1.1 joe {
68 1.1 joe assert(param != NULL);
69 1.1 joe npf_ext_param_string(ext, "route-interface", param);
70 1.1 joe return 0;
71 1.1 joe }
72