diff options
author | Martin Mares <mj@ucw.cz> | 1999-03-01 23:30:33 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-03-01 23:30:33 +0100 |
commit | b4b3b39e20a669ab3f33f71474e937b5e9ce6d26 (patch) | |
tree | 8b3323a4f86e8002a03e4f64edafeec1f15bb77e /sysdep | |
parent | c748cdb9ec8b7de5daaf759825bc428cd0bcd400 (diff) | |
download | bird-b4b3b39e20a669ab3f33f71474e937b5e9ce6d26.tar bird-b4b3b39e20a669ab3f33f71474e937b5e9ce6d26.zip |
Added SK_MAGIC type sockets for internal use by system dependent code,
especially for netlink communication.
Diffstat (limited to 'sysdep')
-rw-r--r-- | sysdep/unix/io.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index aa4f652..8427ba4 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -1,7 +1,7 @@ /* * BIRD Internet Routing Daemon -- Unix I/O * - * (c) 1998 Martin Mares <mj@ucw.cz> + * (c) 1998--1999 Martin Mares <mj@ucw.cz> * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -231,7 +231,7 @@ static void sk_dump(resource *r) { sock *s = (sock *) r; - static char *sk_type_names[] = { "TCP<", "TCP>", "TCP", "UDP", "UDP/MC", "IP", "IP/MC" }; + static char *sk_type_names[] = { "TCP<", "TCP>", "TCP", "UDP", "UDP/MC", "IP", "IP/MC", "MAGIC" }; debug("(%s, ud=%p, sa=%08x, sp=%d, da=%08x, dp=%d, tos=%d, ttl=%d, if=%s)\n", sk_type_names[s->type], @@ -320,7 +320,7 @@ sk_setup(sock *s) ERR("SO_DONTROUTE"); } #ifdef IP_PMTUDISC - if (s->type != SK_TCP_PASSIVE && s->type != SK_TCP_ACTIVE) + if (s->type != SK_TCP_PASSIVE && s->type != SK_TCP_ACTIVE && s->type != SK_MAGIC) { int dont = IP_PMTUDISC_DONT; if (setsockopt(fd, SOL_IP, IP_PMTUDISC, &dont, sizeof(dont)) < 0) @@ -379,8 +379,11 @@ sk_open(sock *s) case SK_IP_MC: fd = socket(PF_INET, SOCK_RAW, s->dport); break; + case SK_MAGIC: + fd = s->fd; + break; default: - bug("sk_open() called for invalid sock type %d", s->type); + bug("sk_open() called for invalid sock type %d", type); } if (fd < 0) die("sk_open: socket: %m"); @@ -489,6 +492,7 @@ sk_maybe_write(sock *s) switch (s->type) { case SK_TCP: + case SK_MAGIC: while (s->ttx != s->tpos) { e = write(s->fd, s->ttx, s->tpos - s->ttx); @@ -625,6 +629,8 @@ sk_read(sock *s) } return 0; } + case SK_MAGIC: + return s->rx_hook(s, 0); default: { struct sockaddr_in sa; |