diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2010-07-02 21:20:58 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2010-07-02 21:20:58 +0000 |
commit | 64b0cca6da5fe72027d6bc81cd89e1691bf43d4d (patch) | |
tree | 66fb4daf8650eb68f651c50a68158ceb3637eda4 /usr.sbin | |
parent | be799bb62dea227a3af3336623e9b89eec3dc9c7 (diff) |
add $OpenBSD$ and remove trailing space. no functional change.
Diffstat (limited to 'usr.sbin')
80 files changed, 660 insertions, 557 deletions
diff --git a/usr.sbin/npppd/common/bytebuf.c b/usr.sbin/npppd/common/bytebuf.c index 66359e49f05..ed1bceb5e02 100644 --- a/usr.sbin/npppd/common/bytebuf.c +++ b/usr.sbin/npppd/common/bytebuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bytebuf.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: bytebuf.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -41,7 +41,7 @@ * }</pre> * * @author Yasuoka Masahiko - * $Id: bytebuf.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: bytebuf.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <stdlib.h> #include <string.h> @@ -61,7 +61,7 @@ abort(); \ } #else -#define BYTEBUF_ASSERT(cond) +#define BYTEBUF_ASSERT(cond) #endif #endif @@ -82,7 +82,7 @@ struct _bytebuffer { #ifndef MIN #define MIN(m,n) ((m) < (n)? (m) : (n)) -#endif +#endif /** * Create a bytebuffer and allocate memory area. @@ -115,7 +115,7 @@ bytebuffer_create(size_t capacity) fail: if (_this != NULL) free(_this); - return NULL; + return NULL; } /** @@ -175,9 +175,9 @@ bytebuffer_realloc(bytebuffer *_this, size_t capacity) if (_this->limit > capacity) { errno = EINVAL; - return -1; + return -1; } - + if ((new_data = realloc(_this->data, capacity)) == NULL) return -1; @@ -256,7 +256,7 @@ bytebuffer_put(bytebuffer *_this, const void *src, size_t srclen) if (src != NULL && src != BYTEBUFFER_PUT_DIRECT) memcpy(rval, src, srclen); - + _this->position += srclen; return rval; @@ -264,7 +264,7 @@ bytebuffer_put(bytebuffer *_this, const void *src, size_t srclen) /* * Transfer data from this buffer to the given destination memory. - * If the given buffer is too small, this function returns <code>NULL</code> + * If the given buffer is too small, this function returns <code>NULL</code> * and <code>errno</code> is <code>ENOBUFS</code> * * @param dst pointer of the destination memory. Specify NULL @@ -283,7 +283,7 @@ bytebuffer_get(bytebuffer *_this, void *dst, size_t dstlen) } if (dst != NULL && dst != BYTEBUFFER_GET_DIRECT) memcpy(dst, (char *)_this->data + _this->position, dstlen); - + _this->position += dstlen; return dst; @@ -344,7 +344,7 @@ bytebuffer_has_remaining(bytebuffer *_this) return bytebuffer_remaining(_this) > 0; } -/** +/** * Flip this buffer. * The limit is set to the position and the position is set zero. */ @@ -358,7 +358,7 @@ bytebuffer_flip(bytebuffer *_this) _this->mark = -1; } -/** +/** * Rewind this buffer. * The position is set to zero. */ @@ -371,7 +371,7 @@ bytebuffer_rewind(bytebuffer *_this) _this->mark = -1; } -/** +/** * Clear this buffer. * The position is set to zero. */ diff --git a/usr.sbin/npppd/common/config_helper.c b/usr.sbin/npppd/common/config_helper.c index a6148e2885b..5282d560cd3 100644 --- a/usr.sbin/npppd/common/config_helper.c +++ b/usr.sbin/npppd/common/config_helper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config_helper.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: config_helper.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: config_helper.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: config_helper.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <stdio.h> #include <string.h> @@ -163,7 +163,7 @@ config_str_equali(struct properties *_this, const char *confKey, * PPPoE0.pppoe.service_name: my_service * * does not exist, then it returns "default_service". - * + * * Functions that have fixed prefix can be generated by * PREFIXED_CONFIG_FUNCTIONS macro that is defined in config_helper.h. */ @@ -183,7 +183,7 @@ config_prefixed_str(struct properties *_this, const char *prefix, const char *co return config_str(_this, confKey); } -int +int config_prefixed_int(struct properties *_this, const char *prefix, const char *confKey, int defValue) { char keybuf[KEYBUFSZ]; @@ -199,7 +199,7 @@ config_prefixed_int(struct properties *_this, const char *prefix, const char *co return config_int(_this, confKey, defValue); } -int +int config_prefixed_str_equal(struct properties *_this, const char *prefix, const char *confKey, const char *str, int defValue) { @@ -217,7 +217,7 @@ config_prefixed_str_equal(struct properties *_this, const char *prefix, const ch return config_str_equal(_this, confKey, str, defValue); } -int +int config_prefixed_str_equali(struct properties *_this, const char *prefix, const char *confKey, const char *str, int defValue) { @@ -244,7 +244,7 @@ config_prefixed_str_equali(struct properties *_this, const char *prefix, * try to get the value by the key without the label. * * For example, we have following configuration - * + * * ipcp.dns_primary: 192.168.0.1 * ipcp.ipcp0.dns_primary: 192.168.0.2 * @@ -281,7 +281,7 @@ config_named_prefix_str(struct properties *_this, const char *prefix, return config_str(_this, keybuf); } -int +int config_named_prefix_int(struct properties *_this, const char *prefix, const char *name, const char *confKey, int defValue) { @@ -300,7 +300,7 @@ config_named_prefix_int(struct properties *_this, const char *prefix, return config_int(_this, keybuf, defValue); } -int +int config_named_prefix_str_equal(struct properties *_this, const char *prefix, const char *name, const char *confKey, const char *str, int defValue) { @@ -313,7 +313,7 @@ config_named_prefix_str_equal(struct properties *_this, const char *prefix, return (strcmp(val, str) == 0)? 1 : 0; } -int +int config_named_prefix_str_equali(struct properties *_this, const char *prefix, const char *name, const char *confKey, const char *str, int defValue) { diff --git a/usr.sbin/npppd/common/csvreader.c b/usr.sbin/npppd/common/csvreader.c index 00023e51560..f47d9d36c73 100644 --- a/usr.sbin/npppd/common/csvreader.c +++ b/usr.sbin/npppd/common/csvreader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: csvreader.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: csvreader.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -54,7 +54,7 @@ * csvreader_destroy(csv); *</pre> */ -/* $Id: csvreader.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: csvreader.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <unistd.h> #include <stdlib.h> #include <string.h> @@ -171,7 +171,7 @@ csvreader_reset(csvreader *_this) * of the CSV. * It will return error when the parsing of the field isn't finished. </p> */ -CSVREADER_STATUS +CSVREADER_STATUS csvreader_parse_flush(csvreader *_this) { return csvreader_parse_flush0(_this, 1); @@ -202,7 +202,7 @@ csvreader_parse(csvreader *_this, const char *line) case CSV_INIT: _this->state = CSV_IN_DATA; if (line[off] == DQUOTE) { - _this->column_start_with_quote = 1; + _this->column_start_with_quote = 1; break; } /* FALLTHROUGH */ @@ -245,7 +245,7 @@ eol: return csvreader_parse_flush0(_this, 0); } -static CSVREADER_STATUS +static CSVREADER_STATUS csvreader_parse_flush0(csvreader *_this, int is_final) { if (_this->state == CSV_FLUSH_WAIT) @@ -360,7 +360,7 @@ csvreader_flush_column(csvreader *_this) _this->cols[_this->col_pos++] = _this->buffer + _this->start_pos; _this->cols[_this->col_pos] = NULL; _this->start_pos = _this->pos; - _this->column_start_with_quote = 0; + _this->column_start_with_quote = 0; _this->state = CSV_INIT; return CSVREADER_NO_ERROR; diff --git a/usr.sbin/npppd/common/debugutil.c b/usr.sbin/npppd/common/debugutil.c index 270972e6bf4..7e687b732c6 100644 --- a/usr.sbin/npppd/common/debugutil.c +++ b/usr.sbin/npppd/common/debugutil.c @@ -195,7 +195,7 @@ copy_loop: && LOG_PRI(prio) < countof(prio_name_idx) && prio_name_idx[LOG_PRI(prio)] != NULL); ftell(debugfp); - fprintf(debugfp, + fprintf(debugfp, "%04d-%02d-%02d %02d:%02d:%02d:%s: " , lt->tm_year + 1900 , lt->tm_mon + 1 @@ -275,7 +275,7 @@ show_hd(FILE *file, const u_char *buf, int len) asciibuf); else syslog(LOG_ERR, "%-47s |%s|\n", linebuf, - asciibuf); + asciibuf); memset(asciibuf, ' ', sizeof(asciibuf)); asciibuf[sizeof(asciibuf)-1] = '\0'; o = 0; @@ -299,7 +299,7 @@ show_hd(FILE *file, const u_char *buf, int len) if (file) fprintf(file, "\t%-47s |%s|\n", linebuf, asciibuf); else - syslog(LOG_ERR, "%-47s |%s|\n", linebuf, asciibuf); + syslog(LOG_ERR, "%-47s |%s|\n", linebuf, asciibuf); } if (file) fflush(file); diff --git a/usr.sbin/npppd/common/hash.c b/usr.sbin/npppd/common/hash.c index 612a4ff4664..6217ef5f78b 100644 --- a/usr.sbin/npppd/common/hash.c +++ b/usr.sbin/npppd/common/hash.c @@ -61,7 +61,7 @@ hash_create(cmp_func, hash_func, hsz) } /* hash_first - Get first item from hash table. - * Returns a pointer of first bucket on success. Otherwise returns + * Returns a pointer of first bucket on success. Otherwise returns * NULL. */ hash_link * @@ -189,7 +189,7 @@ hash_delete(htbl, k, memfree) } /* - * delete all items from this hash_table. + * delete all items from this hash_table. * If memfree != 0 then free items. */ void diff --git a/usr.sbin/npppd/common/ipsec_util.c b/usr.sbin/npppd/common/ipsec_util.c index fb3965b2545..97657d32d76 100644 --- a/usr.sbin/npppd/common/ipsec_util.c +++ b/usr.sbin/npppd/common/ipsec_util.c @@ -2,7 +2,7 @@ * Copyright 2007, 2009 * Internet Initiative Japan Inc. All rights reserved. */ -/* $Id: ipsec_util.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: ipsec_util.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /*@file IPsec related utility functions */ /* * RFC 2367 PF_KEY Key Management API, Version 2 @@ -60,7 +60,7 @@ ipsec_util_purge_transport_sa(struct sockaddr *sock, struct sockaddr *peer, tv = KEYSOCK_RCVTIMEO; if (setsockopt(key_sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) != 0) goto fail; - + del_in.is_valid = del_out.is_valid = 0; if (delete_prepare(key_sock, sock, peer, proto, &del_in, &del_out) != 0) goto fail; diff --git a/usr.sbin/npppd/common/properties.c b/usr.sbin/npppd/common/properties.c index 4f60a93b636..065054748a7 100644 --- a/usr.sbin/npppd/common/properties.c +++ b/usr.sbin/npppd/common/properties.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. */ /* - * $Id: properties.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: properties.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /* LINTLIBRARY */ #include <sys/types.h> @@ -121,7 +121,7 @@ properties_remove(struct properties *_this, const char *key) if ((hl = hash_lookup(_this->hash_tbl, key)) == NULL) return; - + key0 = /* NOSTRICT */(char *)hl->key; hash_delete(_this->hash_tbl, key, 1); @@ -495,7 +495,7 @@ trim(s) r = /* NOSTRICT */(char *)skip_space(s); for (t = r + strlen(r) - 1; r <= t; t--) { - if (ISSPACE(*t)) + if (ISSPACE(*t)) *t = '\0'; else break; @@ -510,7 +510,7 @@ chomp(s) char *t; for (t = s + strlen(s) - 1; s <= t; t--) { - if (ISCRLF(*t)) + if (ISCRLF(*t)) *t = '\0'; else break; diff --git a/usr.sbin/npppd/common/properties_test.c b/usr.sbin/npppd/common/properties_test.c index 861394f243b..dc34bcd4c64 100644 --- a/usr.sbin/npppd/common/properties_test.c +++ b/usr.sbin/npppd/common/properties_test.c @@ -24,9 +24,9 @@ * SUCH DAMAGE. */ /* - * cc -o properties_test -DNO_KANJI=1 properties_test.c properties.c hash.c + * cc -o properties_test -DNO_KANJI=1 properties_test.c properties.c hash.c * - * ./properties_test + * ./properties_test */ #include <sys/types.h> #include <stdio.h> diff --git a/usr.sbin/npppd/common/radish.c b/usr.sbin/npppd/common/radish.c index 44567a7b51e..502be17d30f 100644 --- a/usr.sbin/npppd/common/radish.c +++ b/usr.sbin/npppd/common/radish.c @@ -4,7 +4,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -140,7 +140,7 @@ rd_inithead(headp, family, slen, off, alen, match) *(m + off + j) = 0xff; *(m + off + j) = rd_bmask[r]; } - + head->rdh_slen = slen; head->rdh_offset = off; head->rdh_alen = alen; @@ -190,7 +190,7 @@ rd_mask(m_arg, head, maskp) case 0x00: break; } *maskp = masklen; - return((struct sockaddr *)(masks + slen * masklen)); + return((struct sockaddr *)(masks + slen * masklen)); } int @@ -228,7 +228,7 @@ rd_insert(d_arg, m_arg, head, rt) Bzero(new, sizeof(*new) + slen); new->rd_route = (struct sockaddr *)(new + 1); new->rd_mask = mask; - new->rd_masklen = masklen; + new->rd_masklen = masklen; new->rd_masklim = q; new->rd_bmask = rd_bmask[r]; new->rd_btest = rd_btest[r]; @@ -245,13 +245,13 @@ rd_insert(d_arg, m_arg, head, rt) np[1] = dp[1]; /* sa_family */ dp += off; np += off; - i = 0; + i = 0; while (i < q) { np[i] = dp[i]; i++; } np[i] = dp[i] & rd_bmask[r]; /* just in case */ - + while (cur) { if (masklen == cur->rd_masklen) { rp = (u_char *)cur->rd_route + off; @@ -261,7 +261,7 @@ rd_insert(d_arg, m_arg, head, rt) * masklen == cur->rd_masklen * dest != route */ - return rd_glue(cur, new, i, head); + return rd_glue(cur, new, i, head); } /* * masklen == cur->rd_masklen @@ -294,7 +294,7 @@ rd_insert(d_arg, m_arg, head, rt) * masklen > cur->rd_masklen * (dest & mask) != route */ - return rd_glue(cur, new, i, head); + return rd_glue(cur, new, i, head); } if (cur->rd_bmask) if ((np[lim] & cur->rd_bmask) != rp[lim]) { @@ -302,7 +302,7 @@ rd_insert(d_arg, m_arg, head, rt) * masklen > cur->rd_masklen * (dest & mask) != route */ - return rd_glue(cur, new, lim, head); + return rd_glue(cur, new, lim, head); } /* * masklen > cur->rd_masklen @@ -324,12 +324,12 @@ rd_insert(d_arg, m_arg, head, rt) cur->rd_l = new; new->rd_p = cur; return 0; - } + } } /* * masklen < cur->rd_masklen */ - + /* See if route matches with dest, be carefull! * dest == (route & dest_mask) */ @@ -371,7 +371,7 @@ rd_insert(d_arg, m_arg, head, rt) new->rd_r = cur; else new->rd_l = cur; - + cur->rd_p = new; return 0; } @@ -413,7 +413,7 @@ rd_glue(cur, new, misbyte, head) xor >>= 1; maskb--; } - + glue->rd_route = (struct sockaddr *)(glue + 1); glue->rd_masklen = 8 * misbyte + maskb; glue->rd_masklim = misbyte; @@ -433,7 +433,7 @@ rd_glue(cur, new, misbyte, head) for(i = 0; i < misbyte; i++) gp[i] = cp[i]; gp[misbyte] = cp[misbyte] & glue->rd_bmask; - + if (glue->rd_btest & cp[misbyte]) { glue->rd_r = cur; glue->rd_l = new; @@ -459,11 +459,11 @@ rd_glue(cur, new, misbyte, head) return 0; } -/* +/* * Find the longest-match radish with the destination. * Return 1 if success, otherwise return 0. */ - + int rd_match(d_arg, head, rdp) struct sockaddr *d_arg; @@ -509,7 +509,7 @@ rd_match_next(d_arg, head, rdp, cur) if (target->rd_rtent != NULL) { cp = (u_char *)target->rd_route + off; lim = target->rd_masklim; - + /* Check the edge for slight speed up */ if (target->rd_bmask) if ((*(dp + lim) & target->rd_bmask) @@ -517,12 +517,12 @@ rd_match_next(d_arg, head, rdp, cur) nextparent: continue; } - - /* mask is always 0xff */ + + /* mask is always 0xff */ for (i = 0; i < lim; i++) if(dp[i] != cp[i]) /* to break the for loop */ - goto nextparent; + goto nextparent; /* Matched to this radish! */ *rdp = target; return 1; @@ -532,12 +532,12 @@ rd_match_next(d_arg, head, rdp, cur) return 0; } -/* +/* * Lookup the same radish according to a pair of destination and mask. * Return a pointer to rtentry if exists. Otherwise, return NULL. */ -#ifndef GENERIC_USE +#ifndef GENERIC_USE struct rtentry * #else /* GENERIC_USE */ void * @@ -565,7 +565,7 @@ rd_lookup(d_arg, m_arg, head) return NULL; /* mask is always 0xff */ for (i = olim; i < lim; i++) - if(dp[i] != cp[i]) + if(dp[i] != cp[i]) return NULL; if (masklen == cur->rd_masklen) return cur->rd_rtent; @@ -580,14 +580,14 @@ rd_lookup(d_arg, m_arg, head) } /* - * Delete the radish for dest and mask. + * Delete the radish for dest and mask. * Return 0 if success. * Return ENOENT if no such radish exists. * Return EFAULT if try to delete intermediate radish which doesn't have route. */ int -#ifndef GENERIC_USE +#ifndef GENERIC_USE rd_delete(d_arg, m_arg, head, rt) #else /* GENERIC_USE */ rd_delete(d_arg, m_arg, head, item) @@ -595,7 +595,7 @@ rd_delete(d_arg, m_arg, head, item) struct sockaddr *d_arg; struct sockaddr *m_arg; struct radish_head *head; -#ifndef GENERIC_USE +#ifndef GENERIC_USE struct rtentry **rt; #else /* GENERIC_USE */ void **item; @@ -606,12 +606,12 @@ rd_delete(d_arg, m_arg, head, item) u_char *dp = (u_char *)d_arg + off, *cp; rd_mask(m_arg, head, &masklen); -#ifndef GENERIC_USE +#ifndef GENERIC_USE *rt = NULL; /* just in case */ #else /* GENERIC_USE */ *item = NULL; /* just in case */ #endif /* GENERIC_USE */ - + while (cur) { /* exit loop if dest does not match with the current node * (dest & mask) != route @@ -622,10 +622,10 @@ rd_delete(d_arg, m_arg, head, item) if ((*(dp + cur->rd_masklim) & cur->rd_bmask) != *(cp + cur->rd_masklim)) return ENOENT; - /* mask is always 0xff */ + /* mask is always 0xff */ lim = cur->rd_masklim; for (i = 0; i < lim; i++) - if(dp[i] != cp[i]) + if(dp[i] != cp[i]) return ENOENT; /* See if cur is exactly what we delete */ @@ -650,7 +650,7 @@ rd_delete(d_arg, m_arg, head, item) */ return EFAULT; } -#ifndef GENERIC_USE +#ifndef GENERIC_USE *rt = cur->rd_rtent; #else /* GENERIC_USE */ *item = cur->rd_rtent; @@ -664,7 +664,7 @@ rd_delete(d_arg, m_arg, head, item) u_char rl = SA_LEN(cur->rd_route); u_char ml = SA_LEN(cur->rd_mask); #endif - + bcopy(cur->rd_route, rd_deleted_km, rl); bcopy(cur->rd_mask, rd_deleted_km + rl, ml); } @@ -720,7 +720,7 @@ rd_unlink(cur, top) parent = cur->rd_p; if (parent->rd_l == cur) { parent->rd_l = NULL; - Free(cur); + Free(cur); } else if (parent->rd_r == cur) { parent->rd_r = NULL; Free(cur); @@ -808,7 +808,7 @@ rd_refines(m_arg, n_arg) return 0; if (*n++ != *m++) masks_are_equal = 0; - + } while (n < lim2) if (*n++) diff --git a/usr.sbin/npppd/common/radish.h b/usr.sbin/npppd/common/radish.h index a9f4a804289..a9eeb40292f 100644 --- a/usr.sbin/npppd/common/radish.h +++ b/usr.sbin/npppd/common/radish.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -68,7 +68,7 @@ struct radish { }; struct radish_head { - int rdh_slen; /* socket address length */ + int rdh_slen; /* socket address length */ int rdh_offset; /* address start byte */ int rdh_alen; /* address length */ void *rdh_masks; @@ -110,7 +110,7 @@ int rd_insert __P((struct sockaddr *, struct sockaddr *, int rd_glue __P((struct radish *, struct radish *, int, struct radish_head *)); int rd_match __P((struct sockaddr *, struct radish_head *, struct radish **)); int rd_match_next __P((struct sockaddr *, struct radish_head *, struct radish **, struct radish *)); -#ifndef GENERIC_USE +#ifndef GENERIC_USE struct rtentry *rd_lookup __P((struct sockaddr *, struct sockaddr *, struct radish_head *)); int rd_delete __P((struct sockaddr *, struct sockaddr *, diff --git a/usr.sbin/npppd/common/recvfromto.c b/usr.sbin/npppd/common/recvfromto.c index fae801dafad..2e1df20a30e 100644 --- a/usr.sbin/npppd/common/recvfromto.c +++ b/usr.sbin/npppd/common/recvfromto.c @@ -2,7 +2,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,7 +14,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/usr.sbin/npppd/common/rt_zebra.c b/usr.sbin/npppd/common/rt_zebra.c index 7dcdbb36d0f..5cc740c830c 100644 --- a/usr.sbin/npppd/common/rt_zebra.c +++ b/usr.sbin/npppd/common/rt_zebra.c @@ -2,7 +2,7 @@ * Copyright (c) 2007 * Internet Initiative Japan Inc. All rights reserved. */ -/* $Id: rt_zebra.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: rt_zebra.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /* * @file This file provides utility functions to help add/delete routing * information with GNU Zebra. This utility uses event(3) and uses a UNIX @@ -65,7 +65,7 @@ static int rt_zebra_log (rt_zebra *, int, const char *, ...) __printflike(3,4) static int rt_zebra_ipv4_blackhole_rt0(rt_zebra *, uint32_t, uint32_t, int); static rt_zebra rt_zebra_singleton; /* singleton */ -static int rt_zebra_blackhole_ifidx = -1; +static int rt_zebra_blackhole_ifidx = -1; /** Returns the only one rt_zebra context. */ rt_zebra * @@ -120,7 +120,7 @@ rt_zebra_add_ipv4_blackhole_rt(rt_zebra *_this, uint32_t addr, } /** - * Deletes the specified IPv4 blackhole routing entry. + * Deletes the specified IPv4 blackhole routing entry. * @param addr the detination IPv4 address part in host byte-order. * @param mask the detination IPv4 netmask part in host byte-order. */ @@ -174,7 +174,7 @@ rt_zebra_start(rt_zebra *_this) break; default: log_printf(LOG_ERR, - "Connection to the zserv failed: %m"); + "Connection to the zserv failed: %m"); goto fail; } } diff --git a/usr.sbin/npppd/common/rtev_common.c b/usr.sbin/npppd/common/rtev_common.c index bcb52ca44dd..0c65175a0c2 100644 --- a/usr.sbin/npppd/common/rtev_common.c +++ b/usr.sbin/npppd/common/rtev_common.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: rtev_common.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: rtev_common.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /* * PF_ROUTE related utility functions. * <p> @@ -36,7 +36,7 @@ * #include <event.h> * #include <ifaddrs.h> * #include <rtev.h> - * + * * int main() * { * event_init(); @@ -158,7 +158,7 @@ rtev_ifa_is_primary(const char *ifname, struct sockaddr *sa) for (count = 0, ifa = rtev_getifaddrs_by_ifname(ifname); ifa != NULL; ifa = ifa->ifa_next) { - + if (strcmp(ifa->ifa_name, ifname) != 0) break; if (ifa->ifa_addr->sa_family != sa->sa_family) @@ -315,7 +315,7 @@ rtev_base_on_rtevent(rtev_impl *impl) static inline int rtev_update_ifa_cache(rtev_impl *impl) { - if (rtev_event_serial == rtev_ifa_cache_serial && + if (rtev_event_serial == rtev_ifa_cache_serial && rtev_cached_ifa != NULL) return 0; @@ -378,7 +378,7 @@ rtev_base_on_write(rtev_impl *impl, int rtsock, int npackets) bytebuffer_flip(rtev_sndbuf); for (i = 0; i < npackets && bytebuffer_remaining(rtev_sndbuf) > 0; i++){ rtm = bytebuffer_pointer(rtev_sndbuf); - if (send(rtsock, rtm, rtm->rtm_msglen, 0) <= 0 && + if (send(rtsock, rtm, rtm->rtm_msglen, 0) <= 0 && !(rtm->rtm_type == RTM_DELETE && errno == ESRCH) && !(rtm->rtm_type == RTM_ADD && errno == EEXIST)) { rval = 1; @@ -422,7 +422,7 @@ static void ifa_rbentry_fini(void) { struct ifa_rbentry *e, *n; - + for (e = RB_MIN(ifa_rb_ifacenam, &ifa_rb_ifacenam); e; e = n) { n = RB_NEXT(ifa_rb_ifacenam, &ifa_rb_ifacenam, e); RB_REMOVE(ifa_rb_ifacenam, &ifa_rb_ifacenam, e); diff --git a/usr.sbin/npppd/common/rtev_local.h b/usr.sbin/npppd/common/rtev_local.h index b80f974d14f..dc437933b31 100644 --- a/usr.sbin/npppd/common/rtev_local.h +++ b/usr.sbin/npppd/common/rtev_local.h @@ -37,7 +37,7 @@ abort(); \ } #else -#define RTEV_ASSERT(cond) +#define RTEV_ASSERT(cond) #define RTEV_DBG(x) #define log_printf syslog #endif diff --git a/usr.sbin/npppd/common/slist.c b/usr.sbin/npppd/common/slist.c index 5fedb7d141d..e038255d1b7 100644 --- a/usr.sbin/npppd/common/slist.c +++ b/usr.sbin/npppd/common/slist.c @@ -151,7 +151,7 @@ slist_grow0(slist *list, int grow_sz) == NULL) return -1; - memset(&list_new[list->list_size], 0, + memset(&list_new[list->list_size], 0, PTR_SIZE * (size_new - list->list_size)); list->list = list_new; @@ -180,7 +180,7 @@ slist_grow0(slist *list, int grow_sz) memmove(&list->list[0], &list->list[grow_sz], PTR_SIZE *(list->last_idx - grow_sz)); - list->last_idx -= grow_sz; + list->last_idx -= grow_sz; } } list->list_size = size_new; @@ -244,7 +244,7 @@ slist_get(slist *list, int idx) } /** Store a value in "idx"th item */ -int +int slist_set(slist *list, int idx, void *item) { SLIST_ASSERT(idx >= 0); @@ -266,7 +266,7 @@ slist_remove_first(slist *list) if (slist_length(list) <= 0) return NULL; - + oldVal = list->list[list->first_idx]; if (itr_is_valid(list) && list->itr_next == list->first_idx) @@ -299,7 +299,7 @@ void slist_remove_all(slist *list) { void **list0 = list->list; - + slist_init(list); list->list = list0; @@ -331,9 +331,9 @@ slist_swap(slist *list, int m, int n) SLIST_ASSERT(len > n); if (m < 0 || n < 0) - return; + return; if (m >= len || n >= len) - return; + return; slist_swap0(list, m, n); } @@ -368,7 +368,7 @@ slist_remove(slist *list, int idx) if (list->first_idx < list->last_idx) { /* take the smaller side */ if (idx0 - list->first_idx < list->last_idx - idx0) { - first = list->first_idx; + first = list->first_idx; INCR_IDX(list, first_idx); } else { last = list->last_idx; @@ -380,7 +380,7 @@ slist_remove(slist *list, int idx) * first. */ if (list->first_idx <= idx0) { - first = list->first_idx; + first = list->first_idx; INCR_IDX(list, first_idx); } else { last = list->last_idx; @@ -399,7 +399,7 @@ slist_remove(slist *list, int idx) itr_invalidate(list); } - memmove(&list->list[idx0], &list->list[idx0 + 1], + memmove(&list->list[idx0], &list->list[idx0 + 1], (PTR_SIZE) * (last - idx0)); } /* the first side */ @@ -413,7 +413,7 @@ slist_remove(slist *list, int idx) itr_invalidate(list); } - memmove(&list->list[first + 1], &list->list[first], + memmove(&list->list[first + 1], &list->list[first], (PTR_SIZE) * (idx0 - first)); } if (list->first_idx == list->last_idx) { diff --git a/usr.sbin/npppd/common/slist_test.c b/usr.sbin/npppd/common/slist_test.c index 0457f08ec0e..60b71512b97 100644 --- a/usr.sbin/npppd/common/slist_test.c +++ b/usr.sbin/npppd/common/slist_test.c @@ -56,7 +56,7 @@ dump(slist *l) { int i; - fprintf(stderr, + fprintf(stderr, "\tl->itr_curr = %d\n" "\tl->itr_next = %d\n" "\tl->first_idx = %d\n" @@ -455,7 +455,7 @@ test_09() /* reaches the last */ slist_add(l, (void *)4); /* add a new item */ ASSERT(slist_itr_has_next(l)); /* iterates the new */ - ASSERT((int)slist_itr_next(l) == 4); + ASSERT((int)slist_itr_next(l) == 4); slist_fini(l); diff --git a/usr.sbin/npppd/l2tp/l2tp.h b/usr.sbin/npppd/l2tp/l2tp.h index 3dca153a73c..27529ca81ce 100644 --- a/usr.sbin/npppd/l2tp/l2tp.h +++ b/usr.sbin/npppd/l2tp/l2tp.h @@ -1,3 +1,5 @@ +/* $OpenBSD: l2tp.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -28,7 +30,7 @@ /*@file * header file for the L2TP module */ -/* $Id: l2tp.h,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: l2tp.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /************************************************************************ * Protocol Constants @@ -220,7 +222,7 @@ #define L2TPD_DIALIN_LAYER2_LABEL "DialIn" #define L2TPD_CONFIG_BUFSIZ 65535 #define L2TP_CTRL_WINDOW_SIZE 8 -#ifndef L2TPD_VENDOR_NAME +#ifndef L2TPD_VENDOR_NAME #define L2TPD_VENDOR_NAME "IIJ" #endif #define L2TPD_DEFAULT_UDP_PORT 1701 @@ -382,9 +384,9 @@ typedef struct _l2tp_ctrl { bytebuffer *zlb_buffer; /** the time when last control message sent */ - time_t last_snd_ctrl; + time_t last_snd_ctrl; /** the time when last packet received */ - time_t last_rcv; + time_t last_rcv; /** * If we are on active close and have not sent a StopCCN message yet, @@ -404,7 +406,7 @@ typedef struct _l2tp_ctrl { /** number of calls established */ int ncalls; - int + int /** use sequence number in L2TP Data Message? */ data_use_seq:1, /** waiting to acknowledge HELLO? */ @@ -434,7 +436,7 @@ typedef struct _l2tp_call { uint16_t rcv_nxt; /** calling number */ char calling_number[32]; - + uint32_t /** Sequencing required */ seq_required:1, /** Use sequencing in the data connection */ diff --git a/usr.sbin/npppd/l2tp/l2tp_call.c b/usr.sbin/npppd/l2tp/l2tp_call.c index 03e7d550cea..0e95f7ac9b8 100644 --- a/usr.sbin/npppd/l2tp/l2tp_call.c +++ b/usr.sbin/npppd/l2tp/l2tp_call.c @@ -1,4 +1,5 @@ -/* $OpenBSD: l2tp_call.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: l2tp_call.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: l2tp_call.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: l2tp_call.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file L2TP LNS call */ #include <sys/types.h> #include <sys/param.h> @@ -111,7 +112,7 @@ l2tp_call_destroy(l2tp_call *_this, int from_l2tp_ctrl) /* * l2tp disconnect will occur when * 1) disconnect request issued from nppdctl command - * 2) npppd is terminated + * 2) npppd is terminated * in case 1) ppp_stop() is used to terminal. (PPP LCP TermReq) * and in case 2) l2tp_call_disconnect() is used (L2TP CDN) */ @@ -276,7 +277,7 @@ l2tp_call_recv_packet(l2tp_ctrl *ctrl, l2tp_call *_this, int mestype, * @return return 0 if the ICRQ is acceptable. * other values means fail to receive, and * CDN was sent and status was updated. - */ + */ static int l2tp_call_recv_ICRQ(l2tp_call *_this, u_char *pkt, int pktlen) { @@ -351,7 +352,7 @@ l2tp_call_recv_ICRQ(l2tp_call *_this, u_char *pkt, int pktlen) } #ifdef L2TP_CALL_DEBUG } else { - L2TP_CALL_DBG((_this, LOG_DEBUG, + L2TP_CALL_DBG((_this, LOG_DEBUG, "AVP (%s/%d) is not handled", avp_attr_type_string(avp->attr_type), avp->attr_type)); @@ -413,7 +414,7 @@ l2tp_call_send_ICRP(l2tp_call *_this) l2tp_call_log(_this, LOG_ERR, "failed to SendICRP: %m"); return 1; } - l2tp_call_log(_this, LOG_INFO, "SendICRP session_id=%u", + l2tp_call_log(_this, LOG_INFO, "SendICRP session_id=%u", _this->session_id); return 0; } @@ -528,7 +529,7 @@ l2tp_call_recv_ICCN(l2tp_call *_this, u_char *pkt, int pktlen, dpi->last_recv_lcp.ldata = avp_attr_length(avp); break; case L2TP_AVP_TYPE_PROXY_AUTHEN_CHALLENGE: - memcpy(dpi->auth_chall, avp->attr_value, + memcpy(dpi->auth_chall, avp->attr_value, MIN(avp_attr_length(avp), sizeof(dpi->auth_chall))); dpi->lauth_chall = avp_attr_length(avp); break; @@ -541,7 +542,7 @@ l2tp_call_recv_ICCN(l2tp_call *_this, u_char *pkt, int pktlen, avp_attr_length(avp))); break; case L2TP_AVP_TYPE_PROXY_AUTHEN_RESPONSE: - memcpy(dpi->auth_resp, avp->attr_value, + memcpy(dpi->auth_resp, avp->attr_value, MIN(avp_attr_length(avp), sizeof(dpi->auth_resp))); dpi->lauth_resp = avp_attr_length(avp); break; @@ -581,7 +582,7 @@ l2tp_call_recv_ICCN(l2tp_call *_this, u_char *pkt, int pktlen, return 1; #ifdef L2TP_CALL_DEBUG } else { - L2TP_CALL_DBG((_this, LOG_DEBUG, + L2TP_CALL_DBG((_this, LOG_DEBUG, "AVP (%s/%d) is not handled", avp_attr_type_string(avp->attr_type), avp->attr_type)); @@ -681,7 +682,7 @@ l2tp_recv_CDN(l2tp_call *_this, u_char *pkt, int pktlen) } #ifdef L2TP_CALL_DEBUG } else { - L2TP_CALL_DBG((_this, LOG_DEBUG, + L2TP_CALL_DBG((_this, LOG_DEBUG, "AVP (%s/%d) is not handled", avp_attr_type_string(avp->attr_type), avp->attr_type)); @@ -711,7 +712,7 @@ size_check_failed: /* send CDN */ static int -l2tp_call_send_CDN(l2tp_call *_this, int result_code, int error_code, const +l2tp_call_send_CDN(l2tp_call *_this, int result_code, int error_code, const char *errmes, struct l2tp_avp *addavp[], int naddavp) { uint32_t val32; @@ -742,7 +743,7 @@ l2tp_call_send_CDN(l2tp_call *_this, int result_code, int error_code, const #if 0 /* * Windows 2000 work around: - * Windows 2000 will return "2 - Length is wrong" in StopCCN, + * Windows 2000 will return "2 - Length is wrong" in StopCCN, * when it received "length = 8 and no error code AVP". * Avoid the error, use AVP length = 10. */ diff --git a/usr.sbin/npppd/l2tp/l2tp_ctrl.c b/usr.sbin/npppd/l2tp/l2tp_ctrl.c index 79bd0239981..b29594e5b0f 100644 --- a/usr.sbin/npppd/l2tp/l2tp_ctrl.c +++ b/usr.sbin/npppd/l2tp/l2tp_ctrl.c @@ -1,4 +1,5 @@ -/* $OpenBSD: l2tp_ctrl.c,v 1.3 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: l2tp_ctrl.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +26,7 @@ * SUCH DAMAGE. */ /**@file Control connection processing functions for L2TP LNS */ -/* $Id: l2tp_ctrl.c,v 1.3 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: l2tp_ctrl.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> #include <sys/time.h> @@ -244,7 +245,7 @@ l2tp_ctrl_destroy(l2tp_ctrl *_this) * nortify disconnection to peer * * @return 0: all CDN and StopCCN have been sent. - * N: if the remaining calls which still not sent CDN exist, + * N: if the remaining calls which still not sent CDN exist, * return # of the calls. * -1: when try to send of StopCCN failed. */ @@ -266,7 +267,7 @@ l2tp_ctrl_send_disconnect_notify(l2tp_ctrl *_this) if (slist_length(&_this->call_list) != 0) { ncalls = l2tp_ctrl_disconnect_all_calls(_this); if (ncalls > 0) { - /* + /* * Call l2tp_ctrl_disconnect_all_calls() to check * the send window still filled. */ @@ -325,7 +326,7 @@ l2tp_ctrl_stop(l2tp_ctrl *_this, int result) case L2TP_CTRL_STATE_CLEANUP_WAIT: cleanup: if (slist_length(&_this->call_list) != 0) { - if (l2tp_ctrl_disconnect_all_calls(_this) > 0) + if (l2tp_ctrl_disconnect_all_calls(_this) > 0) break; } #if 0 @@ -467,7 +468,7 @@ l2tp_ctrl_timeout(int fd, short evtype, void *ctx) l2tp_ctrl *_this; l2tp_call *call; - /* + /* * the timer must be reset, when leave this function. * MEMO: l2tp_ctrl_stop() will reset the timer in it. * and please remember that the l2tp_ctrl_stop() may free _this. @@ -569,7 +570,7 @@ l2tp_ctrl_timeout(int fd, short evtype, void *ctx) if (_this->active_closing != 0) l2tp_ctrl_send_disconnect_notify(_this); break; - default: + default: l2tp_ctrl_log(_this, LOG_ERR, "Internal error, timeout on illegal state=%d", _this->state); @@ -660,7 +661,7 @@ l2tp_ctrl_disconnect_all_calls(l2tp_ctrl *_this) l2tp_call *call; L2TP_CTRL_ASSERT(_this != NULL); - + ncalls = 0; len = slist_length(&_this->call_list); for (i = 0; i < len; i++) { @@ -761,7 +762,7 @@ l2tp_ctrl_input(l2tpd *_this, int listener_index, struct sockaddr *peer, goto bad_packet; } is_ctrl = (hdr.t != 0)? 1 : 0; - + /* calc required length */ reqlen = 6; /* for Flags, Tunnel-Id, Session-Id field */ if (hdr.l) reqlen += 2; /* for Length field (opt) */ @@ -841,12 +842,12 @@ l2tp_ctrl_input(l2tpd *_this, int listener_index, struct sockaddr *peer, peer); goto fail; } - if (l2tpd_config_str_equal(_this, + if (l2tpd_config_str_equal(_this, config_key_prefix("l2tpd.interface", ifname), "accept", 0)){ strlcat(phy_label, "%", sizeof(phy_label)); strlcat(phy_label, ifname, sizeof(phy_label)); - } else if (l2tpd_config_str_equal(_this, + } else if (l2tpd_config_str_equal(_this, config_key_prefix("l2tpd.interface", "any"), "accept", 0)){ } else { @@ -874,13 +875,13 @@ l2tp_ctrl_input(l2tpd *_this, int listener_index, struct sockaddr *peer, l2tp_ctrl_reload(ctrl); } else { /* - * treat as an error if src address and port is not + * treat as an error if src address and port is not * match. (because it is potentially DoS attach) */ L2TP_CTRL_ASSERT(ctrl->peer.ss_family == peer->sa_family); switch (peer->sa_family) { - case AF_INET: + case AF_INET: { struct sockaddr_in *peersin1; @@ -935,7 +936,7 @@ l2tp_ctrl_input(l2tpd *_this, int listener_index, struct sockaddr *peer, "established"); goto fail; } - + if (hdr.s != 0) { if (SEQ_LT(hdr.ns, call->rcv_nxt)) { /* sequence number seems to rewind */ @@ -1140,7 +1141,7 @@ fail: return; bad_packet: - l2tpd_log(_this, LOG_INFO, "Received from=%s:%u: %s", + l2tpd_log(_this, LOG_INFO, "Received from=%s:%u: %s", inet_ntoa(peersin->sin_addr), ntohs(peersin->sin_port), errmsg); return; } @@ -1284,7 +1285,7 @@ l2tp_ctrl_recv_SCCRQ(l2tp_ctrl *_this, u_char *pkt, int pktlen, l2tpd *_l2tpd, AVP_SIZE_CHECK(avp, ==, 14); /* * As the implementation never send SCCRQ, - * the peer is always winner + * the peer is always winner */ continue; case L2TP_AVP_TYPE_FIRMWARE_REVISION: @@ -1319,7 +1320,7 @@ l2tp_ctrl_recv_SCCRQ(l2tp_ctrl *_this, u_char *pkt, int pktlen, l2tpd *_l2tpd, avp->attr_type); #ifdef L2TP_CTRL_DEBUG } else { - L2TP_CTRL_DBG((_this, LOG_DEBUG, + L2TP_CTRL_DBG((_this, LOG_DEBUG, "AVP (%s/%d) is not handled", avp_attr_type_string(avp->attr_type), avp->attr_type)); @@ -1465,7 +1466,7 @@ l2tp_ctrl_recv_StopCCN(l2tp_ctrl *_this, u_char *pkt, int pktlen) avp->attr_type); #ifdef L2TP_CTRL_DEBUG } else { - L2TP_CTRL_DBG((_this, LOG_DEBUG, + L2TP_CTRL_DBG((_this, LOG_DEBUG, "AVP (%s/%d) is not handled", avp_attr_type_string(avp->attr_type), avp->attr_type)); @@ -1501,7 +1502,7 @@ size_check_failed: return -1; } -/* +/* * send SCCRP */ static void diff --git a/usr.sbin/npppd/l2tp/l2tp_local.h b/usr.sbin/npppd/l2tp/l2tp_local.h index 424b58f2cae..33a90e2ce73 100644 --- a/usr.sbin/npppd/l2tp/l2tp_local.h +++ b/usr.sbin/npppd/l2tp/l2tp_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: l2tp_local.h,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: l2tp_local.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -26,7 +26,7 @@ */ #ifndef L2TP_LOCAL_H #define L2TP_LOCAL_H 1 -/* $Id: l2tp_local.h,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: l2tp_local.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #ifndef GETSHORT #define GETSHORT(s, cp) { \ diff --git a/usr.sbin/npppd/l2tp/l2tp_subr.c b/usr.sbin/npppd/l2tp/l2tp_subr.c index fecfe603ab4..a45a4cd2ac0 100644 --- a/usr.sbin/npppd/l2tp/l2tp_subr.c +++ b/usr.sbin/npppd/l2tp/l2tp_subr.c @@ -1,4 +1,5 @@ -/* $OpenBSD: l2tp_subr.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: l2tp_subr.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: l2tp_subr.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: l2tp_subr.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file L2TP related sub-routines */ #include <sys/types.h> #include <sys/time.h> diff --git a/usr.sbin/npppd/l2tp/l2tp_subr.h b/usr.sbin/npppd/l2tp/l2tp_subr.h index 8cb11cedbf3..d31894ab34a 100644 --- a/usr.sbin/npppd/l2tp/l2tp_subr.h +++ b/usr.sbin/npppd/l2tp/l2tp_subr.h @@ -1,4 +1,5 @@ -/* $OpenBSD: l2tp_subr.h,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: l2tp_subr.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -26,7 +27,7 @@ */ #ifndef L2TP_SUBR_H #define L2TP_SUBR_H 1 -/* $Id: l2tp_subr.h,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: l2tp_subr.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /** * structure of L2TP Attribute Value Pair (AVP) packet header @@ -91,7 +92,7 @@ short_hash(const void *v, int sz) return (int)v % sz; } -/* +/* * macro to check AVP size. * Prepare 1) char emes[256] for error message, 2) size_check_failed label * before use this macro. diff --git a/usr.sbin/npppd/l2tp/l2tpd.c b/usr.sbin/npppd/l2tp/l2tpd.c index 6df6d75bdf1..be3de37c661 100644 --- a/usr.sbin/npppd/l2tp/l2tpd.c +++ b/usr.sbin/npppd/l2tp/l2tpd.c @@ -1,4 +1,5 @@ -/* $OpenBSD: l2tpd.c,v 1.3 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: l2tpd.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +26,7 @@ * SUCH DAMAGE. */ /**@file L2TP(Layer Two Tunneling Protocol "L2TP") / RFC2661 */ -/* $Id: l2tpd.c,v 1.3 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: l2tpd.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> @@ -107,7 +108,7 @@ l2tpd_init(l2tpd *_this) memset(&sin0, 0, sizeof(sin0)); sin0.sin_len = sizeof(sin0); sin0.sin_family = AF_INET; - if (l2tpd_add_listener(_this, 0, L2TPD_DEFAULT_LAYER2_LABEL, + if (l2tpd_add_listener(_this, 0, L2TPD_DEFAULT_LAYER2_LABEL, (struct sockaddr *)&sin0) != 0) { return 1; } @@ -339,7 +340,7 @@ l2tpd_listener_start(l2tpd_listener *_this, char *ipsec_policy_in, fail: if (sock >= 0) close(sock); - + return 1; } @@ -534,10 +535,10 @@ l2tpd_reload(l2tpd *_this, struct properties *config, const char *name, _this->config = config; do_start = 0; - if (l2tpd_config_str_equal(_this, CFG_KEY(name, "enabled"), "true", + if (l2tpd_config_str_equal(_this, CFG_KEY(name, "enabled"), "true", default_enabled)) { /* care the case false-true flapping */ - if (l2tpd_is_shutting_down(_this)) + if (l2tpd_is_shutting_down(_this)) l2tpd_stop_immediatly(_this); if (l2tpd_is_stopped(_this)) do_start = 1; @@ -737,7 +738,7 @@ l2tpd_io_event(int fd, short evtype, void *ctx) (struct sockaddr *)&sock, nat_t, buf, sz); else - l2tpd_log_access_deny(_l2tpd, + l2tpd_log_access_deny(_l2tpd, "not allowed by acl.", (struct sockaddr *)&peer); break; diff --git a/usr.sbin/npppd/npppd/Makefile b/usr.sbin/npppd/npppd/Makefile index 0c25eafffdd..a039b7c7b2f 100644 --- a/usr.sbin/npppd/npppd/Makefile +++ b/usr.sbin/npppd/npppd/Makefile @@ -1,8 +1,5 @@ -# $OpenBSD: Makefile,v 1.5 2010/07/01 03:38:17 yasuoka Exp $ -# $OpenBSD: Makefile,v 1.5 2010/07/01 03:38:17 yasuoka Exp $ -# -# $Id -# +# $OpenBSD: Makefile,v 1.6 2010/07/02 21:20:57 yasuoka Exp $ + NPPPD_COMMON_DIR= ${.CURDIR}/../common PROG= npppd diff --git a/usr.sbin/npppd/npppd/ccp.c b/usr.sbin/npppd/npppd/ccp.c index 2767a50cda3..bfe283bd6b3 100644 --- a/usr.sbin/npppd/npppd/ccp.c +++ b/usr.sbin/npppd/npppd/ccp.c @@ -1,3 +1,5 @@ +/* $OpenBSD: ccp.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -26,7 +28,7 @@ /**@file * This file provides functions for CCP (Compression Control Protocol). * MPPE is supported as a CCP option. - * $Id: ccp.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: ccp.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/socket.h> @@ -47,7 +49,7 @@ #define CCPDEBUG(x) fsm_log(x) #define CCP_ASSERT(x) ASSERT(x) #else -#define CCPDEBUG(x) +#define CCPDEBUG(x) #define CCP_ASSERT(x) #endif @@ -250,7 +252,7 @@ ccp_addci(fsm *f, u_char *pktp, int *lpktp) PUTLONG(f->ppp->ccp.mppe_o_bits, pktp); *lpktp = pktp - pktp0; - } else + } else *lpktp = 0; } @@ -309,8 +311,8 @@ ccp_nackackci(fsm *f, u_char *pktp, int lpkt, int is_nak, int is_rej) } GETLONG(peer_bits, pktp); /* - * With Yamaha RTX-1000 that is configured as - * "ppp ccp mppe-any", + * With Yamaha RTX-1000 that is configured as + * "ppp ccp mppe-any", * * npppd ConfReq (40,56,128) => RTX 1000 * npppd <= (40,128) ConfNAK RTX 1000 @@ -321,7 +323,7 @@ ccp_nackackci(fsm *f, u_char *pktp, int lpkt, int is_nak, int is_rej) * the longest bit if our request is nacked. */ our_bits = mppe_create_our_bits(&ppp->mppe, peer_bits); - if (peer_bits == our_bits || is_nak) + if (peer_bits == our_bits || is_nak) ppp->ccp.mppe_o_bits = our_bits; break; diff --git a/usr.sbin/npppd/npppd/chap.c b/usr.sbin/npppd/npppd/chap.c index b7c1cc63485..88c7e679bfe 100644 --- a/usr.sbin/npppd/npppd/chap.c +++ b/usr.sbin/npppd/npppd/chap.c @@ -1,3 +1,5 @@ +/* $OpenBSD: chap.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -34,7 +36,7 @@ * </ul></p> */ /* RFC 1994, 2433 */ -/* $Id: chap.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: chap.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> @@ -102,8 +104,8 @@ abort(); \ } #else -#define CHAP_ASSERT(cond) -#define CHAP_DBG(x) +#define CHAP_ASSERT(cond) +#define CHAP_DBG(x) #endif static void chap_authenticate(chap *_this, u_char *, int); @@ -355,7 +357,7 @@ chap_failure(chap *_this, const char *msg, int mschapv2err) } static void -chap_authenticate(chap *_this, u_char *response, int lresponse) +chap_authenticate(chap *_this, u_char *response, int lresponse) { switch(_this->type) { @@ -629,7 +631,7 @@ mschapv2_send_error(chap *_this, int error, int can_retry) /* * We don't use "M=<msg>" * - pppd on Mac OS 10.4 hungs up if it received a failure packet - * with "M=<msg>". + * with "M=<msg>". * - RRAS on windows server 2003 never uses "M=". */ snprintf(pkt, lpkt, "E=%d R=%d C=%02x%02x%02x%02x%02x%02x%02x%02x" @@ -777,10 +779,10 @@ chap_radius_authenticate(chap *_this, int id, char *username, md5response[0] = _this->challid; memcpy(&md5response[1], response, 16); - if (radius_put_raw_attr(radpkt, + if (radius_put_raw_attr(radpkt, RADIUS_TYPE_CHAP_PASSWORD, md5response, 17) != 0) goto fail; - if (radius_put_raw_attr(radpkt, + if (radius_put_raw_attr(radpkt, RADIUS_TYPE_CHAP_CHALLENGE, challenge, 16) != 0) goto fail; break; diff --git a/usr.sbin/npppd/npppd/chap_ms.c b/usr.sbin/npppd/npppd/chap_ms.c index e62e9ad1fbf..c19cfe880a8 100644 --- a/usr.sbin/npppd/npppd/chap_ms.c +++ b/usr.sbin/npppd/npppd/chap_ms.c @@ -1,3 +1,5 @@ +/* $OpenBSD: chap_ms.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 1997 Gabor Kincses <gabor@acm.org> * 1997 - 2001 Brian Somers <brian@Awfulhak.org> @@ -145,7 +147,7 @@ ChallengeResponse(u_char *challenge, u_char *pwHash, u_char *response) void NtPasswordHash(char *key, int keylen, char *hash) -{ +{ MD4_CTX MD4context; MD4Init(&MD4context); @@ -155,7 +157,7 @@ NtPasswordHash(char *key, int keylen, char *hash) void HashNtPasswordHash(char *hash, char *hashhash) -{ +{ MD4_CTX MD4context; MD4Init(&MD4context); @@ -172,14 +174,14 @@ ChallengeHash(char *PeerChallenge, char *AuthenticatorChallenge, char *Name; Name = strrchr(UserName, '\\'); - if(NULL == Name) + if(NULL == Name) Name = UserName; else Name++; SHA1_Init(&Context); - SHA1_Update(&Context, PeerChallenge, 16); + SHA1_Update(&Context, PeerChallenge, 16); SHA1_Update(&Context, AuthenticatorChallenge, 16); SHA1_Update(&Context, Name, strlen(Name)); @@ -268,7 +270,7 @@ GenerateAuthenticatorResponse(char *Password, int PasswordLen, SHA1_Update(&Context, NTResponse, 24); SHA1_Update(&Context, Magic1, 39); SHA1_Final(Digest, &Context); - ChallengeHash(PeerChallenge, AuthenticatorChallenge, UserName, UserNameLen, + ChallengeHash(PeerChallenge, AuthenticatorChallenge, UserName, UserNameLen, Challenge); SHA1_Init(&Context); SHA1_Update(&Context, Digest, 20); @@ -289,7 +291,7 @@ GenerateAuthenticatorResponse(char *Password, int PasswordLen, AuthenticatorResponse[i] = toupper((unsigned char)AuthenticatorResponse[i]); } - + void GetMasterKey(char *PasswordHashHash, char *NTResponse, char *MasterKey) { diff --git a/usr.sbin/npppd/npppd/chap_ms.h b/usr.sbin/npppd/npppd/chap_ms.h index a8203884f98..0c50e4897df 100644 --- a/usr.sbin/npppd/npppd/chap_ms.h +++ b/usr.sbin/npppd/npppd/chap_ms.h @@ -1,3 +1,5 @@ +/* $OpenBSD: chap_ms.h,v 1.2 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 1997 Gabor Kincses <gabor@acm.org> * 1997 - 2001 Brian Somers <brian@Awfulhak.org> @@ -32,7 +34,7 @@ /* Max # of (Unicode) chars in an NT password */ #define MAX_NT_PASSWORD 256 -/* Don't rely on sizeof(MS_ChapResponse) in case of struct padding */ +/* Don't rely on sizeof(MS_ChapResponse) in case of struct padding */ #define MS_CHAP_RESPONSE_LEN 49 #define CHAP81_RESPONSE_LEN 49 #define CHAP81_NTRESPONSE_LEN 24 diff --git a/usr.sbin/npppd/npppd/eap.c b/usr.sbin/npppd/npppd/eap.c index c0ddc3a766b..fd932f162d6 100644 --- a/usr.sbin/npppd/npppd/eap.c +++ b/usr.sbin/npppd/npppd/eap.c @@ -1,3 +1,5 @@ +/* $OpenBSD: eap.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -32,7 +34,7 @@ * RADIUS (Remote Authentication Dial In User Service) Support For * Extensible Authentication Protocol (EAP). B. Aboba, P. Calhoun. */ -/* $Id: eap.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: eap.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /* FIXME: This must be rewritten. */ @@ -84,7 +86,7 @@ #define EAP_DEBUG #ifdef EAP_DEBUG -#define EAP_DBG(x) eap_log x +#define EAP_DBG(x) eap_log x #define EAP_ASSERT(cond) \ if (!(cond)) { \ fprintf(stderr, \ @@ -93,8 +95,8 @@ abort(); \ } #else -#define EAP_ASSERT(cond) -#define EAP_DBG(x) +#define EAP_ASSERT(cond) +#define EAP_DBG(x) #endif #define TMPBUF 256 @@ -135,8 +137,8 @@ eap_start(eap *_this) EAP_ASSERT(_this != NULL); EAP_ASSERT(_this->ppp != NULL); - /* - * initialize for timeout callback + /* + * initialize for timeout callback */ _this->name_len = 0; memset(_this->name, 0, sizeof(_this->name)); @@ -144,7 +146,7 @@ eap_start(eap *_this) memset(_this->attr_state, 0, RADIUS_ATTR_STATE_LEN); if (_this->state == EAP_STATE_INITIAL || - _this->state == EAP_STATE_SEND_REQUEST_TO_PEER){ + _this->state == EAP_STATE_SEND_REQUEST_TO_PEER){ if (_this->ntry > 0) { _this->ntry--; @@ -169,12 +171,12 @@ eap_start(eap *_this) if (_this->eapid == 0) _this->eapid = INIT_EAPID; - else + else _this->eapid++; - /* + /* * send eap request - */ + */ ppp_output(_this->ppp, PPP_PROTO_EAP, EAP_REQUEST, _this->eapid, req0, req - req0); _this->state = EAP_STATE_SEND_REQUEST_TO_PEER; @@ -209,7 +211,7 @@ eap_restart(eap *_this) { eap_start(_this); } -void +void eap_input(eap *_this, unsigned char *pktp, int len){ u_int8_t *pkthp; int code, id, length, type; @@ -221,7 +223,7 @@ eap_input(eap *_this, unsigned char *pktp, int len){ return; } pkthp = pktp; - + UNTIMEOUT(eap_restart, _this); if(len < EAP_HEADERLEN + 1){ @@ -237,7 +239,7 @@ eap_input(eap *_this, unsigned char *pktp, int len){ "Recieved unexpected packet from peer (code = %d)", code); return; } - + GETCHAR(id, pkthp); if (id != _this->eapid) { /* discard */ @@ -249,7 +251,7 @@ eap_input(eap *_this, unsigned char *pktp, int len){ /* * get user name from itentity response - */ + */ GETSHORT(length, pkthp); GETCHAR(type, pkthp); if (type == PPP_AUTH_EAP_IDENTITY && _this->name_len == 0) { @@ -268,19 +270,19 @@ eap_input(eap *_this, unsigned char *pktp, int len){ _this->name_len = 0; eap_log(_this, LOG_ERR, "Identity name is too long"); - return; + return; } } } if (type == PPP_AUTH_EAP_NAK){ - /* + /* * Nak check */ _this->flags |= PPP_EAP_FLAG_NAK_RESPONSE; eap_log(_this, LOG_DEBUG, "peer response is nak"); } - + if(_this->name_len != 0){ eap_forward_to_radius(_this, pktp, len); return; @@ -288,8 +290,8 @@ eap_input(eap *_this, unsigned char *pktp, int len){ /* unexpected process * discard - */ - eap_log(_this, LOG_DEBUG, + */ + eap_log(_this, LOG_DEBUG, "recieve eap length = %d, " "eap info: code = %d, id = %d, length = %d, type = %d, " "name length = %d", @@ -317,8 +319,8 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) */ if (npppd_ppp_bind_realm(_this->ppp->pppd, _this->ppp, _this->name, 1) != 0) { - /* - * internal error + /* + * internal error * retry */ eap_log(_this, LOG_ERR, "Not found realm"); @@ -329,8 +331,8 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) if (npppd_ppp_is_realm_radius( _this->ppp->pppd, _this->ppp) == 0) { /* - * internal error - * retry + * internal error + * retry */ eap_log(_this, LOG_ERR, "Not found realm"); retry = 1; @@ -340,22 +342,22 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) if ((rad_setting = npppd_get_radius_req_setting( _this->ppp->pppd, _this->ppp)) == NULL) { /* - * internal error - * retry + * internal error + * retry */ eap_log(_this, LOG_ERR, "Not found radius server setting"); retry = 1; goto fail; } - /* + /* * make new request packet - */ + */ if ((radpkt = radius_new_request_packet(RADIUS_CODE_ACCESS_REQUEST)) == NULL){ - /* - * internal error - * retry + /* + * internal error + * retry */ eap_log(_this, LOG_ERR, "Can't make new request packet"); retry = 1; @@ -365,8 +367,8 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) if (ppp_set_radius_attrs_for_authreq(_this->ppp, rad_setting, radpkt) != 0) { /* - * internal error - * retry + * internal error + * retry */ retry = 1; goto fail; @@ -376,34 +378,34 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) if (radius_put_uint32_attr(radpkt, RADIUS_TYPE_FRAMED_MTU, _this->ppp->mru) != 0) { /* - * internal error - * retry + * internal error + * retry */ retry = 1; goto fail; } - /* - * set user name attribute - */ + /* + * set user name attribute + */ if (_this->name_len != 0) { - if (radius_put_string_attr(radpkt, RADIUS_TYPE_USER_NAME, + if (radius_put_string_attr(radpkt, RADIUS_TYPE_USER_NAME, npppd_ppp_get_username_for_auth(_this->ppp->pppd, _this->ppp, _this->name, buf0)) != 0) { - /* + /* * internal error * retry */ - eap_log(_this, LOG_ERR, - "Can't put attribute to radius packet. type = %d", + eap_log(_this, LOG_ERR, + "Can't put attribute to radius packet. type = %d", RADIUS_TYPE_USER_NAME); retry = 1; goto fail; } } else { /* - * none Identity - * discard + * none Identity + * discard */ eap_log(_this, LOG_NOTICE, "Identity name is not seted"); goto fail; @@ -413,16 +415,16 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) * set state attribute */ if (_this->attr_state_len != 0) { - if (radius_put_raw_attr(radpkt, - RADIUS_TYPE_STATE, - _this->attr_state, + if (radius_put_raw_attr(radpkt, + RADIUS_TYPE_STATE, + _this->attr_state, _this->attr_state_len) != 0) { - /* + /* * internal error * discard - */ - eap_log(_this, LOG_ERR, - "Can't put attribute to radius packet. type = %d", + */ + eap_log(_this, LOG_ERR, + "Can't put attribute to radius packet. type = %d", RADIUS_TYPE_STATE); goto fail; } @@ -434,14 +436,14 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) */ while (rlength > 0) { if (rlength > 253) { - if (radius_put_raw_attr(radpkt, - RADIUS_TYPE_EAP_MESSAGE, + if (radius_put_raw_attr(radpkt, + RADIUS_TYPE_EAP_MESSAGE, data+(datalen-rlength), 253) != 0) { - /* - * internal error - * retry + /* + * internal error + * retry */ - eap_log(_this, LOG_ERR, + eap_log(_this, LOG_ERR, "Can't put attribute to radius packet. " "type = %d", RADIUS_TYPE_EAP_MESSAGE); retry = 1; @@ -449,15 +451,15 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) } rlength -= 253; } else { - if (radius_put_raw_attr(radpkt, - RADIUS_TYPE_EAP_MESSAGE, - data+(datalen-rlength), + if (radius_put_raw_attr(radpkt, + RADIUS_TYPE_EAP_MESSAGE, + data+(datalen-rlength), rlength) != 0) { /* * internal error * retry - */ - eap_log(_this, LOG_ERR, + */ + eap_log(_this, LOG_ERR, "Can't put attribute to radius packet. " "type = %d", RADIUS_TYPE_EAP_MESSAGE); retry = 1; @@ -473,10 +475,10 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) if (_this->radctx != NULL) radius_cancel_request(_this->radctx); - /* - * prepare request + /* + * prepare request */ - if (_this->session_timeout != 0) + if (_this->session_timeout != 0) /* * FIXME: Is the timer other than authentication timeout timer really * FIXME: necessary? @@ -486,8 +488,8 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) timeout = _this->ppp->auth_timeout; if (radius_prepare(rad_setting, _this, &radctx, eap_recv_from_radius, timeout) != 0) { - /* - * internal error + /* + * internal error * retry */ eap_log(_this, LOG_ERR, "Can't prepare to send access request " @@ -501,15 +503,15 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) } _this->radctx = radctx; - /* - * get secret password - * for radius + /* + * get secret password + * for radius */ secret = radius_get_server_secret(_this->radctx); secretlen = strlen(secret); - /* - * set message authenticator attribute + /* + * set message authenticator attribute */ if (radius_put_message_authenticator(radpkt, secret) != 0) { eap_log(_this, LOG_ERR, "couldn't put message authentication " @@ -520,8 +522,8 @@ eap_forward_to_radius(eap *_this, u_int8_t *data, int datalen) radius_get_authenticator(radpkt, _this->authenticator); - /* - * send request + /* + * send request */ radius_request(_this->radctx, radpkt); return; @@ -532,7 +534,7 @@ fail: if (radpkt != NULL) radius_delete_packet(radpkt); eap_log(_this, LOG_NOTICE, "Can't forward packet to radius from peer"); - if (retry) { + if (retry) { eap_restart(_this); } return; @@ -551,7 +553,7 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) u_char msgbuf[4096], *cp; /* FIXME: May be enough? */ int len; u_int8_t attrlen = 0; - + u_int8_t eap_code = 0; u_int8_t eap_id = 0; size_t eap_length; @@ -564,24 +566,24 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) _this = context; radctx = _this->radctx; errorCode = ERROR_AUTH_SERVER_TIMEOUT; - _this->radctx = NULL; + _this->radctx = NULL; if (pkt == NULL) { if (flags & RADIUS_REQUST_TIMEOUT) { /* - * timeout + * timeout * retry */ eap_log(_this, LOG_WARNING, "Timeout radius response"); retry = 1; notify_reason = "timeout"; } else { - /* + /* * internal error * retry */ eap_log(_this, LOG_WARNING, - "Internal error with radius packet"); + "Internal error with radius packet"); retry = 1; notify_reason = "intenal error"; } @@ -591,7 +593,7 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) if(!(flags && RADIUS_REQUST_CHECK_AUTHENTICTOR_NO_CHECK) && !(flags && RADIUS_REQUST_CHECK_AUTHENTICTOR_OK)){ /* discard */ - eap_log(_this, LOG_WARNING, "Header has invalid authticator"); + eap_log(_this, LOG_WARNING, "Header has invalid authticator"); notify_reason = "bad authenticator"; retry = 1; goto auth_failed; @@ -603,9 +605,9 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) secret = radius_get_server_secret(radctx); secretlen = strlen(secret); - /* - * get radius code - */ + /* + * get radius code + */ code = radius_get_code(pkt); if (radius_check_message_authenticator(pkt, secret) != 0) { eap_log(_this, LOG_WARNING, "bad message authenticator."); @@ -622,7 +624,7 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) /* * check reject */ - if ((_this->flags & PPP_EAP_FLAG_NAK_RESPONSE) + if ((_this->flags & PPP_EAP_FLAG_NAK_RESPONSE) && code == RADIUS_CODE_ACCESS_REJECT) { /* * nak and reject @@ -633,7 +635,7 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) /* * reject */ - eap_log(_this, LOG_NOTICE, "Authentication reject"); + eap_log(_this, LOG_NOTICE, "Authentication reject"); } else { /* * discard @@ -646,7 +648,7 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) goto auth_failed; } if (attrlen < 4) { - /* + /* * discard */ eap_log(_this, LOG_WARNING, "EAP message is too short"); @@ -663,9 +665,9 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) */ if (code == RADIUS_CODE_ACCESS_CHALLENGE) { _this->attr_state_len = RADIUS_ATTR_STATE_LEN; - if (radius_get_raw_attr(pkt, - RADIUS_TYPE_STATE, - _this->attr_state, + if (radius_get_raw_attr(pkt, + RADIUS_TYPE_STATE, + _this->attr_state, &(_this->attr_state_len)) != 0) { /* discard */ eap_log(_this, LOG_ERR, "Not found state attribute"); @@ -680,18 +682,18 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) } } - /* + /* * get session timeout field */ - if (radius_get_uint32_attr(pkt, RADIUS_TYPE_SESSION_TIMEOUT, + if (radius_get_uint32_attr(pkt, RADIUS_TYPE_SESSION_TIMEOUT, &_this->session_timeout) == 0) { - if (_this->session_timeout > EAP_TIMEOUT_MAX) + if (_this->session_timeout > EAP_TIMEOUT_MAX) _this->session_timeout = EAP_TIMEOUT_MAX; - eap_log(_this, LOG_DEBUG, "Found session timeout attribute"); + eap_log(_this, LOG_DEBUG, "Found session timeout attribute"); } - /* - * get eap message attribute + /* + * get eap message attribute */ if (radius_get_raw_attr_all(pkt, RADIUS_TYPE_EAP_MESSAGE, NULL, &len) != 0) { @@ -715,12 +717,12 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) goto auth_failed; } - /* - * forwarding validation + /* + * forwarding validation * RFC 3579, RFC 3784 - * - */ - finish = 0; + * + */ + finish = 0; switch (code) { case RADIUS_CODE_ACCESS_REQUEST: eap_log(_this, LOG_INFO, @@ -731,49 +733,49 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) case RADIUS_CODE_ACCESS_REJECT: switch (eap_code) { case EAP_REQUEST: - eap_log(_this, LOG_INFO, "Abnormal reject"); + eap_log(_this, LOG_INFO, "Abnormal reject"); eap_stop(_this); ppp_stop(_this->ppp, "Authentication failed"); finish = 1; break; case EAP_RESPONSE: - eap_log(_this, LOG_INFO, - "Unexpected eap code(access reject)"); + eap_log(_this, LOG_INFO, + "Unexpected eap code(access reject)"); goto auth_failed; break; case EAP_FAILURE: - eap_log(_this, LOG_INFO, "Eap failure"); + eap_log(_this, LOG_INFO, "Eap failure"); eap_stop(_this); - finish = eap_forward_to_peer(_this, + finish = eap_forward_to_peer(_this, msgbuf+EAP_HEADERLEN, len-EAP_HEADERLEN, eap_code, eap_id); break; case EAP_SUCCESS: default: - eap_log(_this, LOG_INFO, + eap_log(_this, LOG_INFO, "Invalid combination code: radius code = %d and " "eap code = %d", code ,eap_code); goto auth_failed; break; } - break; + break; case RADIUS_CODE_ACCESS_ACCEPT: switch (eap_code) { case EAP_REQUEST: - finish = eap_forward_to_peer(_this, + finish = eap_forward_to_peer(_this, msgbuf+EAP_HEADERLEN, len-EAP_HEADERLEN, eap_code, eap_id); break; case EAP_RESPONSE: - eap_log(_this, LOG_INFO, - "unexpected eap code(access accept)"); + eap_log(_this, LOG_INFO, + "unexpected eap code(access accept)"); goto auth_failed; break; case EAP_FAILURE: - eap_log(_this, LOG_INFO, + eap_log(_this, LOG_INFO, "Invalid combination code: radius code = %d and " "eap code = %d", - code ,eap_code); + code ,eap_code); goto auth_failed; break; case EAP_SUCCESS: @@ -793,45 +795,45 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) "encryption"); } } else { - eap_log(_this, LOG_DEBUG, + eap_log(_this, LOG_DEBUG, "Found attribute of mppe keys"); } #endif - finish = eap_forward_to_peer(_this, + finish = eap_forward_to_peer(_this, msgbuf+EAP_HEADERLEN, len-EAP_HEADERLEN, eap_code, eap_id); break; default: - eap_log(_this, LOG_INFO, + eap_log(_this, LOG_INFO, "Invalid combination code: radius code = %d and " "eap code = %d", code ,eap_code); goto auth_failed; break; } - break; + break; case RADIUS_CODE_ACCESS_CHALLENGE: switch (eap_code) { case EAP_REQUEST: - finish = eap_forward_to_peer(_this, + finish = eap_forward_to_peer(_this, msgbuf+EAP_HEADERLEN, len-EAP_HEADERLEN, eap_code, eap_id); break; case EAP_RESPONSE: - eap_log(_this, LOG_INFO, - "Unexpected eap code(access challenge)"); + eap_log(_this, LOG_INFO, + "Unexpected eap code(access challenge)"); goto auth_failed; break; case EAP_FAILURE: case EAP_SUCCESS: default: - eap_log(_this, LOG_INFO, + eap_log(_this, LOG_INFO, "Invalid combination code: radius code = %d and " "eap code = %d", code ,eap_code); goto auth_failed; break; - } - /* XXX TODO:not forward EAP-START */ + } + /* XXX TODO:not forward EAP-START */ break; default: eap_log(_this, LOG_INFO, @@ -853,7 +855,7 @@ eap_recv_from_radius(void *context, RADIUS_PACKET *pkt, int flags) return; auth_failed: - eap_log(_this, LOG_WARNING, + eap_log(_this, LOG_WARNING, "Can't forward packet to peer from radius"); if (notify_reason != NULL) { npppd_radius_server_failure_notify( @@ -921,9 +923,9 @@ eap_forward_to_peer(eap *_this, u_int8_t *data, int datalen, int type, u_int8_t EAP_ASSERT(data != NULL); switch (type) { - case EAP_REQUEST: + case EAP_REQUEST: ppp_output(_this->ppp, PPP_PROTO_EAP, EAP_REQUEST, id, data, - datalen); + datalen); break; case EAP_SUCCESS: ppp_output(_this->ppp, PPP_PROTO_EAP, EAP_SUCCESS, id, data, @@ -936,7 +938,7 @@ eap_forward_to_peer(eap *_this, u_int8_t *data, int datalen, int type, u_int8_t break; case EAP_FAILURE: ppp_output(_this->ppp, PPP_PROTO_EAP, EAP_FAILURE, id, data, - datalen); + datalen); eap_log(_this, LOG_INFO, "eap-failure has been received from the peer."); eap_log(_this, LOG_INFO, "Authentication failed"); eap_stop(_this); diff --git a/usr.sbin/npppd/npppd/fsm.c b/usr.sbin/npppd/npppd/fsm.c index f21b1d93424..69487a0bb7a 100644 --- a/usr.sbin/npppd/npppd/fsm.c +++ b/usr.sbin/npppd/npppd/fsm.c @@ -1,3 +1,5 @@ +/* $OpenBSD: fsm.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /**@file * This file was adapted from NetBSD:/usr/src/usr.sbin/pppd/pppd/fsm.c */ @@ -72,7 +74,7 @@ __RCSID("$NetBSD: fsm.c,v 1.13 2000/09/23 22:39:35 christos Exp $"); #define FSMDEBUG(x) fsm_log x #define FSM_ASSERT(x) ASSERT(x) #else -#define FSMDEBUG(x) +#define FSMDEBUG(x) #define FSM_ASSERT(x) #endif @@ -383,28 +385,28 @@ fsm_input(f, inpacket, l) case CONFREQ: fsm_rconfreq(f, id, inp, len); break; - + case CONFACK: fsm_rconfack(f, id, inp, len); break; - + case CONFNAK: case CONFREJ: fsm_rconfnakrej(f, code, id, inp, len); break; - + case TERMREQ: fsm_rtermreq(f, id, inp, len); break; - + case TERMACK: fsm_rtermack(f); break; - + case CODEREJ: fsm_rcoderej(f, inp, len); break; - + default: if( !f->callbacks->extcode || !(*f->callbacks->extcode)(f, code, id, inp, len) ) @@ -778,7 +780,7 @@ fsm_sconfreq(f, retransmit) if (f->callbacks->addci) (*f->callbacks->addci)(f, outp, &cilen); } else - cilen = 0; + cilen = 0; /* send the request to our peer */ fsm_sdata(f, CONFREQ, f->reqid, outp, cilen); diff --git a/usr.sbin/npppd/npppd/fsm.h b/usr.sbin/npppd/npppd/fsm.h index be46df47177..1ada8c850fa 100644 --- a/usr.sbin/npppd/npppd/fsm.h +++ b/usr.sbin/npppd/npppd/fsm.h @@ -1,5 +1,4 @@ -#ifndef FSM_H -#define FSM_H 1 +/* $OpenBSD: fsm.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /* $NetBSD: fsm.h,v 1.10 2000/09/23 22:39:35 christos Exp $ */ /* @@ -20,8 +19,10 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * Id: fsm.h,v 1.8 1999/11/15 01:51:50 paulus Exp + * Id: fsm.h,v 1.8 1999/11/15 01:51:50 paulus Exp */ +#ifndef FSM_H +#define FSM_H 1 /* * Packet header = Code, id, length. @@ -40,7 +41,7 @@ #define TERMACK 6 /* Termination Ack */ #define CODEREJ 7 /* Code Reject */ -struct evtimer_wrap { +struct evtimer_wrap { void *ctx; void (*func)(void *); struct event ev; diff --git a/usr.sbin/npppd/npppd/ipcp.c b/usr.sbin/npppd/npppd/ipcp.c index ed992c5ff12..4872d21c177 100644 --- a/usr.sbin/npppd/npppd/ipcp.c +++ b/usr.sbin/npppd/npppd/ipcp.c @@ -1,3 +1,5 @@ +/* $OpenBSD: ipcp.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -30,7 +32,7 @@ /* * RFC 1332, 1877 */ -/* $Id: ipcp.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: ipcp.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> @@ -51,7 +53,7 @@ #define IPCP_DBG(x) fsm_log x #define IPCP_ASSERT(x) ASSERT(x) #else -#define IPCP_DBG(x) +#define IPCP_DBG(x) #define IPCP_ASSERT(x) #endif @@ -320,7 +322,7 @@ do_reject: } if (rcode == -1) rcode = CONFACK; - + fail: switch (rcode) { case CONFREJ: diff --git a/usr.sbin/npppd/npppd/lcp.c b/usr.sbin/npppd/npppd/lcp.c index 726d05b5b0f..44e5f57b47e 100644 --- a/usr.sbin/npppd/npppd/lcp.c +++ b/usr.sbin/npppd/npppd/lcp.c @@ -1,3 +1,5 @@ +/* $OpenBSD: lcp.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -23,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: lcp.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: lcp.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file * This file provides LCP related functions. *<pre> @@ -57,7 +59,7 @@ #define LCP_DBG(x) fsm_log x #define LCP_ASSERT(x) ASSERT(x) #else -#define LCP_DBG(x) +#define LCP_DBG(x) #define LCP_ASSERT(x) #endif @@ -131,7 +133,7 @@ lcp_init(lcp *_this, npppd_ppp *ppp) PPP_FSM_CONFIG(&_this->fsm, maxnakloops, "lcp.max_nak_loop"); /* - * PPTP and L2TP are able to detect lost carrier, so LCP ECHO is off + * PPTP and L2TP are able to detect lost carrier, so LCP ECHO is off * by default. */ _this->echo_interval = 0; @@ -265,7 +267,7 @@ lcp_cilen(fsm *f) /** * selecting authentication protocols which is not rejected yet in order - * of auth_order, and adding Authentication-Protocol options in ConfReq + * of auth_order, and adding Authentication-Protocol options in ConfReq * packet area. */ static int @@ -424,7 +426,7 @@ lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) goto fail; switch (type) { - case PPP_LCP_MRU: + case PPP_LCP_MRU: if (len != 4) goto fail; GETSHORT(mru, inp); @@ -448,7 +450,7 @@ lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) } else LCP_OPT_PEER_ACCEPTED(mru); break; - case PPP_LCP_MAGICNUMBER: + case PPP_LCP_MAGICNUMBER: if (len != 6) goto fail; GETLONG(magic, inp); @@ -459,12 +461,12 @@ lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) _this->peer_magic_number = magic; break; case PPP_LCP_PFC: - if (len != 2) + if (len != 2) goto fail; LCP_OPT_PEER_ACCEPTED(pfc); break; case PPP_LCP_ACFC: - if (len != 2) + if (len != 2) goto fail; LCP_OPT_PEER_ACCEPTED(acfc); break; @@ -533,20 +535,20 @@ lcp_ackci(fsm *f, u_char *inp, int inlen) switch (type) { case PPP_LCP_MAGICNUMBER: - if (len != 6) + if (len != 6) goto fail; GETLONG(magic, inp); if (f->ppp->lcp.magic_number != magic) goto fail; break; case PPP_LCP_MRU: - if (len != 4) + if (len != 4) goto fail; LCP_OPT_ACCEPTED(mru); GETSHORT(mru, inp); break; case PPP_LCP_AUTH_PROTOCOL: - if (len < 4) + if (len < 4) goto fail; GETSHORT(authproto, inp); switch (authproto) { @@ -634,7 +636,7 @@ lcp_nakci(fsm *f, u_char *inp, int inlen) switch (type) { case PPP_LCP_MRU: - if (len < 4) + if (len < 4) goto fail; GETSHORT(mru, inp); fsm_log(f, LOG_NOTICE, @@ -642,7 +644,7 @@ lcp_nakci(fsm *f, u_char *inp, int inlen) _this->xxxmru = mru; break; case PPP_LCP_AUTH_PROTOCOL: - if (len < 4) + if (len < 4) goto fail; switch (_this->lastauth) { case PPP_AUTH_PAP: @@ -770,7 +772,7 @@ lcp_rejci(fsm *f, u_char *inp, int inlen) GETSHORT(mru, inp); break; case PPP_LCP_AUTH_PROTOCOL: - if (len < 4) + if (len < 4) goto fail; GETSHORT(authproto, inp); switch (authproto) { @@ -994,7 +996,7 @@ lcp_ext(fsm *f, int code, int id, u_char *inp, int inlen) /* - * reading some authentication settings and storing ppp_order in + * reading some authentication settings and storing ppp_order in * order of settings. */ static void @@ -1038,7 +1040,7 @@ lcp_load_authconfig(fsm *f) _this->auth_order[i++] = PPP_AUTH_CHAP_MS_V2; psm_opt_set_enabled(_this,chapms_v2, 1); #ifdef USE_NPPPD_EAP_RADIUS - } else if (strcasecmp("EAP-RADIUS", authp) == 0) { + } else if (strcasecmp("EAP-RADIUS", authp) == 0) { _this->auth_order[i++] = PPP_AUTH_EAP; psm_opt_set_enabled(_this, eap, 1); #endif @@ -1061,7 +1063,7 @@ lcp_load_authconfig(fsm *f) /** * This function set LCP status following dialin proxy information. * This returns non-zero value when LCP status is unacceptable. - * + * */ int lcp_dialin_proxy(lcp *_this, dialin_proxy_info *dpi, int renegotiation, @@ -1177,7 +1179,7 @@ lcp_proxy_recv_ci(fsm *f, u_char *inp, int inlen) goto fail; switch (type) { - case PPP_LCP_MRU: + case PPP_LCP_MRU: if (len != 4) goto fail; GETSHORT(mru, inp); @@ -1187,7 +1189,7 @@ lcp_proxy_recv_ci(fsm *f, u_char *inp, int inlen) else LCP_OPT_PEER_ACCEPTED(mru); break; - case PPP_LCP_MAGICNUMBER: + case PPP_LCP_MAGICNUMBER: if (len != 6) goto fail; GETLONG(magic, inp); @@ -1196,12 +1198,12 @@ lcp_proxy_recv_ci(fsm *f, u_char *inp, int inlen) _this->peer_magic_number = magic; break; case PPP_LCP_PFC: - if (len != 2) + if (len != 2) goto fail; LCP_OPT_PEER_ACCEPTED(pfc); break; case PPP_LCP_ACFC: - if (len != 2) + if (len != 2) goto fail; LCP_OPT_PEER_ACCEPTED(acfc); break; @@ -1257,20 +1259,20 @@ lcp_proxy_sent_ci(fsm *f, u_char *inp, int inlen) switch (type) { case PPP_LCP_MAGICNUMBER: - if (len != 6) + if (len != 6) goto fail; GETLONG(magic, inp); f->ppp->lcp.magic_number = magic; break; case PPP_LCP_MRU: - if (len != 4) + if (len != 4) goto fail; LCP_OPT_ACCEPTED(mru); GETSHORT(mru, inp); f->ppp->lcp.xxxmru = mru; break; case PPP_LCP_AUTH_PROTOCOL: - if (len < 4) + if (len < 4) goto fail; GETSHORT(authproto, inp); switch (authproto) { diff --git a/usr.sbin/npppd/npppd/mppe.c b/usr.sbin/npppd/npppd/mppe.c index f68e5fbf5dd..ae6b389e61c 100644 --- a/usr.sbin/npppd/npppd/mppe.c +++ b/usr.sbin/npppd/npppd/mppe.c @@ -1,3 +1,5 @@ +/* $OpenBSD: mppe.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -23,10 +25,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: mppe.c,v 1.3 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: mppe.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file * - * The implementation of MPPE(Microsoft Point-To-Point Encryption Protocol) + * The implementation of MPPE(Microsoft Point-To-Point Encryption Protocol) */ /* * To avoid the PPP packet out of sequence problem. @@ -65,7 +67,7 @@ abort(); \ } #else -#define MPPE_DBG(x) +#define MPPE_DBG(x) #define MPPE_ASSERT(x) #endif @@ -246,7 +248,7 @@ mppe_start(mppe *_this) /** - * creating the mppe bits. In case of first proposal, it specifies the + * creating the mppe bits. In case of first proposal, it specifies the * peer_bits as 0 value. If it specifies the peer_bits, it returns the * value as peer's proposal. */ @@ -285,10 +287,10 @@ mppe_create_our_bits(mppe *_this, uint32_t peer_bits) if (peer_bits == 0) { /* * It proposes stateless mode in first time. Windows 9x has - * a bug that it is reverse to stateful and stateless in + * a bug that it is reverse to stateful and stateless in * sending and receiving packets. * Windows 9x is prior to negotiate in stateless mode, so - * it will avoid the Windows bug to be prior to negotiate + * it will avoid the Windows bug to be prior to negotiate * in stateless mode. * * Even if this bug doesn't exists, the stateful mode is high @@ -359,7 +361,7 @@ mppe_input(mppe *_this, u_char *pktp, int len) /* * In L2TP/IPsec implementation, in case that the ppp frame sequence * is not able to reconstruct and the ppp frame is out of sequence, it - * is unable to identify with many packets losing. If it does so, MPPE + * is unable to identify with many packets losing. If it does so, MPPE * key is out of place. * To avoid this problem, when it seems that more than 4096-256 packets * drops, it assumes that the packet doesn't lose but the packet is out @@ -425,9 +427,9 @@ mppe_input(mppe *_this, u_char *pktp, int len) if (pktloss > 1000) { /* * In case of many packets losing or out of sequence. - * The latter is not able to communicate because the key is + * The latter is not able to communicate because the key is * out of place soon. - * + * */ mppe_log(_this, LOG_WARNING, "%d packets loss", pktloss); } @@ -538,7 +540,7 @@ mppe_bits_to_string(uint32_t bits) , ((CCP_MPPE_NT_128bit& bits) != 0)? ",128bit" : "" , ((CCP_MPPE_NT_56bit& bits) != 0)? ",56bit" : "" , ((CCP_MPPE_STATELESS& bits) != 0)? ",stateless" : ",stateful"); - + if (buf[0] == '\0') return ""; diff --git a/usr.sbin/npppd/npppd/npppd.c b/usr.sbin/npppd/npppd/npppd.c index fab51150d5d..16765487d5e 100644 --- a/usr.sbin/npppd/npppd/npppd.c +++ b/usr.sbin/npppd/npppd/npppd.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -27,14 +29,14 @@ * Next pppd(nppd). This file provides a npppd daemon process and operations * for npppd instance. * @author Yasuoka Masahiko - * $Id: npppd.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: npppd.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/cdefs.h> #include "version.h" #ifndef LINT __COPYRIGHT( "@(#) npppd - PPP daemon for PPP Access Concentrators\n" -"@(#) Version " VERSION "\n" +"@(#) Version " VERSION "\n" "@(#) \n" "@(#) Copyright 2005-2008\n" "@(#) Internet Initiative Japan Inc. All rights reserved.\n" @@ -137,7 +139,7 @@ static void pipex_periodic(npppd *); #define NPPPD_DBG(x) log_printf x #define NPPPD_ASSERT(x) ASSERT(x) #else -#define NPPPD_DBG(x) +#define NPPPD_DBG(x) #define NPPPD_ASSERT(x) #endif @@ -367,7 +369,7 @@ npppd_init(npppd *_this, const char *config_file) return -1; /* - * If the npppd can start(open) interfaces successfully, it can + * If the npppd can start(open) interfaces successfully, it can * act as only one npppd process on the system and overwrite the pid * file. */ @@ -575,7 +577,7 @@ npppd_timer(int fd, short evtype, void *ctx) #ifdef USE_NPPPD_PIPEX pipex_periodic(_this); -#endif +#endif #ifdef NPPPD_USE_RT_ZEBRA if (!rt_zebra_is_running(rt_zebra_get_instance())) { rt_zebra_start(rt_zebra_get_instance()); @@ -631,7 +633,7 @@ npppd_reset_routing_table(npppd *_this, int pool_only) ppp_framed_ip_address, &ppp->ppp_framed_ip_netmask, &ppp_iface(ppp)->ip4addr, - ppp_iface(ppp)->ifname, 0, + ppp_iface(ppp)->ifname, 0, MRU_IPMTU(ppp->peer_mru)); } break; @@ -756,7 +758,7 @@ npppd_check_calling_number(npppd *_this, npppd_ppp *ppp) /** * This function finds a {@link npppd_ppp} instance that is assigned the - * specified ip address and returns it + * specified ip address and returns it * @param ipaddr IP Address(Specify in network byte order) */ npppd_ppp * @@ -896,7 +898,7 @@ npppd_network_output(npppd *_this, npppd_ppp *ppp, int proto, u_char *pktp, } #ifndef NO_INGRES_FILTER - if ((pip->ip_src.s_addr & ppp->ppp_framed_ip_netmask.s_addr) != + if ((pip->ip_src.s_addr & ppp->ppp_framed_ip_netmask.s_addr) != (ppp->ppp_framed_ip_address.s_addr & ppp->ppp_framed_ip_netmask.s_addr)) { char logbuf[80]; @@ -1033,10 +1035,10 @@ npppd_ppp_pipex_enable(npppd *_this, npppd_ppp *ppp) req.pr_proto.pptp.peer_maxwinsz = call->peers_maxwinsz; NPPPD_ASSERT(call->ctrl->peer.ss_family == AF_INET); - req.pr_proto.pptp.peer_address = + req.pr_proto.pptp.peer_address = ((struct sockaddr_in *)&call->ctrl->peer)->sin_addr; NPPPD_ASSERT(call->ctrl->our.ss_family == AF_INET); - req.pr_proto.pptp.our_address = + req.pr_proto.pptp.our_address = ((struct sockaddr_in *)&call->ctrl->our)->sin_addr; break; #endif @@ -1296,7 +1298,7 @@ npppd_set_ip_enabled(npppd *_this, npppd_ppp *ppp, int enabled) * makes many programs will wake up and do heavy operations, it causes * system overload, so we refrain useless changing route. */ - enabled = (enabled)? 1 : 0; + enabled = (enabled)? 1 : 0; was_enabled = (ppp->assigned_ip4_enabled != 0)? 1 : 0; if (enabled == was_enabled) return; @@ -1330,7 +1332,7 @@ npppd_set_ip_enabled(npppd *_this, npppd_ppp *ppp, int enabled) * There is a blackhole route that has same * address/mask. */ - in_route_delete(&ppp->ppp_framed_ip_address, + in_route_delete(&ppp->ppp_framed_ip_address, &ppp->ppp_framed_ip_netmask, &loop, RTF_BLACKHOLE); /* See the comment for MRU_IPMTU() on ppp.h */ if (ppp->ppp_framed_ip_netmask.s_addr == 0xffffffffL) { @@ -1431,7 +1433,7 @@ npppd_assign_ip_addr(npppd *_this, npppd_ppp *ppp, uint32_t req_ip4) npppd_pool *pool; npppd_auth_base *realm; - NPPPD_DBG((LOG_DEBUG, "%s() assigned=%s", __func__, + NPPPD_DBG((LOG_DEBUG, "%s() assigned=%s", __func__, (ppp_ip_assigned(ppp))? "true" : "false")); if (ppp_ip_assigned(ppp)) return 0; @@ -1549,7 +1551,7 @@ dyna_assign: } static void * -rtlist_remove(slist *prtlist, struct radish *radish) +rtlist_remove(slist *prtlist, struct radish *radish) { struct radish *r; @@ -1667,7 +1669,7 @@ npppd_set_radish(npppd *_this, void *radish_head) if (rval != 0) { errno = rval; ppp_log(((npppd_ppp *)snp->snp_data_ptr), - LOG_ERR, + LOG_ERR, "Fatal error on %s, cannot continue " "this ppp session: %m", __func__); if (!delppp0) @@ -1748,7 +1750,7 @@ npppd_get_all_users(npppd *_this, slist *users) snp = rd->rd_rtent; if (snp->snp_type == SNP_PPP) { if (slist_add(users, snp->snp_data_ptr) == NULL) { - log_printf(LOG_ERR, + log_printf(LOG_ERR, "slist_add() failed in %s: %m", __func__); goto fail; } @@ -1763,7 +1765,7 @@ fail: return 1; } -static int +static int rd2slist_walk(struct radish *rd, void *list0) { slist *list = list0; @@ -1860,7 +1862,7 @@ str_hash(const void *ptr, int sz) } /** - * Select a authentication realm that is for given {@link ::npppd_ppp PPP}. + * Select a authentication realm that is for given {@link ::npppd_ppp PPP}. * Return 0 on success. */ int @@ -1928,7 +1930,7 @@ npppd_ppp_bind_realm(npppd *_this, npppd_ppp *ppp, const char *username, int if (!npppd_auth_is_usable(realm1)) continue; if (eap_required && - !npppd_auth_is_eap_capable(realm1)) + !npppd_auth_is_eap_capable(realm1)) continue; if (strcmp(npppd_auth_get_label(realm1), tok) == 0) { @@ -2181,7 +2183,7 @@ npppd_auth_finalizer_periodic(npppd *_this) /* * For the realms with disposing flag, if the realm has assigned PPPs, - * disconnect them. If all PPPs are disconnected then free the realm. + * disconnect them. If all PPPs are disconnected then free the realm. */ NPPPD_DBG((DEBUG_LEVEL_2, "%s() called", __func__)); slist_itr_first(&_this->realms); diff --git a/usr.sbin/npppd/npppd/npppd.h b/usr.sbin/npppd/npppd/npppd.h index 6c86bfa7595..104914fb973 100644 --- a/usr.sbin/npppd/npppd/npppd.h +++ b/usr.sbin/npppd/npppd/npppd.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd.h,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -28,7 +30,7 @@ #define NPPPD_USER "_npppd" -#ifndef NPPPD_DEFAULT_TUN_IFNAME +#ifndef NPPPD_DEFAULT_TUN_IFNAME #define NPPPD_DEFAULT_TUN_IFNAME "tun0" #endif diff --git a/usr.sbin/npppd/npppd/npppd_auth.c b/usr.sbin/npppd/npppd/npppd_auth.c index 89ceab43c9d..479ef06888d 100644 --- a/usr.sbin/npppd/npppd/npppd_auth.c +++ b/usr.sbin/npppd/npppd/npppd_auth.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_auth.c,v 1.6 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +26,7 @@ * SUCH DAMAGE. */ /**@file authentication realm */ -/* $Id: npppd_auth.c,v 1.5 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: npppd_auth.c,v 1.6 2010/07/02 21:20:57 yasuoka Exp $ */ /* I hope to write the source code in npppd-independent as possible. */ #include <sys/types.h> #include <sys/stat.h> @@ -101,7 +103,7 @@ npppd_auth_create(int auth_type, const char *label, void *_npppd) } break; #endif - + default: NPPPD_AUTH_ASSERT(0); break; @@ -111,7 +113,7 @@ npppd_auth_create(int auth_type, const char *label, void *_npppd) } /** - * Call this function to make the object unusable. + * Call this function to make the object unusable. * <p> * {@link ::npppd_auth_base} objects is refered by the {@link ::npppd_ppp} * object. After this funcation is called, npppd will disconnect the PPP @@ -185,9 +187,9 @@ npppd_auth_reload(npppd_auth_base *base) base->eap_capable = npppd_auth_config_str_equal(base, "eap_capable", "true", 1); - base->strip_nt_domain = + base->strip_nt_domain = npppd_auth_config_str_equal(base, "strip_nt_domain", "true", 1); - base->strip_atmark_realm = + base->strip_atmark_realm = npppd_auth_config_str_equal(base, "strip_atmark_realm", "true", 0); base->has_acctlist = 0; @@ -239,7 +241,7 @@ fail: } /** - * This function gets specified user's password. The value 0 is returned + * This function gets specified user's password. The value 0 is returned * if the call succeeds. * * @param username username which gets the password @@ -249,7 +251,7 @@ fail: * @param lppassword pointer which indicates the length of * the buffer which stores the password. * @return A value 1 is returned if user is unknown. A value 2 is returned - * if password buffer is sufficient. A negative value is + * if password buffer is sufficient. A negative value is * returned if other error occurred. */ int @@ -388,9 +390,9 @@ npppd_auth_is_ready(npppd_auth_base *base) case NPPPD_AUTH_TYPE_LOCAL: return (base->acctlist_ready != 0)? 1 : 0; /* NOTREACHED */ - + case NPPPD_AUTH_TYPE_RADIUS: - return (base->acctlist_ready != 0 || + return (base->acctlist_ready != 0 || base->radius_ready != 0)? 1 : 0; /* NOTREACHED */ } @@ -515,7 +517,7 @@ npppd_auth_reload_acctlist(npppd_auth_base *base) "line too long", linno + 1); goto fail; } - + status = csvreader_parse(csv, line); } else { if (!feof(file)) { @@ -696,7 +698,7 @@ radius_server_address_load(radius_req_setting *radius, int idx, memset(&radius->server[idx], 0, sizeof(radius->server[0])); if (addrport_parse(address, IPPROTO_TCP, &ai) !=0) - return 1; + return 1; switch (ai->ai_family) { default: @@ -904,7 +906,7 @@ npppd_auth_config_prefix(npppd_auth_base *base) switch(base->type) { case NPPPD_AUTH_TYPE_LOCAL: return "auth.local.realm"; - + case NPPPD_AUTH_TYPE_RADIUS: return "auth.radius.realm"; diff --git a/usr.sbin/npppd/npppd/npppd_auth.h b/usr.sbin/npppd/npppd/npppd_auth.h index a520740fb3a..b3cf65bc049 100644 --- a/usr.sbin/npppd/npppd/npppd_auth.h +++ b/usr.sbin/npppd/npppd/npppd_auth.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_auth.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/npppd/npppd_auth_local.h b/usr.sbin/npppd/npppd/npppd_auth_local.h index 53e8da0e379..829e4d36f3d 100644 --- a/usr.sbin/npppd/npppd/npppd_auth_local.h +++ b/usr.sbin/npppd/npppd/npppd_auth_local.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_auth_local.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -118,6 +120,6 @@ static int npppd_auth_config_str_equal (npppd_auth_base *, const #define NPPPD_AUTH_DBG(x) npppd_auth_base_log x #define NPPPD_AUTH_ASSERT(x) ASSERT(x) #else -#define NPPPD_AUTH_DBG(x) +#define NPPPD_AUTH_DBG(x) #define NPPPD_AUTH_ASSERT(x) #endif diff --git a/usr.sbin/npppd/npppd/npppd_config.c b/usr.sbin/npppd/npppd/npppd_config.c index 2d07ecef13b..de088480154 100644 --- a/usr.sbin/npppd/npppd/npppd_config.c +++ b/usr.sbin/npppd/npppd/npppd_config.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_config.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -23,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: npppd_config.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: npppd_config.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ /*@file * This file provides functions which operates configuration and so on. */ @@ -61,8 +63,8 @@ #define NPPPD_CONFIG_DBG(x) log_printf x #define NPPPD_CONFIG_ASSERT(x) ASSERT(x) #else -#define NPPPD_CONFIG_DBG(x) -#define NPPPD_CONFIG_ASSERT(x) +#define NPPPD_CONFIG_DBG(x) +#define NPPPD_CONFIG_ASSERT(x) #endif @@ -90,7 +92,7 @@ NAMED_PREFIX_CONFIG_FUNCTIONS(npppd_ipcp_config, npppd_ipcp_config, npppd->properties, "ipcp", label); /*********************************************************************** - * Reading the configuration. This is the export function which + * Reading the configuration. This is the export function which * aggregates functions to read from each part. ***********************************************************************/ /** @@ -334,7 +336,7 @@ npppd_debug_log_reload(npppd *_this) FILE *debugfp; const char *sval; - if ((ival = npppd_config_int(_this, "debug.level", debuglevel)) == + if ((ival = npppd_config_int(_this, "debug.level", debuglevel)) == debuglevel) return; @@ -351,10 +353,10 @@ npppd_debug_log_reload(npppd *_this) fclose(debugfp); if (sval != NULL) { if ((debugfp = fopen(sval, "a+")) == NULL) { - log_printf(LOG_ERR, + log_printf(LOG_ERR, "Failed to open logfile %s: %m", sval); } else { - log_printf(LOG_INFO, + log_printf(LOG_INFO, "open logfile successfully %s", sval); debug_set_debugfp(debugfp); } @@ -374,7 +376,7 @@ npppd_ip_addr_pool_load(npppd *_this) rd_curr = _this->rd; rd_new = NULL; - + n = 0; if (!rd_inithead((void *)&rd_new, 0x41, sizeof(struct sockaddr_npppd), @@ -436,7 +438,7 @@ npppd_ip_addr_pool_load(npppd *_this) } } log_printf(LOG_INFO, "Loading pool config successfully."); - + return 0; fail: /* rollback */ @@ -498,7 +500,7 @@ npppd_auth_realm_reload(npppd *_this) if (auth_base != NULL && npppd_auth_get_type(auth_base) != NPPPD_AUTH_TYPE_LOCAL) { - /* + /* * The type of authentication realm was changed in the * same label name. */ @@ -538,7 +540,7 @@ npppd_auth_realm_reload(npppd *_this) if (auth_base != NULL && npppd_auth_get_type(auth_base) != NPPPD_AUTH_TYPE_RADIUS) { - /* + /* * The type of authentication realm was changed in the * same label name. */ diff --git a/usr.sbin/npppd/npppd/npppd_ctl.c b/usr.sbin/npppd/npppd/npppd_ctl.c index 204f69c2ebc..0f89a200d79 100644 --- a/usr.sbin/npppd/npppd/npppd_ctl.c +++ b/usr.sbin/npppd/npppd/npppd_ctl.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_ctl.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -28,7 +30,7 @@ * This file provides to open UNIX domain socket which located in * /var/run/npppd_ctl and accept commmands from the npppdctl command. */ -/* $Id: npppd_ctl.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: npppd_ctl.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> @@ -88,7 +90,7 @@ } #else #define NPPPD_CTL_DBG(x) -#define NPPPD_CTL_ASSERT(cond) +#define NPPPD_CTL_ASSERT(cond) #endif #include "debugutil.h" @@ -281,11 +283,11 @@ cmd_who_send_error: NPPPD_CTL_DBG((_this, LOG_DEBUG, "sendto() failed in %s: %m", __func__)); if (errno == ENOBUFS || errno == EMSGSIZE || errno == EINVAL) { - npppd_ctl_log(_this, LOG_INFO, + npppd_ctl_log(_this, LOG_INFO, "'who' is requested, but " "the buffer is not enough."); } else { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "sendto() failed in %s: %m", __func__); } @@ -306,7 +308,7 @@ cmd_who_send_error: req = (struct npppd_disconnect_user_req *)pkt; if (sizeof(struct npppd_disconnect_user_req) > pktlen) { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "'disconnect by user' is requested, " " but the request has invalid data length" "(%d:%d)", pktlen, (int)sizeof(req->username)); @@ -317,7 +319,7 @@ cmd_who_send_error: break; } if (i >= sizeof(req->username)) { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "'disconnect by user' is requested, " " but the request has invalid user name"); break; @@ -325,7 +327,7 @@ cmd_who_send_error: if ((ppplist = npppd_get_ppp_by_user(_npppd, req->username)) == NULL) { - npppd_ctl_log(_this, LOG_INFO, + npppd_ctl_log(_this, LOG_INFO, "npppd_get_ppp_by_user() could't find user \"%s\" in %s: %m", req->username, __func__); goto user_end; @@ -341,16 +343,16 @@ cmd_who_send_error: stopped++; } user_end: - - npppd_ctl_log(_this, LOG_NOTICE, + + npppd_ctl_log(_this, LOG_NOTICE, "'disconnect by user' is requested, " "stopped %d connections.", stopped); snprintf(respbuf, sizeof(respbuf), "Disconnected %d ppp connections", stopped); - + if (sendto(_this->sock, respbuf, strlen(respbuf), 0, peer, peer->sa_len) < 0) { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "sendto() failed in %s: %m", __func__); } break; @@ -360,7 +362,7 @@ user_end: */ case NPPPD_CTL_CMD_TERMID_SET_AUTH: { #ifndef NPPPD_USE_CLIENT_AUTH - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "NPPPD_CTL_CMD_TERMID_SET_AUTH is requested, but " "the terminal authentication is disabled."); goto fail; @@ -370,7 +372,7 @@ user_end: req = (struct npppd_ctl_termid_set_auth_request *)pkt; if (pktlen < sizeof(struct npppd_ctl_termid_set_auth_request)) { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "NPPPD_CTL_CMD_TERMID_SET_AUTH is requested, but " "the request is invalid."); goto fail; @@ -382,7 +384,7 @@ user_end: case NPPPD_CTL_PPP_ID: if ((ppp = npppd_get_ppp_by_id(npppd_get_npppd(), req->ppp_key.id)) == NULL) { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "NPPPD_CTL_CMD_TERMID_SET_AUTH is " "requested, but the requested ppp(id=%d) " "is not found.", req->ppp_key.id); @@ -393,7 +395,7 @@ user_end: case NPPPD_CTL_PPP_FRAMED_IP_ADDRESS: if ((ppp = npppd_get_ppp_by_ip(npppd_get_npppd(), req->ppp_key.framed_ip_address)) == NULL) { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "NPPPD_CTL_CMD_TERMID_SET_AUTH is " "requested, but the requested ppp(ip=%s) " "is not found.", @@ -402,7 +404,7 @@ user_end: } break; default: - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "NPPPD_CTL_CMD_TERMID_SET_AUTH is requested, but " "the ppp_key_type is invalid."); goto fail; @@ -416,9 +418,9 @@ user_end: if (sendto(_this->sock, respbuf, strlen(respbuf), 0, peer, peer->sa_len) < 0) { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "sendto() failed in %s: %m", __func__); - + } #endif break; @@ -435,14 +437,14 @@ user_end: if (sendto(_this->sock, respbuf, strlen(respbuf), 0, peer, peer->sa_len) < 0) { - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "sendto() failed in %s: %m", __func__); - + } break; } default: - npppd_ctl_log(_this, LOG_ERR, + npppd_ctl_log(_this, LOG_ERR, "Received unknown command %04x", command); } fail: diff --git a/usr.sbin/npppd/npppd/npppd_ctl.h b/usr.sbin/npppd/npppd/npppd_ctl.h index bc67c5af911..1f7b3f840a0 100644 --- a/usr.sbin/npppd/npppd/npppd_ctl.h +++ b/usr.sbin/npppd/npppd/npppd_ctl.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_ctl.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -35,7 +37,7 @@ /** connected user statistics */ #define NPPPD_CTL_CMD_WHO 1 -#ifndef DEFAULT_NPPPD_CTL_MAX_MSGSZ +#ifndef DEFAULT_NPPPD_CTL_MAX_MSGSZ #define DEFAULT_NPPPD_CTL_MAX_MSGSZ 51200 #endif diff --git a/usr.sbin/npppd/npppd/npppd_defs.h b/usr.sbin/npppd/npppd/npppd_defs.h index cabc5efda21..1764452dca5 100644 --- a/usr.sbin/npppd/npppd/npppd_defs.h +++ b/usr.sbin/npppd/npppd/npppd_defs.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_defs.h,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -38,7 +40,7 @@ #define NPPPD_MAX_SERVERS 8 #endif -#ifndef NPPPD_TIMER_TICK_IVAL +#ifndef NPPPD_TIMER_TICK_IVAL #define NPPPD_TIMER_TICK_IVAL 4 #endif @@ -78,7 +80,7 @@ #endif #define NPPPD_UID -1 /* not specified */ -#ifndef NPPPD_GID +#ifndef NPPPD_GID /** group id when npppd is working */ #define NPPPD_GID 0 #endif diff --git a/usr.sbin/npppd/npppd/npppd_iface.c b/usr.sbin/npppd/npppd/npppd_iface.c index 48f22644577..0baa2f1fedc 100644 --- a/usr.sbin/npppd/npppd/npppd_iface.c +++ b/usr.sbin/npppd/npppd/npppd_iface.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_iface.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -23,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: npppd_iface.c,v 1.3 2010/07/02 19:05:20 yasuoka Exp $ */ +/* $Id: npppd_iface.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file * The interface of npppd and kernel. * This is an implementation to use tun(4). @@ -80,7 +82,7 @@ abort(); \ } #else -#define NPPPD_IFACE_ASSERT(cond) +#define NPPPD_IFACE_ASSERT(cond) #define NPPPD_IFACE_DBG(x) #endif @@ -419,7 +421,7 @@ npppd_iface_io_event_handler(int fd, short evtype, void *data) "file is closed"); else if (errno == EAGAIN) break; - else + else npppd_iface_log(_this, LOG_ERR, "read failed: %m"); npppd_iface_stop(_this); @@ -440,13 +442,13 @@ struct npppd_iface_network_input_arg{ }; /** callback function which works for each PPP session */ -static int +static int npppd_iface_network_input_delegate(struct radish *radish, void *args0) { npppd_ppp *ppp; struct sockaddr_npppd *snp; struct npppd_iface_network_input_arg *args; - + snp = radish->rd_rtent; if (snp->snp_type == SNP_PPP) { diff --git a/usr.sbin/npppd/npppd/npppd_iface.h b/usr.sbin/npppd/npppd/npppd_iface.h index ee0f2def7a6..bca65f6da64 100644 --- a/usr.sbin/npppd/npppd/npppd_iface.h +++ b/usr.sbin/npppd/npppd/npppd_iface.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_iface.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/npppd/npppd_local.h b/usr.sbin/npppd/npppd/npppd_local.h index ad9e8b37b68..a63e151a1a1 100644 --- a/usr.sbin/npppd/npppd/npppd_local.h +++ b/usr.sbin/npppd/npppd/npppd_local.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_local.h,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -26,7 +28,7 @@ #ifndef _NPPPD_LOCAL_H #define _NPPPD_LOCAL_H 1 -#ifndef NPPPD_BUFSZ +#ifndef NPPPD_BUFSZ /** buffer size */ #define NPPPD_BUFSZ BUFSZ #endif diff --git a/usr.sbin/npppd/npppd/npppd_pool.c b/usr.sbin/npppd/npppd/npppd_pool.c index aa25d3bea13..1e0f61a6e81 100644 --- a/usr.sbin/npppd/npppd/npppd_pool.c +++ b/usr.sbin/npppd/npppd/npppd_pool.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_pool.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -64,7 +66,7 @@ abort(); \ } #else -#define NPPPD_POOL_ASSERT(cond) +#define NPPPD_POOL_ASSERT(cond) #define NPPPD_POOL_DBG(x) #endif #define A(v) ((0xff000000 & (v)) >> 24), ((0x00ff0000 & (v)) >> 16), \ @@ -175,7 +177,7 @@ npppd_pool_reload(npppd_pool *_this) addrs_size++; for (range = pool; range != NULL; range = range->next) addrs_size++; - + if ((addrs = calloc(addrs_size + 1, sizeof(struct sockaddr_npppd))) == NULL) { /* addr_size + 1 because of avoiding calloc(0). */ @@ -475,7 +477,7 @@ npppd_pool_release_ip(npppd_pool *_this, npppd_ppp *ppp) }; /* - * _this == NULL the pool address is released becaus of changing + * _this == NULL the pool address is released becaus of changing * configuration. */ if (!ppp_ip_assigned(ppp)) @@ -496,7 +498,7 @@ npppd_pool_release_ip(npppd_pool *_this, npppd_ppp *ppp) if (_this != NULL && ppp->assign_dynapool != 0) /* return to dynamic address pool list */ - slist_add(&((npppd_pool *)ppp->assigned_pool)->dyna_addrs, + slist_add(&((npppd_pool *)ppp->assigned_pool)->dyna_addrs, (void *)ntohl(ppp->ppp_framed_ip_address.s_addr)); if (snp != NULL && snp->snp_next != NULL) { @@ -560,14 +562,14 @@ npppd_pool_get_assignability(npppd_pool *_this, uint32_t ip4addr, if (psnp != NULL) *psnp = snp; if (snp->snp_data_ptr == _this) - return ADDRESS_OK; + return ADDRESS_OK; else return ADDRESS_RESERVED; } if (snp->snp_type == SNP_PPP) { if (psnp != NULL) *psnp = snp; - return ADDRESS_BUSY; + return ADDRESS_BUSY; } } while (rd_match_next(SA(&sin4), _this->npppd->rd, &radish, radish)); @@ -586,7 +588,7 @@ npppd_pool_get_assignability(npppd_pool *_this, uint32_t ip4addr, * The issue is as follows: * (1) BSDs treat the following packet as it is not forwarded and * is received as the packet to myself. - * (2) The issue that Windows can't use L2TP/IPsec when Windows is assigned + * (2) The issue that Windows can't use L2TP/IPsec when Windows is assigned * IP address .255.</pre> */ static int @@ -618,7 +620,7 @@ npppd_pool_log(npppd_pool *_this, int prio, const char *fmt, ...) * so it can't NPPPD_POOL_ASSERT(_this != NULL). */ va_start(ap, fmt); - snprintf(logbuf, sizeof(logbuf), "pool name=%s %s", + snprintf(logbuf, sizeof(logbuf), "pool name=%s %s", (_this == NULL)? "null" : _this->name, fmt); status = vlog_printf(prio, logbuf, ap); va_end(ap); diff --git a/usr.sbin/npppd/npppd/npppd_pool.h b/usr.sbin/npppd/npppd/npppd_pool.h index 7456b52d21e..cb1d61530d2 100644 --- a/usr.sbin/npppd/npppd/npppd_pool.h +++ b/usr.sbin/npppd/npppd/npppd_pool.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_pool.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/npppd/npppd_subr.c b/usr.sbin/npppd/npppd/npppd_subr.c index b26c89bff64..c7242bc79bc 100644 --- a/usr.sbin/npppd/npppd/npppd_subr.c +++ b/usr.sbin/npppd/npppd/npppd_subr.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_subr.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -26,7 +28,7 @@ /**@file * This file provides helper functions for npppd. */ -/* $Id: npppd_subr.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: npppd_subr.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/cdefs.h> #ifndef LINT __COPYRIGHT( @@ -301,7 +303,7 @@ fail: if (sock >= 0) close(sock); #endif - + return 1; } @@ -511,7 +513,7 @@ in_addr_range_delete_route(struct in_addr_range *range) /** * Adjust mss to make IP packet be shorter than or equal MTU. - * + * * @param pktp pointer that indicates IP packet * @param lpktp length * @param mtu MTU diff --git a/usr.sbin/npppd/npppd/npppd_subr.h b/usr.sbin/npppd/npppd/npppd_subr.h index e055fe1b257..f165ceb470c 100644 --- a/usr.sbin/npppd/npppd/npppd_subr.h +++ b/usr.sbin/npppd/npppd/npppd_subr.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_subr.h,v 1.2 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/npppd/npppd_tun.c b/usr.sbin/npppd/npppd/npppd_tun.c index 844f0b43ce0..7ac47491bc9 100644 --- a/usr.sbin/npppd/npppd/npppd_tun.c +++ b/usr.sbin/npppd/npppd/npppd_tun.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_tun.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -186,7 +188,7 @@ npppd_tundev_io_event_handler(int fd, short evtype, void *data) _this->tun_minor); else if (errno == EAGAIN) break; - else + else log_printf(LOG_ERR, "tun%d file is closed", _this->tun_minor); npppd_tundev_stop(_this); @@ -212,6 +214,6 @@ npppd_tundev_write(npppd *_this, uint8_t *pktp, int lpktp) err = write(_this->tun_file, pktp, lpktp); if (err != lpktp) - log_printf(LOG_ERR, "tun%d write failed in %s(): %m", + log_printf(LOG_ERR, "tun%d write failed in %s(): %m", _this->tun_minor, __func__); } diff --git a/usr.sbin/npppd/npppd/npppd_tun.h b/usr.sbin/npppd/npppd/npppd_tun.h index 12942f7b221..2ca31bf9f11 100644 --- a/usr.sbin/npppd/npppd/npppd_tun.h +++ b/usr.sbin/npppd/npppd/npppd_tun.h @@ -1,3 +1,5 @@ +/* $OpenBSD: npppd_tun.h,v 1.2 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/npppd/pap.c b/usr.sbin/npppd/npppd/pap.c index b7168d00a32..db8f9c1d87a 100644 --- a/usr.sbin/npppd/npppd/pap.c +++ b/usr.sbin/npppd/npppd/pap.c @@ -1,3 +1,5 @@ +/* $OpenBSD: pap.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -23,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: pap.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: pap.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file * This file provides Password Authentication Protocol (PAP) handlers. * @author Yasuoka Masahiko @@ -77,8 +79,8 @@ abort(); \ } #else -#define PAP_ASSERT(cond) -#define PAP_DBG(x) +#define PAP_ASSERT(cond) +#define PAP_DBG(x) #endif static void pap_log (pap *, uint32_t, const char *, ...) __printflike(3,4); @@ -394,7 +396,7 @@ pap_radius_authenticate(pap *_this, const char *username, const char *password) == NULL) goto fail; - if (radius_prepare(rad_setting, _this, &radctx, + if (radius_prepare(rad_setting, _this, &radctx, pap_radius_response, _this->ppp->auth_timeout) != 0) { radius_delete_packet(radpkt); goto fail; @@ -405,7 +407,7 @@ pap_radius_authenticate(pap *_this, const char *username, const char *password) goto fail; if (radius_put_string_attr(radpkt, RADIUS_TYPE_USER_NAME, - npppd_ppp_get_username_for_auth(_this->ppp->pppd, _this->ppp, + npppd_ppp_get_username_for_auth(_this->ppp->pppd, _this->ppp, username, buf0)) != 0) goto fail; diff --git a/usr.sbin/npppd/npppd/pathnames.h b/usr.sbin/npppd/npppd/pathnames.h index 0f0778f9507..906d1a57682 100644 --- a/usr.sbin/npppd/npppd/pathnames.h +++ b/usr.sbin/npppd/npppd/pathnames.h @@ -1,3 +1,5 @@ +/* $OpenBSD: pathnames.h,v 1.2 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -30,7 +32,7 @@ #define DEFAULT_NPPPD_CONF "/etc/npppd/npppd.conf" #endif -#ifndef DEFAULT_NPPPD_USERSFILE +#ifndef DEFAULT_NPPPD_USERSFILE #define DEFAULT_NPPPD_USERSFILE "/etc/npppd/npppd-users.csv" #endif diff --git a/usr.sbin/npppd/npppd/ppp.c b/usr.sbin/npppd/npppd/ppp.c index c2ee777c2d6..53c79602d1e 100644 --- a/usr.sbin/npppd/npppd/ppp.c +++ b/usr.sbin/npppd/npppd/ppp.c @@ -1,3 +1,5 @@ +/* $OpenBSD: ppp.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -23,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: ppp.c,v 1.3 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: ppp.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file * This file provides PPP(Point-to-Point Protocol, RFC 1661) and * {@link :: _npppd_ppp PPP instance} related functions. @@ -65,7 +67,7 @@ abort(); \ } #else -#define PPP_ASSERT(cond) +#define PPP_ASSERT(cond) #define PPP_DBG(x) #endif @@ -253,7 +255,7 @@ ppp_dialin_proxy_prepare(npppd_ppp *_this, dialin_proxy_info *dpi) renego = 1; if (lcp_dialin_proxy(&_this->lcp, dpi, renego, renego_force) != 0) { - ppp_log(_this, LOG_ERR, + ppp_log(_this, LOG_ERR, "Failed to proxy-dialin, proxied lcp is broken."); return 1; } @@ -272,7 +274,7 @@ ppp_down_others(npppd_ppp *_this) pap_stop(&_this->pap); if (AUTH_IS_CHAP(_this)) chap_stop(&_this->chap); -#ifdef USE_NPPPD_EAP_RADIUS +#ifdef USE_NPPPD_EAP_RADIUS if (AUTH_IS_EAP(_this)) eap_stop(&_this->eap); #endif @@ -325,7 +327,7 @@ ppp_stop0(npppd_ppp *_this) _this->phy_close = NULL; /* - * NAT/Blackhole detection for PPTP(GRE) + * NAT/Blackhole detection for PPTP(GRE) */ if (_this->lcp.dialin_proxy != 0 && _this->lcp.dialin_proxy_lcp_renegotiation == 0) { @@ -914,17 +916,17 @@ ppp_output(npppd_ppp *_this, uint16_t proto, u_char code, u_char id, * needed on this link or ACFC is negotiated. */ } else { - PUTCHAR(PPP_ALLSTATIONS, outp); - PUTCHAR(PPP_UI, outp); + PUTCHAR(PPP_ALLSTATIONS, outp); + PUTCHAR(PPP_UI, outp); } if (!is_lcp && proto <= 0xff && psm_peer_opt_is_accepted(&_this->lcp, pfc)) { /* * Protocol Field Compression */ - PUTCHAR(proto, outp); + PUTCHAR(proto, outp); } else { - PUTSHORT(proto, outp); + PUTSHORT(proto, outp); } hlen = outp - _this->outpacket_buf; @@ -1011,12 +1013,12 @@ ppp_log(npppd_ppp *_this, int prio, const char *fmt, ...) /** * Process the Framed-IP-Address attribute and the Framed-IP-Netmask * attribute of given RADIUS packet. - */ + */ void ppp_process_radius_framed_ip(npppd_ppp *_this, RADIUS_PACKET *pkt) { struct in_addr ip4; - + if (radius_get_ipv4_attr(pkt, RADIUS_TYPE_FRAMED_IP_ADDRESS, &ip4) == 0) _this->realm_framed_ip_address = ip4; @@ -1045,7 +1047,7 @@ ppp_set_radius_attrs_for_authreq(npppd_ppp *_this, goto fail; /* RFC 2865 "5.7. Framed-Protocol" */ - if (radius_put_uint32_attr(radpkt, RADIUS_TYPE_FRAMED_PROTOCOL, + if (radius_put_uint32_attr(radpkt, RADIUS_TYPE_FRAMED_PROTOCOL, RADIUS_FRAMED_PROTOCOL_PPP) != 0) goto fail; @@ -1066,7 +1068,7 @@ static void ppp_on_network_pipex(npppd_ppp *_this) { if (_this->use_pipex == 0) - return; + return; if (_this->tunnel_type != PPP_TUNNEL_PPTP && _this->tunnel_type != PPP_TUNNEL_PPPOE) return; diff --git a/usr.sbin/npppd/npppd/ppp.h b/usr.sbin/npppd/npppd/ppp.h index 38774146c24..68209a9ffff 100644 --- a/usr.sbin/npppd/npppd/ppp.h +++ b/usr.sbin/npppd/npppd/ppp.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ppp.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -91,7 +93,7 @@ #define CCP_MPPE_NT_128bit 0x00000040 #define CCP_MPPE_NT_56bit 0x00000080 #define CCP_MPPE_STATELESS 0x01000000 /* Packet-by-packet encryption */ -#define CCP_MPPE_KEYLENMASK 0x00000FF0 +#define CCP_MPPE_KEYLENMASK 0x00000FF0 #define CCP_MPPE_HEADER_LEN 4 /* mppe header + protocol */ #define INADDR_USER_SELECT (htonl(0xFFFFFFFFL)) @@ -180,7 +182,7 @@ typedef enum _npppd_ppp_disconnect_code { */ PPP_DISCON_LCP_COMPULSORY_CALL_BACK_REQUIRED = 12, - /* + /* * 3.3. Authentication Errors */ /** FSM Timeout error. */ @@ -302,7 +304,7 @@ typedef struct _chap { u_char pktid; /* PPP Packet Id */ u_char challid; /* Id of challange */ int type; /* chap type */ - int ntry; + int ntry; u_char authenticator[16]; #ifdef USE_NPPPD_RADIUS RADIUS_REQUEST_CTX radctx; @@ -328,7 +330,7 @@ typedef struct _eap { struct evtimer_wrap timerctx; uint32_t state; u_char eapid; - int ntry; + int ntry; u_char name[MAX_USERNAME_LENGTH]; u_char authenticator[16]; /* FIXME */ @@ -337,14 +339,14 @@ typedef struct _eap { u_char attr_state[RADIUS_ATTR_STATE_LEN]; u_char attr_state_len; unsigned int session_timeout; - /* + /* * nak response 0x01 */ u_char flags; RADIUS_REQUEST_CTX radctx; } eap; #endif - + /** Type for CCP */ typedef struct _ccp { npppd_ppp *ppp; @@ -429,7 +431,7 @@ typedef struct _mppe { typedef struct _npppd_phone_number { #define NPPPD_AF_PHONE_NUMBER (AF_MAX + 0) /** total length */ - uint8_t pn_len; + uint8_t pn_len; /** address family. this must be NPPPD_AF_PHONE_NUMBER */ sa_family_t pn_family; /** phone number */ @@ -495,14 +497,14 @@ struct _npppd_ppp { /** * Authentication methods that requires to the peer. * <pre> - * PAP 0xC023 - * EAP 0xC227 - * CHAP 0x0005 - * MSCHAP 0x0080 - * MSCHAPv2 0x0081 + * PAP 0xC023 + * EAP 0xC227 + * CHAP 0x0005 + * MSCHAP 0x0080 + * MSCHAPv2 0x0081 * </pre> */ - uint16_t peer_auth; + uint16_t peer_auth; u_short auth_timeout; #ifdef USE_NPPPD_MPPE @@ -560,7 +562,7 @@ struct _npppd_ppp { /** Length of client authentication ID */ #define NPPPD_CLIENT_AUTH_ID_MAXLEN 32 char client_auth_id[NPPPD_CLIENT_AUTH_ID_MAXLEN + 1]; - int has_client_auth_id; + int has_client_auth_id; #endif /* * Statistical informations @@ -632,8 +634,8 @@ typedef struct _dialin_proxy_info { #define MPPE_MUST_NEGO(ppp) \ (((ppp)->mppe.enabled != 0) && \ (((ppp)->peer_auth == PPP_AUTH_CHAP_MS_V2) || \ - ((ppp)->peer_auth == PPP_AUTH_EAP))) - + ((ppp)->peer_auth == PPP_AUTH_EAP))) + /** MPPE is required */ #define MPPE_REQUIRED(ppp) \ (((ppp)->mppe.enabled != 0) && ((ppp)->mppe.required != 0)) @@ -715,7 +717,7 @@ typedef struct _dialin_proxy_info { * simply. So a TCP/IP packet that has max segment size with MPPE * requires MRU + 4 octets. If the packet witout MPPE requires just MRU * octets. - * + * * If MRU doesn't cover MPPE/CCP header, we need to avoid sending MRU + 4 * octets packet. */ @@ -724,7 +726,7 @@ typedef struct _dialin_proxy_info { #define MRU_IPMTU(mru) (mru) #define MRU_PKTLEN(mru, proto) (mru) #else -#ifdef MRU_INCLUDES_MPPE_CCP +#ifdef MRU_INCLUDES_MPPE_CCP /* MRU covers MPPE/CCP header */ #define MRU_IPMTU(mru) ((mru) - CCP_MPPE_HEADER_LEN) #define MRU_PKTLEN(mru, proto) (mru) @@ -750,7 +752,7 @@ void ppp_start (npppd_ppp *); int ppp_dialin_proxy_prepare (npppd_ppp *, dialin_proxy_info *); void ppp_stop (npppd_ppp *, const char *); void ppp_stop_ex (npppd_ppp *, const char *, npppd_ppp_disconnect_code, int, int, const char *); - + void ppp_destroy (void *); void ppp_lcp_up (npppd_ppp *); void ppp_lcp_finished (npppd_ppp *); diff --git a/usr.sbin/npppd/npppd/psm-opt.h b/usr.sbin/npppd/npppd/psm-opt.h index b52ee5faddc..f8885996433 100644 --- a/usr.sbin/npppd/npppd/psm-opt.h +++ b/usr.sbin/npppd/npppd/psm-opt.h @@ -1,3 +1,5 @@ +/* $OpenBSD: psm-opt.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -41,7 +43,7 @@ * // Mark peer rejects "Address and Control Field Compression" option. * psm_peer_opt_set_reject(lcp, acfc, true) * </pre></p> - * $Id: psm-opt.h,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: psm-opt.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #define PSM_OPT_REQUEST_OURS 0x01 diff --git a/usr.sbin/npppd/npppd/radius+.c b/usr.sbin/npppd/npppd/radius+.c index 4d7ead7406c..b067349b51f 100644 --- a/usr.sbin/npppd/npppd/radius+.c +++ b/usr.sbin/npppd/npppd/radius+.c @@ -1,3 +1,5 @@ +/* $OpenBSD: radius+.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +26,7 @@ * SUCH DAMAGE. */ /* - * radius+.cc : + * radius+.cc : * yet another RADIUS library */ #ifdef WITH_MPATROL @@ -394,7 +396,7 @@ int radius_get_vs_raw_attr_all(const RADIUS_PACKET* packet, u_int32_t vendor, continue; if(attr->vtype != vtype) continue; - + if (buf != NULL) { if (off + attr->vlength - 2 <= *length) memcpy(off + buf, attr->vdata, @@ -513,7 +515,7 @@ u_int32_t radius_get_uint32_attr_retval(const RADIUS_PACKET* packet, return 0xffffffff; return ntohl(nval); } - + int radius_put_uint32_attr(RADIUS_PACKET* packet, u_int8_t type, u_int32_t val) { u_int32_t nval; @@ -582,7 +584,7 @@ struct in_addr radius_get_ipv4_attr_retval(const RADIUS_PACKET* packet, addr.s_addr = htonl(INADDR_ANY); return addr; } - + int radius_put_ipv4_attr(RADIUS_PACKET* packet, u_int8_t type, struct in_addr addr) { return radius_put_raw_attr(packet, type, &addr, sizeof(struct in_addr)); diff --git a/usr.sbin/npppd/npppd/radius+.h b/usr.sbin/npppd/npppd/radius+.h index 4699e040ec5..a239f17f045 100644 --- a/usr.sbin/npppd/npppd/radius+.h +++ b/usr.sbin/npppd/npppd/radius+.h @@ -1,3 +1,5 @@ +/* $OpenBSD: radius+.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +26,7 @@ * SUCH DAMAGE. */ /* - * radius+.h : + * radius+.h : * yet another RADIUS library */ #ifndef RADIUS_PLUS_H diff --git a/usr.sbin/npppd/npppd/radius+_local.h b/usr.sbin/npppd/npppd/radius+_local.h index f79ad7c73c6..450016cefc2 100644 --- a/usr.sbin/npppd/npppd/radius+_local.h +++ b/usr.sbin/npppd/npppd/radius+_local.h @@ -1,3 +1,5 @@ +/* $OpenBSD: radius+_local.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +26,7 @@ * SUCH DAMAGE. */ /* - * radius+.cc : + * radius+.cc : * yet another RADIUS library */ #ifndef RADIUSPLUS_LOCAL_H diff --git a/usr.sbin/npppd/npppd/radius_chap_const.h b/usr.sbin/npppd/npppd/radius_chap_const.h index 1756c5b4cc2..55fcd41bb7f 100644 --- a/usr.sbin/npppd/npppd/radius_chap_const.h +++ b/usr.sbin/npppd/npppd/radius_chap_const.h @@ -1,3 +1,5 @@ +/* $OpenBSD: radius_chap_const.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -52,7 +54,7 @@ struct RADIUS_MS_CHAP2_SUCCESS { struct RADIUS_MPPE_KEY { char salt[2]; - char key[253]; + char key[253]; /* * XXX: Having maximum size for RADIUS attribute is required to prevent * XXX: oveflow by radius_get_vs_raw_attr(). diff --git a/usr.sbin/npppd/npppd/radius_common.c b/usr.sbin/npppd/npppd/radius_common.c index 0d981cb08f1..39484590481 100644 --- a/usr.sbin/npppd/npppd/radius_common.c +++ b/usr.sbin/npppd/npppd/radius_common.c @@ -1,3 +1,5 @@ +/* $OpenBSD: radius_common.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -27,7 +29,7 @@ /**@file * This file provides functions commonly used for RADIUS request. * @author Yasuoka Masahiko - * $Id: radius_common.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: radius_common.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> diff --git a/usr.sbin/npppd/npppd/radius_common.h b/usr.sbin/npppd/npppd/radius_common.h index db7979dfd21..0754232314b 100644 --- a/usr.sbin/npppd/npppd/radius_common.h +++ b/usr.sbin/npppd/npppd/radius_common.h @@ -1,3 +1,5 @@ +/* $OpenBSD: radius_common.h,v 1.2 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/npppd/radius_req.c b/usr.sbin/npppd/npppd/radius_req.c index 70888b86425..1d97ac0d8dc 100644 --- a/usr.sbin/npppd/npppd/radius_req.c +++ b/usr.sbin/npppd/npppd/radius_req.c @@ -1,3 +1,5 @@ +/* $OpenBSD: radius_req.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -26,7 +28,7 @@ /**@file * This file provides functions for RADIUS request using radius+.c and event(3). * @author Yasuoka Masahiko - * $Id: radius_req.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: radius_req.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> @@ -71,7 +73,7 @@ static int select_srcaddr(struct sockaddr const *, struct sockaddr *, socklen_t abort(); \ } #else -#define RADIUS_REQ_ASSERT(cond) +#define RADIUS_REQ_ASSERT(cond) #endif /** @@ -158,13 +160,13 @@ fail: * Prepare sending RADIUS request. This implementation will call back to * notice that it receives the response or it fails for timeouts to the * The context that is set as 'pctx' and response packet that is given - * by the callback function will be released by this implementation internally. + * by the callback function will be released by this implementation internally. * @param setting Setting for RADIUS server or request. * @param context Context for the caller. * @param pctx Pointer to the space for context of RADIUS request * (RADIUS_REQUEST_CTX). This will be used for canceling. * NULL can be specified when you don't need. - * @param response_fn Specify callback function as a pointer. The function + * @param response_fn Specify callback function as a pointer. The function * will be called when it receives a response or when * request fails for timeouts. * @param timeout response timeout in second. @@ -327,8 +329,8 @@ radius_request_io_event(int fd, short evmask, void *context) } else if ((evmask & EV_TIMEOUT) != 0) { lap = context; if (lap->ntry > 0) { - if (radius_request0(lap) != 0) { - if (lap->response_fn != NULL) + if (radius_request0(lap) != 0) { + if (lap->response_fn != NULL) lap->response_fn(lap->context, NULL, RADIUS_REQUST_ERROR); radius_cancel_request(lap); diff --git a/usr.sbin/npppd/npppd/radius_req.h b/usr.sbin/npppd/npppd/radius_req.h index eed43ab36b7..65caf36bf00 100644 --- a/usr.sbin/npppd/npppd/radius_req.h +++ b/usr.sbin/npppd/npppd/radius_req.h @@ -1,3 +1,5 @@ +/* $OpenBSD: radius_req.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -51,7 +53,7 @@ typedef void (radius_response)(void *context, RADIUS_PACKET *pkt, int flags); typedef void * RADIUS_REQUEST_CTX; /** type for setting of RADIUS request */ -typedef struct _radius_req_setting +typedef struct _radius_req_setting { /** RADIUS Servers */ struct { @@ -66,7 +68,7 @@ typedef struct _radius_req_setting struct sockaddr_in sin4; } sock; char secret[MAX_RADIUS_SECRET]; - int enabled; + int enabled; } server[MAX_RADIUS_SERVERS]; /** Index of current server */ int curr_server; diff --git a/usr.sbin/npppd/npppd/radiusconst.h b/usr.sbin/npppd/npppd/radiusconst.h index 51bdeb251a9..91056b4bcd0 100644 --- a/usr.sbin/npppd/npppd/radiusconst.h +++ b/usr.sbin/npppd/npppd/radiusconst.h @@ -1,3 +1,5 @@ +/* $OpenBSD: radiusconst.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +26,7 @@ * SUCH DAMAGE. */ /* - * radiusconst.h : + * radiusconst.h : * RADIUS constatnts */ diff --git a/usr.sbin/npppd/npppd/version.h b/usr.sbin/npppd/npppd/version.h index 11b0f56f318..0b0762dfac1 100644 --- a/usr.sbin/npppd/npppd/version.h +++ b/usr.sbin/npppd/npppd/version.h @@ -1,3 +1,5 @@ +/* $OpenBSD: version.h,v 1.2 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/npppdctl/Makefile b/usr.sbin/npppd/npppdctl/Makefile index a278712558a..d68091d9bc0 100644 --- a/usr.sbin/npppd/npppdctl/Makefile +++ b/usr.sbin/npppd/npppdctl/Makefile @@ -1,6 +1,5 @@ -# -# $Id: Makefile,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ -# +# $OpenBSD: Makefile,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ + .include <bsd.own.mk> PROG= npppdctl diff --git a/usr.sbin/npppd/npppdctl/npppdctl.c b/usr.sbin/npppd/npppdctl/npppdctl.c index 40e03af9b3f..14459362d8d 100644 --- a/usr.sbin/npppd/npppdctl/npppdctl.c +++ b/usr.sbin/npppd/npppdctl/npppdctl.c @@ -1,3 +1,5 @@ +/* $OpenBSD: npppdctl.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -23,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: npppdctl.c,v 1.3 2010/07/02 19:05:20 yasuoka Exp $ */ +/* $Id: npppdctl.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> @@ -270,7 +272,7 @@ npppd_who(int show_stat) else printf("id name in(Kbytes/pkts/errs)" " out(Kbytes/pkts/errs)\n"); - + n = 0; l->count = -1; do { @@ -322,7 +324,7 @@ print_who(struct npppd_who *w) hasserv = (sa->sa_family == AF_INET || sa->sa_family ==AF_INET6)? 1 : 0; if (sa->sa_family == AF_LINK) { - snprintf(hoststr, sizeof(hoststr), + snprintf(hoststr, sizeof(hoststr), "%02x:%02x:%02x:%02x:%02x:%02x", LLADDR((struct sockaddr_dl *)sa)[0] & 0xff, LLADDR((struct sockaddr_dl *)sa)[1] & 0xff, diff --git a/usr.sbin/npppd/pppoe/pppoe.h b/usr.sbin/npppd/pppoe/pppoe.h index b9d31f0fd2f..6120f3e0211 100644 --- a/usr.sbin/npppd/pppoe/pppoe.h +++ b/usr.sbin/npppd/pppoe/pppoe.h @@ -1,3 +1,5 @@ +/* $OpenBSD: pppoe.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/pppoe/pppoe_local.h b/usr.sbin/npppd/pppoe/pppoe_local.h index 558df704020..b254addbe4d 100644 --- a/usr.sbin/npppd/pppoe/pppoe_local.h +++ b/usr.sbin/npppd/pppoe/pppoe_local.h @@ -1,3 +1,5 @@ +/* $OpenBSD: pppoe_local.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/pppoe/pppoe_session.c b/usr.sbin/npppd/pppoe/pppoe_session.c index 131395af11e..6207c7732d0 100644 --- a/usr.sbin/npppd/pppoe/pppoe_session.c +++ b/usr.sbin/npppd/pppoe/pppoe_session.c @@ -1,4 +1,5 @@ -/* $OpenBSD: pppoe_session.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pppoe_session.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -27,7 +28,7 @@ /**@file * Session management of PPPoE protocol - * $Id: pppoe_session.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: pppoe_session.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> @@ -66,7 +67,7 @@ #define PPPOE_SESSION_DBG(x) pppoe_session_log x #else #define PPPOE_SESSION_ASSERT(x) -#define PPPOE_SESSION_DBG(x) +#define PPPOE_SESSION_DBG(x) #endif #define pppoed_listener_this(sess) \ diff --git a/usr.sbin/npppd/pppoe/pppoed.c b/usr.sbin/npppd/pppoe/pppoed.c index f3103b31a89..6f0962379fc 100644 --- a/usr.sbin/npppd/pppoe/pppoed.c +++ b/usr.sbin/npppd/pppoe/pppoed.c @@ -1,4 +1,5 @@ -/* $OpenBSD: pppoed.c,v 1.5 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pppoed.c,v 1.6 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -27,7 +28,7 @@ /**@file * This file provides the PPPoE(RFC2516) server(access concentrator) * implementaion. - * $Id: pppoed.c,v 1.5 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: pppoed.c,v 1.6 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> @@ -168,7 +169,7 @@ fail: } static void -pppoed_listener_init(pppoed *_this, pppoed_listener *listener) +pppoed_listener_init(pppoed *_this, pppoed_listener *listener) { memset(listener, 0, sizeof(pppoed_listener)); listener->bpf = -1; @@ -233,7 +234,7 @@ pppoed_listener_start(pppoed_listener *_this, int restart) ETHER_LAST_SHORT(_this->ether_addr), 0, 1), BPF_STMT(BPF_RET+BPF_K, (u_int)-1), BPF_STMT(BPF_RET+BPF_K, (u_int)0), -#endif +#endif }; struct bpf_program bf_filter = { .bf_len = countof(insns), @@ -399,7 +400,7 @@ pppoed_stop(pppoed *_this) { pppoed_listener *plistener; hash_link *hl; - pppoe_session *session; + pppoe_session *session; if (!pppoed_is_running(_this)) return; @@ -492,7 +493,7 @@ pppoed_reload(pppoed *_this, struct properties *config, const char *name, do_start = 0; _this->config = config; - if (pppoed_config_str_equal(_this, CFG_KEY(name, "enabled"), "true", + if (pppoed_config_str_equal(_this, CFG_KEY(name, "enabled"), "true", default_enabled)) { /* avoid false->true flapping */ if (pppoed_is_stopped(_this) || !pppoed_is_running(_this)) @@ -751,7 +752,7 @@ pppoed_input(pppoed_listener *_this, uint8_t shost[ETHER_ADDR_LEN], int is_disc, if (is_disc) { PPPOED_DBG((_this->self, DEBUG_LEVEL_1, "Recv%s(%02x) ver=%d type=%d session-id=%d if=%s", - pppoe_code_string(pppoe->code), pppoe->code, + pppoe_code_string(pppoe->code), pppoe->code, pppoe->ver, pppoe->type, pppoe->session_id, _this->listen_ifname)); } @@ -890,7 +891,7 @@ pppoed_output(pppoed_listener *_this, u_char *dhost, u_char *pkt, int lpkt) static void pppoed_recv_PADR(pppoed_listener *_this, uint8_t shost[ETHER_ADDR_LEN], - slist *tag_list) + slist *tag_list) { int session_id, shuffle_cnt; pppoe_session *session; @@ -943,7 +944,7 @@ fail: static void pppoed_recv_PADI(pppoed_listener *_this, uint8_t shost[ETHER_ADDR_LEN], - slist *tag_list) + slist *tag_list) { int len, accept_any_service_req; const char *val, *service_name, *ac_name; @@ -1201,7 +1202,7 @@ static uint32_t session_id_hash(void *a, size_t siz) { int ia; - + ia = (int)a; return ia % siz; diff --git a/usr.sbin/npppd/pptp/pptp.h b/usr.sbin/npppd/pptp/pptp.h index 71d45725d3c..adcc22893b0 100644 --- a/usr.sbin/npppd/pptp/pptp.h +++ b/usr.sbin/npppd/pptp/pptp.h @@ -1,4 +1,5 @@ -/* $OpenBSD: pptp.h,v 1.3 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pptp.h,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/pptp/pptp_call.c b/usr.sbin/npppd/pptp/pptp_call.c index 400ec0ed0ce..66cf2599ae0 100644 --- a/usr.sbin/npppd/pptp/pptp_call.c +++ b/usr.sbin/npppd/pptp/pptp_call.c @@ -1,4 +1,5 @@ -/* $OpenBSD: pptp_call.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pptp_call.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: pptp_call.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: pptp_call.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file PPTP Call */ /* currently it supports PAC mode only */ #include <sys/types.h> @@ -275,7 +276,7 @@ pptp_call_recv_SLI(pptp_call *_this, u_char *pkt, int lpkt) } #if 0 -/* Some route implementation which has "PPTP pass-through" function +/* Some route implementation which has "PPTP pass-through" function * will discard 1723/tcp packet between PAC and PNS, when it recognize * SLI from PAC. (for example, FLASHWAVE by Fujitsu). * @@ -642,11 +643,11 @@ pptp_call_gre_output(pptp_call *_this, int fseq, int fack, u_char *pkt, return (sz > 0)? 0 : 1; } -/* +/* * npppd physical layer functions */ -/* notify to ppp that the PPTP physical layer is already downed */ +/* notify to ppp that the PPTP physical layer is already downed */ static void pptp_call_notify_down(pptp_call *_this) { @@ -794,7 +795,7 @@ pptp_call_log(pptp_call *_this, int prio, const char *fmt, ...) /* convert Outgoing-Call-Request packet to strings */ static void pptp_call_OCRQ_string(struct pptp_ocrq *ocrq, char *buf, int lbuf) -{ +{ snprintf(buf, lbuf, "call_id=%u call_serial_number=%u max_bps=%u min_bps=%u bearer=%s " "framing=%s recv_winsz=%u packet_proccessing_delay=%u " @@ -809,7 +810,7 @@ pptp_call_OCRQ_string(struct pptp_ocrq *ocrq, char *buf, int lbuf) /* convert Outgoing-Call-Reply packet to strings */ void pptp_call_OCRP_string(struct pptp_ocrp *ocrp, char *buf, int lbuf) -{ +{ snprintf(buf, lbuf, "call_id=%u peers_call_id=%u result=%u error=%u cause=%u " "conn_speed=%u recv_winsz=%u packet_proccessing_delay=%u " diff --git a/usr.sbin/npppd/pptp/pptp_ctrl.c b/usr.sbin/npppd/pptp/pptp_ctrl.c index 5ba995b0632..defa2afb325 100644 --- a/usr.sbin/npppd/pptp/pptp_ctrl.c +++ b/usr.sbin/npppd/pptp/pptp_ctrl.c @@ -1,4 +1,5 @@ -/* $OpenBSD: pptp_ctrl.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pptp_ctrl.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -28,7 +29,7 @@ * PPTP(RFC 2637) control connection implementation. * currently it only support PAC part */ -/* $Id: pptp_ctrl.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: pptp_ctrl.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> @@ -58,7 +59,7 @@ #include "pptp_subr.h" /* periods of pptp_ctrl_timeout */ -#define PPTP_CTRL_TIMEOUT_IVAL_SEC 2 +#define PPTP_CTRL_TIMEOUT_IVAL_SEC 2 #ifdef PPTP_CTRL_DEBUG #define PPTP_CTRL_ASSERT(x) ASSERT(x) @@ -273,7 +274,7 @@ pptp_ctrl_reset_timeout(pptp_ctrl *_this) switch (_this->state) { case PPTP_CTRL_STATE_DISPOSING: - tv.tv_sec = 0; /* call back immidiatly */ + tv.tv_sec = 0; /* call back immidiatly */ tv.tv_usec = 0; break; default: @@ -405,12 +406,12 @@ pptp_ctrl_io_event(int fd, short evmask, void *ctx) bytebuffer_remaining(_this->recv_buf)); if (sz <= 0) { if (errno == ECONNRESET || sz == 0) { - pptp_ctrl_log(_this, LOG_INFO, + pptp_ctrl_log(_this, LOG_INFO, "Connection closed by foreign host"); pptp_ctrl_fini(_this); goto fail; } else if (errno != EAGAIN && errno != EINTR) { - pptp_ctrl_log(_this, LOG_INFO, + pptp_ctrl_log(_this, LOG_INFO, "read() failed at %s(): %m", __func__); pptp_ctrl_fini(_this); goto fail; @@ -742,7 +743,7 @@ pptp_ctrl_send_SCCRP(pptp_ctrl *_this, int result, int error) scc->max_channels = 4; /* XXX */ scc->firmware_revision = MAJOR_VERSION << 8 | MINOR_VERSION; - /* this implementation only support these strings up to + /* this implementation only support these strings up to * 63 character */ /* host name */ if ((val = pptp_ctrl_config_str(_this, "pptp.host_name")) == NULL) @@ -903,7 +904,7 @@ pptp_ctrl_input(pptp_ctrl *_this, u_char *pkt, int lpkt) struct pptp_ctrl_header *hdr; PPTP_CTRL_ASSERT(lpkt >= sizeof(struct pptp_ctrl_header)); - + curr_time = get_monosec(); hdr = (struct pptp_ctrl_header *)pkt; @@ -940,7 +941,7 @@ pptp_ctrl_input(pptp_ctrl *_this, u_char *pkt, int lpkt) goto bad_packet; } - /* As there is possibility of state conflicts, + /* As there is possibility of state conflicts, * ECHO Reply requiries special care. */ switch (hdr->control_message_type) { @@ -1069,7 +1070,7 @@ pptp_ctrl_call_input(pptp_ctrl *_this, int mes_type, u_char *pkt, int lpkt) case PPTP_CTRL_MES_CODE_ICRP: /* PNS => PAC */ /* * as this implementation never sent ICRQ, this case - * should not happen. + * should not happen. * But just to make sure, pptp_call.c can handle this * message. */ @@ -1136,7 +1137,7 @@ fail: /* - * utilities + * utilities */ /* logging with the label of the instance */ diff --git a/usr.sbin/npppd/pptp/pptp_local.h b/usr.sbin/npppd/pptp/pptp_local.h index 59e66a3849f..182837d154a 100644 --- a/usr.sbin/npppd/pptp/pptp_local.h +++ b/usr.sbin/npppd/pptp/pptp_local.h @@ -1,4 +1,5 @@ -/* $OpenBSD: pptp_local.h,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pptp_local.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/pptp/pptp_subr.c b/usr.sbin/npppd/pptp/pptp_subr.c index 389a2684a7c..6d217aebeb3 100644 --- a/usr.sbin/npppd/pptp/pptp_subr.c +++ b/usr.sbin/npppd/pptp/pptp_subr.c @@ -1,4 +1,5 @@ -/* $OpenBSD: pptp_subr.c,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pptp_subr.c,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/pptp/pptp_subr.h b/usr.sbin/npppd/pptp/pptp_subr.h index 4604393390b..3d29b23437e 100644 --- a/usr.sbin/npppd/pptp/pptp_subr.h +++ b/usr.sbin/npppd/pptp/pptp_subr.h @@ -1,4 +1,5 @@ -/* $OpenBSD: pptp_subr.h,v 1.2 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pptp_subr.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. diff --git a/usr.sbin/npppd/pptp/pptpd.c b/usr.sbin/npppd/pptp/pptpd.c index 626db3d8217..5654b519976 100644 --- a/usr.sbin/npppd/pptp/pptpd.c +++ b/usr.sbin/npppd/pptp/pptpd.c @@ -1,4 +1,5 @@ -/* $OpenBSD: pptpd.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $OpenBSD: pptpd.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ + /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -24,12 +25,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: pptpd.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ */ +/* $Id: pptpd.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ /**@file * This file provides a implementation of PPTP daemon. Currently it * provides functions for PAC (PPTP Access Concentrator) only. - * $Id: pptpd.c,v 1.4 2010/07/01 03:38:17 yasuoka Exp $ + * $Id: pptpd.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> @@ -108,7 +109,7 @@ pptpd_init(pptpd *_this) memset(&sin0, 0, sizeof(sin0)); sin0.sin_len = sizeof(sin0); sin0.sin_family = AF_INET; - if (pptpd_add_listener(_this, 0, PPTPD_DEFAULT_LAYER2_LABEL, + if (pptpd_add_listener(_this, 0, PPTPD_DEFAULT_LAYER2_LABEL, (struct sockaddr *)&sin0) != 0) { return 1; } @@ -180,8 +181,8 @@ pptpd_add_listener(pptpd *_this, int idx, const char *label, if (plistener->bind_sin.sin_port == 0) plistener->bind_sin.sin_port = htons(PPTPD_DEFAULT_TCP_PORT); - /* When a raw socket binds both of an INADDR_ANY and specific IP - * address sockets, packets will be recieved by those sockets + /* When a raw socket binds both of an INADDR_ANY and specific IP + * address sockets, packets will be recieved by those sockets * simultaneously. To avoid this duplicate receives, not * permit such kind of configuration */ inaddr_any = 0; @@ -602,10 +603,10 @@ pptpd_reload(pptpd *_this, struct properties *config, const char *name, _this->config = config; do_start = 0; - if (pptpd_config_str_equal(_this, CFG_KEY(name, "enabled"), "true", + if (pptpd_config_str_equal(_this, CFG_KEY(name, "enabled"), "true", default_enabled)) { /* avoid false-true flap */ - if (pptpd_is_shutting_down(_this)) + if (pptpd_is_shutting_down(_this)) pptpd_stop_immediatly(_this); if (pptpd_is_stopped(_this)) do_start = 1; @@ -669,8 +670,8 @@ pptpd_reload(pptpd *_this, struct properties *config, const char *name, strlcpy(buf, val, sizeof(buf)); label = NULL; - /* it can accept multple velues with tab/space - * separation */ + /* it can accept multple velues with tab/space + * separation */ for (i = 0, cp = buf; (tok = strsep(&cp, VAL_SEP)) != NULL;) { if (*tok == '\0') @@ -684,7 +685,7 @@ pptpd_reload(pptpd *_this, struct properties *config, const char *name, pptpd_log(_this, LOG_ERR, "configuration error at " "%s: %s: %s", - CFG_KEY(name, "listener_in"), tok, + CFG_KEY(name, "listener_in"), tok, gai_strerror(aierr)); return 1; } @@ -1001,11 +1002,11 @@ pptp_ctrl_start_by_pptpd(pptpd *_this, int sock, int listener_index, "could not get interface informations", peer); goto fail; } - if (pptpd_config_str_equal(_this, + if (pptpd_config_str_equal(_this, config_key_prefix("pptpd.interface", ifname), "accept", 0)){ snprintf(ctrl->phy_label, sizeof(ctrl->phy_label), "%s%%%s", PPTP_CTRL_LISTENER_LABEL(ctrl), ifname); - } else if (pptpd_config_str_equal(_this, + } else if (pptpd_config_str_equal(_this, config_key_prefix("pptpd.interface", "any"), "accept", 0)){ snprintf(ctrl->phy_label, sizeof(ctrl->phy_label), "%s", PPTP_CTRL_LISTENER_LABEL(ctrl)); @@ -1016,7 +1017,7 @@ pptp_ctrl_start_by_pptpd(pptpd *_this, int sock, int listener_index, pptpd_log_access_deny(_this, msgbuf, peer); goto fail; } - } else + } else strlcpy(ctrl->phy_label, PPTP_CTRL_LISTENER_LABEL(ctrl), sizeof(ctrl->phy_label)); |