Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/libalias/alias_db.c
Show First 20 Lines • Show All 1,669 Lines • ▼ Show 20 Lines | |||||
FindOriginalAddress(struct libalias *la, struct in_addr alias_addr) | FindOriginalAddress(struct libalias *la, struct in_addr alias_addr) | ||||
{ | { | ||||
struct alias_link *lnk; | struct alias_link *lnk; | ||||
LIBALIAS_LOCK_ASSERT(la); | LIBALIAS_LOCK_ASSERT(la); | ||||
lnk = FindLinkIn(la, ANY_ADDR, alias_addr, | lnk = FindLinkIn(la, ANY_ADDR, alias_addr, | ||||
0, 0, LINK_ADDR, 0); | 0, 0, LINK_ADDR, 0); | ||||
if (lnk == NULL) { | if (lnk == NULL) { | ||||
la->newDefaultLink = 1; | |||||
if (la->targetAddress.s_addr == INADDR_ANY) | if (la->targetAddress.s_addr == INADDR_ANY) | ||||
return (alias_addr); | return (alias_addr); | ||||
else if (la->targetAddress.s_addr == INADDR_NONE) | else if (la->targetAddress.s_addr == INADDR_NONE) | ||||
return (la->aliasAddress.s_addr != INADDR_ANY) ? | return (la->aliasAddress.s_addr != INADDR_ANY) ? | ||||
la->aliasAddress : alias_addr; | la->aliasAddress : alias_addr; | ||||
else | else | ||||
return (la->targetAddress); | return (la->targetAddress); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | |||||
#ifdef LIBALIAS_DEBUG | #ifdef LIBALIAS_DEBUG | ||||
fprintf(stderr, "PacketAlias/SetExpire(): "); | fprintf(stderr, "PacketAlias/SetExpire(): "); | ||||
fprintf(stderr, "error in expire parameter\n"); | fprintf(stderr, "error in expire parameter\n"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
void | void | ||||
ClearCheckNewLink(struct libalias *la) | |||||
{ | |||||
LIBALIAS_LOCK_ASSERT(la); | |||||
la->newDefaultLink = 0; | |||||
} | |||||
void | |||||
SetProtocolFlags(struct alias_link *lnk, int pflags) | SetProtocolFlags(struct alias_link *lnk, int pflags) | ||||
{ | { | ||||
lnk->pflags = pflags; | lnk->pflags = pflags; | ||||
} | } | ||||
int | int | ||||
GetProtocolFlags(struct alias_link *lnk) | GetProtocolFlags(struct alias_link *lnk) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 472 Lines • ▼ Show 20 Lines | #endif | ||||
/* Other flags can be set/cleared without special action */ | /* Other flags can be set/cleared without special action */ | ||||
la->packetAliasMode = (flags & mask) | (la->packetAliasMode & ~mask); | la->packetAliasMode = (flags & mask) | (la->packetAliasMode & ~mask); | ||||
res = la->packetAliasMode; | res = la->packetAliasMode; | ||||
getout: | getout: | ||||
LIBALIAS_UNLOCK(la); | LIBALIAS_UNLOCK(la); | ||||
return (res); | return (res); | ||||
} | } | ||||
/* never used and never worked, to be removed in FreeBSD 14 */ | |||||
int | int | ||||
LibAliasCheckNewLink(struct libalias *la) | LibAliasCheckNewLink(struct libalias *la) | ||||
{ | { | ||||
int res; | (void)la; | ||||
return (0); | |||||
LIBALIAS_LOCK(la); | |||||
res = la->newDefaultLink; | |||||
LIBALIAS_UNLOCK(la); | |||||
return (res); | |||||
} | } | ||||
#ifndef NO_FW_PUNCH | #ifndef NO_FW_PUNCH | ||||
/***************** | /***************** | ||||
Code to support firewall punching. This shouldn't really be in this | Code to support firewall punching. This shouldn't really be in this | ||||
file, but making variables global is evil too. | file, but making variables global is evil too. | ||||
****************/ | ****************/ | ||||
▲ Show 20 Lines • Show All 286 Lines • Show Last 20 Lines |