Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ipArt.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ rtArtFreeRoute (rtTable* pt, routeEnt* r)
* pEnt There is an existing route that has the same
* IP prefix (address and prefix length).
* `pEnt' must be freed in this case.
*
*
*/
static routeEnt*
rtArtInsertRoute (rtTable* pt, routeEnt* pEnt)
Expand Down Expand Up @@ -584,7 +584,6 @@ rtArtDeleteRoute (rtTable* pt, u8* pDest, int plen)
if ( plen == 0 ) {
pEnt = pt->root[1].ent;
pt->root[1].ent = NULL;
pt->nRoutes--;
goto FreeAndReturn;
}

Expand Down Expand Up @@ -627,6 +626,7 @@ rtArtDeleteRoute (rtTable* pt, u8* pDest, int plen)

FreeAndReturn:
if ( pEnt == NULL ) return false;
pt->nRoutes--;
rtArtFreeRoute(pt, pEnt);
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions ipArt.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void rtArtCollectStats(rtTable* pt, subtable ps);
* @name bitCmp8
*
* @brief Compare between arbitrary bits of a byte
*
*
*
* @param[in] d1 Data 1 (one byte) to be compared.
* @param[in] d2 Data 2 (one byte) to be compared.
Expand Down Expand Up @@ -177,7 +177,7 @@ bitCmp8 (u8 p1, u8 p2, int st, int end)
* @name bitStrCmp
*
* @brief Compare two bit strings
*
*
*
* @param[in] p1 Pointer to bit string 1 to be compared.
* @param[in] p2 Pointer to bit string 2 to be compared.
Expand Down Expand Up @@ -298,7 +298,7 @@ cmpAddr (u8* p1, u8* p2, int plen)
return false;
}
}
if ( len == plen ) {
if ( len == plen + 8 ) {
return true;
}

Expand Down
12 changes: 6 additions & 6 deletions ipArtPathComp.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ checkSubtable (rtTable* pt, subtable t, bool* flag)
* @brief Allocates a new subtable (trie node) of the given level.
*
* @param[in] p Pointer to the routing table
* @param[in] level
* @param[in] base Subtable (trie node) default route. Assume a
* @param[in] level
* @param[in] base Subtable (trie node) default route. Assume a
* newly allocated subtable (pst) is connected to
* the index (i) of parent subtable (pn). `base'
* must be pn[i].ent if pn[i] is a route entry.
Expand All @@ -277,7 +277,7 @@ rtArtPcNewSubTable (rtTable* p, int level, tableEntry base, u8* pa)
register subtable t;
register int a;
size_t len;


assert(p && pa && level >= 0 && level < p->nLevels);

Expand Down Expand Up @@ -614,7 +614,7 @@ rtArtPcFindExactMatch (rtTable* pt, u8* pDest, int plen)
* @name insertNewSubtable
*
* @brief Inserts a new subtable (trie node)
*
*
*
* @param[in] p Pointer to the routing table
* @param[in] pEnt Pointer to the route entry to be inserted
Expand Down Expand Up @@ -728,7 +728,7 @@ insertNewSubtable (rtTable* p, routeEnt* pEnt,
* pEnt There is an existing route that has the same
* IP prefix (address and prefix length).
* `pEnt' must be freed in this case.
*
*
*/
static routeEnt*
rtArtPcInsertRoute (rtTable* pt, routeEnt* pEnt)
Expand Down Expand Up @@ -1012,6 +1012,7 @@ rtArtPcDeleteRoute (rtTable* pt, u8* pDest, int plen)
* Handle default route
*/
if (plen == 0) {
if ( pt->root[1].ent == NULL ) return false;
rtArtFreeRoute(pt, pt->root[1].ent);
pt->root[1].ent = NULL;
--pt->nRoutes;
Expand Down Expand Up @@ -1075,7 +1076,6 @@ rtArtPcDestroy (rtTable** p)
pt->flush(pt);
free(pt->pPcSt);
free(pt->root + pt->off);
free(pt->pTbl);
free(pt->pEnt);
free(pt->psi);
free(pt);
Expand Down