cosmetics
This commit is contained in:
+13
-25
@@ -34,8 +34,7 @@
|
|||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "whack.h"
|
#include "whack.h"
|
||||||
|
|
||||||
static void
|
static void help(void)
|
||||||
help(void)
|
|
||||||
{
|
{
|
||||||
fprintf(stderr
|
fprintf(stderr
|
||||||
, "Usage:\n\n"
|
, "Usage:\n\n"
|
||||||
@@ -238,8 +237,7 @@ static const char *label = NULL; /* --label operand, saved for diagnostic
|
|||||||
static const char *name = NULL; /* --name operand, saved for diagnostics */
|
static const char *name = NULL; /* --name operand, saved for diagnostics */
|
||||||
|
|
||||||
/* print a string as a diagnostic, then exit whack unhappily */
|
/* print a string as a diagnostic, then exit whack unhappily */
|
||||||
static void
|
static void diag(const char *mess)
|
||||||
diag(const char *mess)
|
|
||||||
{
|
{
|
||||||
if (mess != NULL)
|
if (mess != NULL)
|
||||||
{
|
{
|
||||||
@@ -255,8 +253,7 @@ diag(const char *mess)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* conditially calls diag; prints second arg, if non-NULL, as quoted string */
|
/* conditially calls diag; prints second arg, if non-NULL, as quoted string */
|
||||||
static void
|
static void diagq(err_t ugh, const char *this)
|
||||||
diagq(err_t ugh, const char *this)
|
|
||||||
{
|
{
|
||||||
if (ugh != NULL)
|
if (ugh != NULL)
|
||||||
{
|
{
|
||||||
@@ -652,12 +649,9 @@ struct sockaddr_un ctl_addr = { AF_UNIX, DEFAULT_CTLBASE CTL_SUFFIX };
|
|||||||
|
|
||||||
/* helper variables and function to encode strings from whack message */
|
/* helper variables and function to encode strings from whack message */
|
||||||
|
|
||||||
static char
|
static char *next_str,*str_roof;
|
||||||
*next_str,
|
|
||||||
*str_roof;
|
|
||||||
|
|
||||||
static bool
|
static bool pack_str(char **p)
|
||||||
pack_str(char **p)
|
|
||||||
{
|
{
|
||||||
const char *s = *p == NULL? "" : *p; /* note: NULL becomes ""! */
|
const char *s = *p == NULL? "" : *p; /* note: NULL becomes ""! */
|
||||||
size_t len = strlen(s) + 1;
|
size_t len = strlen(s) + 1;
|
||||||
@@ -675,9 +669,8 @@ pack_str(char **p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void check_life_time(time_t life, time_t limit, const char *which,
|
||||||
check_life_time(time_t life, time_t limit, const char *which
|
const whack_message_t *msg)
|
||||||
, const whack_message_t *msg)
|
|
||||||
{
|
{
|
||||||
time_t mint = msg->sa_rekey_margin * (100 + msg->sa_rekey_fuzz) / 100;
|
time_t mint = msg->sa_rekey_margin * (100 + msg->sa_rekey_fuzz) / 100;
|
||||||
|
|
||||||
@@ -706,8 +699,7 @@ check_life_time(time_t life, time_t limit, const char *which
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void clear_end(whack_end_t *e)
|
||||||
clear_end(whack_end_t *e)
|
|
||||||
{
|
{
|
||||||
zero(e);
|
zero(e);
|
||||||
e->id = NULL;
|
e->id = NULL;
|
||||||
@@ -717,8 +709,7 @@ clear_end(whack_end_t *e)
|
|||||||
e->host_port = IKE_UDP_PORT;
|
e->host_port = IKE_UDP_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void update_ports(whack_message_t *m)
|
||||||
update_ports(whack_message_t *m)
|
|
||||||
{
|
{
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
@@ -734,9 +725,8 @@ update_ports(whack_message_t *m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void check_end(whack_end_t *this, whack_end_t *that,
|
||||||
check_end(whack_end_t *this, whack_end_t *that
|
bool default_nexthop, sa_family_t caf, sa_family_t taf)
|
||||||
, bool default_nexthop, sa_family_t caf, sa_family_t taf)
|
|
||||||
{
|
{
|
||||||
if (caf != addrtypeof(&this->host_addr))
|
if (caf != addrtypeof(&this->host_addr))
|
||||||
diag("address family of host inconsistent");
|
diag("address family of host inconsistent");
|
||||||
@@ -774,8 +764,7 @@ check_end(whack_end_t *this, whack_end_t *that
|
|||||||
diag("the protocol for leftprotoport and rightprotoport must be the same");
|
diag("the protocol for leftprotoport and rightprotoport must be the same");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void get_secret(int sock)
|
||||||
get_secret(int sock)
|
|
||||||
{
|
{
|
||||||
const char *buf, *secret;
|
const char *buf, *secret;
|
||||||
int len;
|
int len;
|
||||||
@@ -798,8 +787,7 @@ get_secret(int sock)
|
|||||||
|
|
||||||
/* This is a hack for initiating ISAKMP exchanges. */
|
/* This is a hack for initiating ISAKMP exchanges. */
|
||||||
|
|
||||||
int
|
int main(int argc, char **argv)
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
{
|
||||||
whack_message_t msg;
|
whack_message_t msg;
|
||||||
char esp_buf[256]; /* uses snprintf */
|
char esp_buf[256]; /* uses snprintf */
|
||||||
|
|||||||
Reference in New Issue
Block a user