Skip to content

Commit

Permalink
ipctl.c: Convert error codes to error messages. Free socket
Browse files Browse the repository at this point in the history
when exiting just for good form.
  • Loading branch information
oskarb committed Apr 30, 2012
1 parent 7702c77 commit 9274d28
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cli/ipctl.c
Expand Up @@ -31,6 +31,9 @@ int main( int argc, const char* argv[] )
// Allocate a new netlink socket
sock = nl_socket_alloc();

//struct nl_cb *cb = nl_cb_alloc(NL_CB_DEBUG);
//sock = nl_socket_alloc_cb(cb);

// Connect to generic netlink socket on kernel side
genl_connect(sock);

Expand All @@ -41,16 +44,18 @@ int main( int argc, const char* argv[] )
{
int rc = ipctl_set_proxy_arp(sock, family, ifIndex, proxyArpOn);
if (rc)
fprintf(stderr, "Error: %d\n", rc);
fprintf(stderr, "Error: %d %s\n", rc, nl_geterror(rc));
}
else
{
int response = -1;
int rc = ipctl_get_proxy_arp(sock, family, ifIndex, &response);
if (rc)
fprintf(stderr, "Error: %d\n", rc);
fprintf(stderr, "Error: %d %s\n", rc, nl_geterror(rc));
else
printf("%d\n", response);
}

nl_socket_free(sock);
}

0 comments on commit 9274d28

Please sign in to comment.