diff --git a/utils/mnetftn/ftntomnet.c b/utils/mnetftn/ftntomnet.c index 5dc32eb..7a38dcc 100644 --- a/utils/mnetftn/ftntomnet.c +++ b/utils/mnetftn/ftntomnet.c @@ -317,6 +317,7 @@ int export_messages(int area) { } if (areas[area]->hub == mynode) { + msg_to_nl(&msg); for (n = 0; n < areas[area]->link_count; n++) { if (imhub) { snprintf(buffer, PATH_MAX, "%s/%d/", baseoutdir, areas[area]->links[n]); @@ -334,14 +335,14 @@ int export_messages(int area) { } else { snprintf(buffer, PATH_MAX, "%s/%d/%d-%s.message", baseoutdir, hubnode, areas[area]->links[n], msgid); } - msg.daddr = areas[area]->links[n]; + msg.daddr = htonl(areas[area]->links[n]); fptr = fopen(buffer, "wb"); if (fptr == NULL) { fprintf(stderr, "Error creating file %s\n", buffer); continue; } - msg_to_nl(&msg); + fwrite(&msg, sizeof(struct msg_t), 1, fptr); fwrite(body, strlen(body), 1, fptr); diff --git a/utils/mnetscan/mnetscan.c b/utils/mnetscan/mnetscan.c index 107872b..14863d4 100644 --- a/utils/mnetscan/mnetscan.c +++ b/utils/mnetscan/mnetscan.c @@ -297,6 +297,7 @@ int export_messages(int area) { msg.area = areas[area]->id; msg.type = 0; if (areas[area]->hub == mynode) { + msg_to_nl(&msg); for (n = 0; n < areas[area]->link_count; n++) { if (imhub) { snprintf(buffer, PATH_MAX, "%s/%d/", baseoutdir, areas[area]->links[n]); @@ -314,14 +315,14 @@ int export_messages(int area) { } else { snprintf(buffer, PATH_MAX, "%s/%d/%d-%s.message", baseoutdir, hubnode, areas[area]->links[n], msgid); } - msg.daddr = areas[area]->links[n]; + msg.daddr = htonl(areas[area]->links[n]); fptr = fopen(buffer, "wb"); if (fptr == NULL) { fprintf(stderr, "Error creating file %s\n", buffer); continue; } - msg_to_nl(&msg); + fwrite(&msg, sizeof(struct msg_t), 1, fptr); fwrite(body, strlen(body), 1, fptr);