summaryrefslogtreecommitdiff
path: root/src/lib/irm.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2016-03-11 17:30:45 +0100
committerDimitri Staessens <[email protected]>2016-03-11 17:30:45 +0100
commitd6897a45d8b45d5bc00f1a6dcd627a14aa535120 (patch)
treee37582961e744a7d56e29c134ba147df2da1a061 /src/lib/irm.c
parentb68c90fbf9f4a60e4fc406903e38d20453ba8253 (diff)
parent328078c1ee01d64733328b3dad3e7db68dcd6d2d (diff)
downloadouroboros-d6897a45d8b45d5bc00f1a6dcd627a14aa535120.tar.gz
ouroboros-d6897a45d8b45d5bc00f1a6dcd627a14aa535120.zip
Merged in sandervrijders/ouroboros/be-irmd (pull request #26)
Helper functions for naming and extension of the irmd code
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r--src/lib/irm.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c
index 519b4eb8..a1847eed 100644
--- a/src/lib/irm.c
+++ b/src/lib/irm.c
@@ -40,7 +40,7 @@ static int send_irm_msg(struct irm_msg * msg)
buf = serialize_irm_msg(msg);
if (buf == NULL) {
close(sockfd);
- return -1;
+ return -1;
}
if (write(sockfd, buf->data, buf->size) == -1) {
@@ -63,6 +63,11 @@ int irm_create_ipcp(rina_name_t name,
if (ipcp_type == NULL)
return -1;
+ if (!name_is_ok(&name)) {
+ LOG_ERR("Bad name");
+ return -1;
+ }
+
msg.code = IRM_CREATE_IPCP;
msg.name = &name;
msg.ipcp_type = ipcp_type;
@@ -79,6 +84,11 @@ int irm_destroy_ipcp(rina_name_t name)
{
struct irm_msg msg;
+ if (!name_is_ok(&name)) {
+ LOG_ERR("Bad name");
+ return -1;
+ }
+
msg.code = IRM_DESTROY_IPCP;
msg.name = &name;
@@ -95,6 +105,11 @@ int irm_bootstrap_ipcp(rina_name_t name,
{
struct irm_msg msg;
+ if (!name_is_ok(&name)) {
+ LOG_ERR("Bad name");
+ return -1;
+ }
+
msg.code = IRM_BOOTSTRAP_IPCP;
msg.name = &name;
msg.conf = &conf;
@@ -112,6 +127,11 @@ int irm_enroll_ipcp(rina_name_t name,
{
struct irm_msg msg;
+ if (!name_is_ok(&name)) {
+ LOG_ERR("Bad name");
+ return -1;
+ }
+
msg.code = IRM_ENROLL_IPCP;
msg.name = &name;
msg.dif_name = dif_name;
@@ -130,6 +150,11 @@ int irm_reg_ipcp(rina_name_t name,
{
struct irm_msg msg;
+ if (!name_is_ok(&name)) {
+ LOG_ERR("Bad name");
+ return -1;
+ }
+
msg.code = IRM_REG_IPCP;
msg.name = &name;
msg.difs = difs;
@@ -149,6 +174,11 @@ int irm_unreg_ipcp(rina_name_t name,
{
struct irm_msg msg;
+ if (!name_is_ok(&name)) {
+ LOG_ERR("Bad name");
+ return -1;
+ }
+
msg.code = IRM_UNREG_IPCP;
msg.name = &name;
msg.difs = difs;