#include "proto/pipe/pipe.h"
+CF_DEFINES
+
+#define PIPE_CFG ((struct pipe_config *) this_proto)
+
CF_DECLS
-CF_KEYWORDS(PIPE, PEER, TABLE)
+CF_KEYWORDS(PIPE, PEER, TABLE, MODE, OPAQUE, TRANSPARENT)
CF_GRAMMAR
pipe_proto_start: proto_start PIPE {
this_proto = proto_config_new(&proto_pipe, sizeof(struct pipe_config));
this_proto->preference = DEF_PREF_PIPE;
+ PIPE_CFG->mode = PIPE_OPAQUE;
}
;
| pipe_proto PEER TABLE SYM ';' {
if ($4->class != SYM_TABLE)
cf_error("Routing table name expected");
- ((struct pipe_config *) this_proto)->peer = $4->def;
+ PIPE_CFG->peer = $4->def;
}
+ | pipe_proto MODE OPAQUE ';' { PIPE_CFG->mode = PIPE_OPAQUE; }
+ | pipe_proto MODE TRANSPARENT ';' { PIPE_CFG->mode = PIPE_TRANSPARENT; }
;
CF_CODE
if (new)
{
memcpy(&a, new->attrs, sizeof(rta));
+
+ if (p->mode == PIPE_OPAQUE)
+ {
+ a.proto = &p->p;
+ a.source = RTS_PIPE;
+ }
+
a.aflags = 0;
a.eattrs = attrs;
e = rte_get_temp(&a);
e->net = nn;
- /* Copy protocol specific embedded attributes. */
- memcpy(&(e->u), &(new->u), sizeof(e->u));
+ if (p->mode == PIPE_TRANSPARENT)
+ {
+ /* Copy protocol specific embedded attributes. */
+ memcpy(&(e->u), &(new->u), sizeof(e->u));
+ }
src = new->attrs->proto;
}
}
dest->pipe_busy = 1;
- rte_update2(dest, nn, &p->p, src, e);
+ rte_update2(dest, nn, &p->p, (p->mode == PIPE_OPAQUE) ? &p->p : src, e);
dest->pipe_busy = 0;
}
memcpy(ph, p, sizeof(struct pipe_proto));
p->phantom = ph;
ph->phantom = p;
- ph->p.accept_ra_types = RA_ANY;
+ ph->p.accept_ra_types = (p->mode == PIPE_OPAQUE) ? RA_OPTIMAL : RA_ANY;
ph->p.rt_notify = pipe_rt_notify_sec;
ph->p.proto_state = PS_UP;
ph->p.core_state = ph->p.core_goal = FS_HAPPY;
struct pipe_proto *p = (struct pipe_proto *) P;
p->peer = c->peer->table;
- P->accept_ra_types = RA_ANY;
+ p->mode = c->mode;
+ P->accept_ra_types = (p->mode == PIPE_OPAQUE) ? RA_OPTIMAL : RA_ANY;
P->rt_notify = pipe_rt_notify_pri;
P->import_control = pipe_import_control;
return P;
{
struct pipe_proto *p = (struct pipe_proto *) P;
- bsprintf(buf, "-> %s", p->peer->name);
+ bsprintf(buf, "%c> %s", (p->mode == PIPE_OPAQUE) ? '-' : '=', p->peer->name);
}
static int
struct pipe_config *o = (struct pipe_config *) p->cf;
struct pipe_config *n = (struct pipe_config *) new;
- return o->peer == n->peer;
+ return (o->peer == n->peer) && (o->mode == n->mode);
}
struct protocol proto_pipe = {