#
42a2659f |
| 03-Sep-2022 |
thorpej <thorpej@NetBSD.org> |
Garbage-collect everything related to struct domain::dom_ifqueues (except dom_ifqueues itself, until the next kernel version bump). It's no longer used now that nothing uses the legacy netisr mechani
Garbage-collect everything related to struct domain::dom_ifqueues (except dom_ifqueues itself, until the next kernel version bump). It's no longer used now that nothing uses the legacy netisr mechanism.
show more ...
|
#
553d5aba |
| 10-Jan-2018 |
ozaki-r <ozaki-r@NetBSD.org> |
Don't start callouts for domains before attaching domains on rump kernels
On rump kernels, the callouts for domains, pffasttimo and pfslowtimo, started before domains were attached. Normally the cal
Don't start callouts for domains before attaching domains on rump kernels
On rump kernels, the callouts for domains, pffasttimo and pfslowtimo, started before domains were attached. Normally the callouts were dispatched after domain attaches (initializations) finished, however, under load the callouts could be executed prior to the attaches, resulting in that the callouts accessed unallocated or uninitialized resources.
show more ...
|
#
2a682585 |
| 21-Sep-2017 |
ozaki-r <ozaki-r@NetBSD.org> |
Invalidate rtcache based on a global generation counter
The change introduces a global generation counter that is incremented when any routes have been added or deleted. When a rtcache caches a rten
Invalidate rtcache based on a global generation counter
The change introduces a global generation counter that is incremented when any routes have been added or deleted. When a rtcache caches a rtentry into itself, it also stores a snapshot of the generation counter. If the snapshot equals to the global counter, the cache is still valid, otherwise invalidated.
One drawback of the change is that all rtcaches of all protocol families are invalidated when any routes of any protocol families are added or deleted. If that matters, we should have separate generation counters based on protocol families.
This change removes LIST_ENTRY from struct route, which fixes a part of PR kern/52515.
show more ...
|
#
8095e5e7 |
| 22-Apr-2015 |
roy <roy@NetBSD.org> |
Move INET6 specific in6_if_{up,down}() and in6_if_link_{up,down}() into agnostic domain functions.
|
#
bbeb5403 |
| 26-Jun-2011 |
christos <christos@NetBSD.org> |
* Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add
* Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
show more ...
|
#
fa9c652e |
| 31-Mar-2011 |
dyoung <dyoung@NetBSD.org> |
Hide the radix-trie implementation of the forwarding table so that we will have an easier time replacing it with something different, even if it is a second radix-trie implementation.
sys/net/route.
Hide the radix-trie implementation of the forwarding table so that we will have an easier time replacing it with something different, even if it is a second radix-trie implementation.
sys/net/route.c and sys/net/rtsock.c no longer operate directly on radix_nodes or radix_node_heads.
Hopefully this will reduce the temptation to implement multipath or source-based routing using grotty hacks to the grotty old radix-trie code, too. :-)
show more ...
|
#
c5d5f769 |
| 11-Sep-2009 |
dyoung <dyoung@NetBSD.org> |
Make ifconfig(8) set and display preference numbers for IPv6 addresses. Make the kernel support SIOC[SG]IFADDRPREF for IPv6 interface addresses.
In in6ifa_ifpforlinklocal(), consult preference numb
Make ifconfig(8) set and display preference numbers for IPv6 addresses. Make the kernel support SIOC[SG]IFADDRPREF for IPv6 interface addresses.
In in6ifa_ifpforlinklocal(), consult preference numbers before making an otherwise arbitrary choice of in6_ifaddr. Otherwise, preference numbers are *not* consulted by the kernel, but that will be rather easy for somebody with a little bit of free time to fix.
Please note that setting the preference number for a link-local IPv6 address does not work right, yet, but that ought to be fixed soon.
In support of the changes above,
1 Add a method to struct domain for "externalizing" a sockaddr, and provide an implementation for IPv6. Expect more work in this area: it may be more proper to say that the IPv6 implementation "internalizes" a sockaddr. Add sockaddr_externalize().
2 Add a subroutine, sofamily(), that returns a struct socket's address family or AF_UNSPEC.
3 Make a lot of IPv4-specific code generic, and move it from sys/netinet/ to sys/net/ for re-use by IPv6 parts of the kernel and ifconfig(8).
show more ...
|
#
8027ac8f |
| 27-May-2009 |
pooka <pooka@NetBSD.org> |
Make domaininit() take an argument which determines if it should add the special PF_ROUTE domain or not (if available).
|
#
4c9b6756 |
| 19-Sep-2007 |
dyoung <dyoung@NetBSD.org> |
1) Introduce a new socket option, (SOL_SOCKET, SO_NOHEADER), that tells a socket that it should both add a protocol header to tx'd datagrams and remove the header from rx'd datagrams:
1) Introduce a new socket option, (SOL_SOCKET, SO_NOHEADER), that tells a socket that it should both add a protocol header to tx'd datagrams and remove the header from rx'd datagrams:
int onoff = 1, s = socket(...); setsockopt(s, SOL_SOCKET, SO_NOHEADER, &onoff);
2) Add an implementation of (SOL_SOCKET, SO_NOHEADER) for raw IPv4 sockets.
3) Reorganize the protocols' pr_ctloutput implementations a bit. Consistently return ENOPROTOOPT when an option is unsupported, and EINVAL if a supported option's arguments are incorrect. Reorganize the flow of code so that it's more clear how/when options are passed down the stack until they are handled.
Shorten some pr_ctloutput staircases for readability.
4) Extract common mbuf code into subroutines, add new sockaddr methods, and introduce a new subroutine, fsocreate(), for reuse later; use it first in sys_socket():
struct mbuf *m_getsombuf(struct socket *so)
Create an mbuf and make its owner the socket `so'.
struct mbuf *m_intopt(struct socket *so, int val)
Create an mbuf, make its owner the socket `so', put the int `val' into it, and set its length to sizeof(int).
int fsocreate(..., int *fd)
Create a socket, a la socreate(9), put the socket into the given LWP's descriptor table, return the descriptor at `fd' on success.
void *sockaddr_addr(struct sockaddr *sa, socklen_t *slenp) const void *sockaddr_const_addr(const struct sockaddr *sa, socklen_t *slenp)
Extract a pointer to the address part of a sockaddr. Write the length of the address part at `slenp', if `slenp' is not NULL.
socklen_t sockaddr_getlen(const struct sockaddr *sa)
Return the length of a sockaddr. This just evaluates to sa->sa_len. I only add this for consistency with code that appears in a portable userland library that I am going to import.
const struct sockaddr *sockaddr_any(const struct sockaddr *sa)
Return the "don't care" sockaddr in the same family as `sa'. This is the address a client should sobind(9) if it does not care the source address and, if applicable, the port et cetera that it uses.
const void *sockaddr_anyaddr(const struct sockaddr *sa, socklen_t *slenp)
Return the "don't care" sockaddr in the same family as `sa'. This is the address a client should sobind(9) if it does not care the source address and, if applicable, the port et cetera that it uses.
show more ...
|
#
b3fc2963 |
| 30-Aug-2007 |
dyoung <dyoung@NetBSD.org> |
Use malloc(9) for sockaddrs instead of pool(9), and remove dom_sa_pool and dom_sa_len members from struct domain. Pools of fixed-size objects are too rigid for sockaddr_dls, whose size can vary over
Use malloc(9) for sockaddrs instead of pool(9), and remove dom_sa_pool and dom_sa_len members from struct domain. Pools of fixed-size objects are too rigid for sockaddr_dls, whose size can vary over a wide range.
Return sockaddr_dl to its "historical" size. Now that I'm using malloc(9) instead of pool(9) to allocate sockaddr_dl, I can create a sockaddr_dl of any size in the kernel, so expanding sockaddr_dl is useless.
Avoid using sizeof(struct sockaddr_dl) in the kernel.
Introduce sockaddr_dl_alloc() for allocating & initializing an arbitrary sockaddr_dl on the heap.
Add an argument, the sockaddr length, to sockaddr_alloc(), sockaddr_copy(), and sockaddr_dl_setaddr().
Constify: LLADDR() -> CLLADDR().
Where the kernel overwrites LLADDR(), use sockaddr_dl_setaddr(), instead. Used properly, sockaddr_dl_setaddr() will not overrun the end of the sockaddr.
show more ...
|
#
72f0a6df |
| 02-May-2007 |
dyoung <dyoung@NetBSD.org> |
Eliminate address family-specific route caches (struct route, struct route_in6, struct route_iso), replacing all caches with a struct route.
The principle benefit of this change is that all of the p
Eliminate address family-specific route caches (struct route, struct route_in6, struct route_iso), replacing all caches with a struct route.
The principle benefit of this change is that all of the protocol families can benefit from route cache-invalidation, which is necessary for correct routing. Route-cache invalidation fixes an ancient PR, kern/3508, at long last; it fixes various other PRs, also.
Discussions with and ideas from Joerg Sonnenberger influenced this work tremendously. Of course, all design oversights and bugs are mine.
DETAILS
1 I added to each address family a pool of sockaddrs. I have introduced routines for allocating, copying, and duplicating, and freeing sockaddrs:
struct sockaddr *sockaddr_alloc(sa_family_t af, int flags); struct sockaddr *sockaddr_copy(struct sockaddr *dst, const struct sockaddr *src); struct sockaddr *sockaddr_dup(const struct sockaddr *src, int flags); void sockaddr_free(struct sockaddr *sa);
sockaddr_alloc() returns either a sockaddr from the pool belonging to the specified family, or NULL if the pool is exhausted. The returned sockaddr has the right size for that family; sa_family and sa_len fields are initialized to the family and sockaddr length---e.g., sa_family = AF_INET and sa_len = sizeof(struct sockaddr_in). sockaddr_free() puts the given sockaddr back into its family's pool.
sockaddr_dup() and sockaddr_copy() work analogously to strdup() and strcpy(), respectively. sockaddr_copy() KASSERTs that the family of the destination and source sockaddrs are alike.
The 'flags' argumet for sockaddr_alloc() and sockaddr_dup() is passed directly to pool_get(9).
2 I added routines for initializing sockaddrs in each address family, sockaddr_in_init(), sockaddr_in6_init(), sockaddr_iso_init(), etc. They are fairly self-explanatory.
3 structs route_in6 and route_iso are no more. All protocol families use struct route. I have changed the route cache, 'struct route', so that it does not contain storage space for a sockaddr. Instead, struct route points to a sockaddr coming from the pool the sockaddr belongs to. I added a new method to struct route, rtcache_setdst(), for setting the cache destination:
int rtcache_setdst(struct route *, const struct sockaddr *);
rtcache_setdst() returns 0 on success, or ENOMEM if no memory is available to create the sockaddr storage.
It is now possible for rtcache_getdst() to return NULL if, say, rtcache_setdst() failed. I check the return value for NULL everywhere in the kernel.
4 Each routing domain (struct domain) has a list of live route caches, dom_rtcache. rtflushall(sa_family_t af) looks up the domain indicated by 'af', walks the domain's list of route caches and invalidates each one.
show more ...
|
#
c308b1c6 |
| 09-Dec-2006 |
dyoung <dyoung@NetBSD.org> |
Here are various changes designed to protect against bad IPv4 routing caused by stale route caches (struct route). Route caches are sprinkled throughout PCBs, the IP fast-forwarding table, and IP tu
Here are various changes designed to protect against bad IPv4 routing caused by stale route caches (struct route). Route caches are sprinkled throughout PCBs, the IP fast-forwarding table, and IP tunnel interfaces (gre, gif, stf).
Stale IPv6 and ISO route caches will be treated by separate patches.
Thank you to Christoph Badura for suggesting the general approach to invalidating route caches that I take here.
Here are the details:
Add hooks to struct domain for tracking and for invalidating each domain's route caches: dom_rtcache, dom_rtflush, and dom_rtflushall.
Introduce helper subroutines, rtflush(ro) for invalidating a route cache, rtflushall(family) for invalidating all route caches in a routing domain, and rtcache(ro) for notifying the domain of a new cached route.
Chain together all IPv4 route caches where ro_rt != NULL. Provide in_rtcache() for adding a route to the chain. Provide in_rtflush() and in_rtflushall() for invalidating IPv4 route caches. In in_rtflush(), set ro_rt to NULL, and remove the route from the chain. In in_rtflushall(), walk the chain and remove every route cache.
In rtrequest1(), call rtflushall() to invalidate route caches when a route is added.
In gif(4), discard the workaround for stale caches that involves expiring them every so often.
Replace the pattern 'RTFREE(ro->ro_rt); ro->ro_rt = NULL;' with a call to rtflush(ro).
Update ipflow_fastforward() and all other users of route caches so that they expect a cached route, ro->ro_rt, to turn to NULL.
Take care when moving a 'struct route' to rtflush() the source and to rtcache() the destination.
In domain initializers, use .dom_xxx tags.
KNF here and there.
show more ...
|
#
6c8fa322 |
| 25-Aug-2006 |
matt <matt@NetBSD.org> |
One step closer to loadable domains. Store pointers to a domain's soft interrupt queues so if_detach can remove packets to removed interfaces from them. This eliminates a lot of conditional ugly co
One step closer to loadable domains. Store pointers to a domain's soft interrupt queues so if_detach can remove packets to removed interfaces from them. This eliminates a lot of conditional ugly code in if.c
show more ...
|
#
202b0bbe |
| 13-Dec-2005 |
oster <oster@NetBSD.org> |
s/struct proc/struct lwp/ to provide forward reference for lwp. Fixes build problem on vax.
|
#
95e1ffb1 |
| 11-Dec-2005 |
christos <christos@NetBSD.org> |
merge ktrace-lwp.
|
#
d341be30 |
| 23-Jan-2005 |
matt <matt@NetBSD.org> |
Change initialzie of domains to use link sets. Switch to using STAILQ. Add a convenience macro DOMAIN_FOREACH to interate through the domain.
|
#
230fb9b8 |
| 22-May-2004 |
jonathan <jonathan@NetBSD.org> |
Eliminate several uses of `curproc' from the socket-layer code and from NFS.
Add a new explicit `struct proc *p' argument to socreate(), sosend(). Use that argument instead of curproc. Follow-on cha
Eliminate several uses of `curproc' from the socket-layer code and from NFS.
Add a new explicit `struct proc *p' argument to socreate(), sosend(). Use that argument instead of curproc. Follow-on changes to pass that argument to socreate(), sosend(), and (*so->so_send)() calls. These changes reviewed and independently recoded by Matt Thomas.
Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas: pass soreceive()'s struct uio* uio->uio_procp to unp_externalize(). Eliminate curproc from unp_externalize. Also, now soreceive() uses its uio->uio_procp value, pass that same value downward to ((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.
Similar changes in sys/nfs to eliminate (most) uses of curproc, either via the req-> r_procp field of a struct nfsreq *req argument, or by passing down new explicit struct proc * arguments.
Reviewed by: Matt Thomas, posted to tech-kern. NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.
show more ...
|
#
e5dd03bf |
| 22-Apr-2004 |
matt <matt@NetBSD.org> |
Eliminate space between function name and prototype.
|
#
e50668c7 |
| 22-Apr-2004 |
matt <matt@NetBSD.org> |
Constify protosw arrays. This can reduce the kernel .data section by over 4K (if all the network protocols) are loaded.
|
#
27fa4ffb |
| 18-Apr-2004 |
matt <matt@NetBSD.org> |
De __P()
|
#
aad01611 |
| 07-Aug-2003 |
agc <agc@NetBSD.org> |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
|
#
65e5548a |
| 26-Feb-2003 |
matt <matt@NetBSD.org> |
Add MBUFTRACE kernel option. Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *) to m_get*(M_WAIT, *). These are not performance critical and making them call m_get saves con
Add MBUFTRACE kernel option. Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *) to m_get*(M_WAIT, *). These are not performance critical and making them call m_get saves considerable space. Add m_clget analogue of MCLGET and make corresponding change for M_WAIT uses. Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE. Begin to change netstat to use sysctl.
show more ...
|
#
e5aa1996 |
| 27-May-2002 |
itojun <itojun@NetBSD.org> |
framework to add af-dependent data structure to struct ifnet. as discussed at bsd-api-discuss. sync w/kame
|
#
e89ff519 |
| 12-May-2002 |
matt <matt@NetBSD.org> |
Make domains extern.
|
#
6bd4a3a7 |
| 22-Jan-1997 |
mikel <mikel@NetBSD.org> |
add multiple inclusion protection
|