mdp based dna lookup works now, but lacks duplicate suppression.

This commit is contained in:
gardners 2012-04-25 20:33:25 +09:30
parent 0133ea972a
commit 98c3b72cf4
3 changed files with 6 additions and 16 deletions

View File

@ -504,10 +504,11 @@ int app_dna_lookup(int argc, const char *const *argv, struct command_line_option
{
fprintf(stderr," Error message: %s\n",mdp.error.message);
}
else if (rx.packetTypeAndFlags==MDP_RX)
else if ((rx.packetTypeAndFlags&MDP_TYPE_MASK)==MDP_TX)
fprintf(stderr,"%s:%s\n",
overlay_render_sid(&rx.in.payload[0]),
&rx.in.payload[SID_SIZE]);
overlay_render_sid(&rx.in.src.sid[0]),
&rx.in.payload[0]);
else WHYF("packettype=0x%x",rx.packetTypeAndFlags);
if (servalShutdown) break;
}
}
@ -787,7 +788,7 @@ int app_mdp_ping(int argc, const char *const *argv, struct command_line_option *
fprintf(stderr,"mdpping: overlay_mdp_recv: %s (code %d)\n",
mdp.error.message,mdp.error.error);
break;
case MDP_RX:
case MDP_TX:
{
int *rxseq=(int *)&mdp.in.payload;
long long *txtime=(long long *)&mdp.in.payload[4];

View File

@ -435,12 +435,7 @@ int overlay_saw_mdp_frame(int interface, overlay_mdp_frame *mdp,long long now)
}
}
}
if (match>-1) {
/* We now know the socket, and so we can pass the MDP_TX frame to the
recipient. We do, however, translate it into an MDP_RX frame first,
so that the recipient understands the context. */
mdp->packetTypeAndFlags&=~MDP_TYPE_MASK;
mdp->packetTypeAndFlags|=MDP_RX;
if (match>-1) {
struct sockaddr_un addr;
bcopy(mdp_bindings_sockets[match],&addr.sun_path[0],mdp_bindings_socket_name_lengths[match]);
addr.sun_family=AF_UNIX;
@ -661,7 +656,6 @@ int overlay_mdp_dispatch(overlay_mdp_frame *mdp,int userGeneratedFrameP,
/* Packet is addressed such that we should process it. */
overlay_saw_mdp_frame(-1 /* not received on a network interface */,
mdp,overlay_gettime_ms());
if (!broadcast) {
/* Is local, and is not broadcast, so shouldn't get sent out
on the wire. */
@ -999,10 +993,6 @@ int overlay_mdp_relevant_bytes(overlay_mdp_frame *mdp)
len=&mdp->out.payload[0]-(unsigned char *)mdp;
len+=mdp->out.payload_length;
break;
case MDP_RX:
len=&mdp->in.payload[0]-(unsigned char *)mdp;
len+=mdp->in.payload_length;
break;
case MDP_BIND:
len=&mdp->bind.sid[SID_SIZE]-(unsigned char *)mdp;
break;

View File

@ -1108,7 +1108,6 @@ unsigned char *keyring_get_nm_bytes(sockaddr_mdp *priv,sockaddr_mdp *pub);
#define MDP_NOCRYPT 0x0200
#define MDP_NOSIGN 0x0400
#define MDP_TX 1
#define MDP_RX 2
typedef struct overlay_mdp_data_frame {
sockaddr_mdp src;
sockaddr_mdp dst;