-don't pass down, to module's fingerprint function, unused data like

a pointer to the ip header.
-style
-spacing
This commit is contained in:
Paolo Pisati 2009-04-08 11:56:49 +00:00
parent 30a8aaf0df
commit 43197d291a
10 changed files with 34 additions and 28 deletions

View File

@ -64,7 +64,7 @@ AliasHandleCUSeeMeIn(struct libalias *la, struct ip *pip,
struct in_addr original_addr);
static int
fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint(struct libalias *la, struct alias_data *ah)
{
if (ah->dport == NULL || ah->oaddr == NULL)

View File

@ -60,7 +60,7 @@ static void
AliasHandleDummy(struct libalias *la, struct ip *ip, struct alias_data *ah);
static int
fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint(struct libalias *la, struct alias_data *ah)
{
/*

View File

@ -104,7 +104,7 @@ AliasHandleFtpOut(struct libalias *, struct ip *, struct alias_link *,
int maxpacketsize);
static int
fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint(struct libalias *la, struct alias_data *ah)
{
if (ah->dport == NULL || ah->sport == NULL || ah->lnk == NULL ||

View File

@ -93,7 +93,7 @@ AliasHandleIrcOut(struct libalias *, struct ip *, struct alias_link *,
int maxpacketsize);
static int
fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint(struct libalias *la, struct alias_data *ah)
{
if (ah->dport == NULL || ah->dport == NULL || ah->lnk == NULL ||

View File

@ -133,9 +133,10 @@ handler_chain_destroy(void)
static int
_attach_handler(struct proto_handler *p)
{
struct proto_handler *b = NULL;
struct proto_handler *b;
LIBALIAS_WLOCK_ASSERT();
LIBALIAS_WLOCK_ASSERT();
b = NULL;
LIST_FOREACH(b, &handler_chain, entries) {
if ((b->pri == p->pri) &&
(b->dir == p->dir) &&
@ -172,10 +173,11 @@ _detach_handler(struct proto_handler *p)
int
LibAliasAttachHandlers(struct proto_handler *_p)
{
int i, error = -1;
int i, error;
LIBALIAS_WLOCK();
for (i=0; 1; i++) {
error = -1;
for (i = 0; 1; i++) {
if (*((int *)&_p[i]) == EOH)
break;
error = _attach_handler(&_p[i]);
@ -189,10 +191,11 @@ LibAliasAttachHandlers(struct proto_handler *_p)
int
LibAliasDetachHandlers(struct proto_handler *_p)
{
int i, error = -1;
int i, error;
LIBALIAS_WLOCK();
for (i=0; 1; i++) {
error = -1;
for (i = 0; 1; i++) {
if (*((int *)&_p[i]) == EOH)
break;
error = _detach_handler(&_p[i]);
@ -206,26 +209,27 @@ LibAliasDetachHandlers(struct proto_handler *_p)
int
detach_handler(struct proto_handler *_p)
{
int error = -1;
int error;
LIBALIAS_WLOCK();
error = -1;
error = _detach_handler(_p);
LIBALIAS_WUNLOCK();
return (error);
}
int
find_handler(int8_t dir, int8_t proto, struct libalias *la, struct ip *pip,
struct alias_data *ad)
find_handler(int8_t dir, int8_t proto, struct libalias *la, __unused struct ip *pip,
struct alias_data *ad)
{
struct proto_handler *p;
int error = ENOENT;
int error;
LIBALIAS_RLOCK();
error = ENOENT;
LIST_FOREACH(p, &handler_chain, entries) {
if ((p->dir & dir) && (p->proto & proto))
if (p->fingerprint(la, pip, ad) == 0) {
if (p->fingerprint(la, ad) == 0) {
error = p->protohandler(la, pip, ad);
break;
}
@ -259,9 +263,11 @@ attach_dll(struct dll *p)
void *
detach_dll(char *p)
{
struct dll *b = NULL, *b_tmp;
void *error = NULL;
struct dll *b, *b_tmp;
void *error;
b = NULL;
error = NULL;
SLIST_FOREACH_SAFE(b, &dll_chain, next, b_tmp)
if (!strncmp(b->name, p, DLL_LEN)) {
SLIST_REMOVE(&dll_chain, b, dll, next);

View File

@ -80,10 +80,10 @@ struct proto_handler {
u_int pri; /* Handler priority. */
int16_t dir; /* Flow direction. */
uint8_t proto; /* Working protocol. */
int (*fingerprint)(struct libalias *la, /* Fingerprint * function. */
struct ip *pip, struct alias_data *ah);
int (*protohandler)(struct libalias *la, /* Aliasing * function. */
struct ip *pip, struct alias_data *ah);
int (*fingerprint)(struct libalias *, /* Fingerprint * function. */
struct alias_data *);
int (*protohandler)(struct libalias *, /* Aliasing * function. */
struct ip *, struct alias_data *);
LIST_ENTRY(proto_handler) entries;
};

View File

@ -77,7 +77,7 @@ static int
AliasHandleUdpNbtNS(struct libalias *, struct ip *, struct alias_link *,
struct in_addr *, u_short *, struct in_addr *, u_short *);
static int
fingerprint1(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint1(struct libalias *la, struct alias_data *ah)
{
if (ah->dport == NULL || ah->sport == NULL || ah->lnk == NULL ||
@ -98,7 +98,7 @@ protohandler1(struct libalias *la, struct ip *pip, struct alias_data *ah)
}
static int
fingerprint2(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint2(struct libalias *la, struct alias_data *ah)
{
if (ah->dport == NULL || ah->sport == NULL || ah->lnk == NULL ||

View File

@ -79,7 +79,7 @@ static int
AliasHandlePptpGreIn(struct libalias *, struct ip *);
static int
fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint(struct libalias *la, struct alias_data *ah)
{
if (ah->dport == NULL || ah->sport == NULL || ah->lnk == NULL)
@ -91,7 +91,7 @@ fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah)
}
static int
fingerprintgre(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprintgre(struct libalias *la, struct alias_data *ah)
{
return (0);

View File

@ -57,7 +57,7 @@ static void
AliasHandleSkinny(struct libalias *, struct ip *, struct alias_link *);
static int
fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint(struct libalias *la, struct alias_data *ah)
{
if (ah->dport == NULL || ah->sport == NULL || ah->lnk == NULL)

View File

@ -132,7 +132,7 @@ static void
AliasHandleRtspOut(struct libalias *, struct ip *, struct alias_link *,
int maxpacketsize);
static int
fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah)
fingerprint(struct libalias *la, struct alias_data *ah)
{
if (ah->dport != NULL && ah->aport != NULL && ah->sport != NULL &&