|
|
@ -13,6 +13,7 @@
|
|
|
|
#include "sys/endian.h"
|
|
|
|
#include "sys/endian.h"
|
|
|
|
#include "sys/ip.h"
|
|
|
|
#include "sys/ip.h"
|
|
|
|
#include "numlib.h"
|
|
|
|
#include "numlib.h"
|
|
|
|
|
|
|
|
#include "smallbytecopy.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
@ -41,13 +42,13 @@ char *Bgp_PrefixToString(Afi afi, const RawPrefix *prefix, char *dest)
|
|
|
|
switch (afi) {
|
|
|
|
switch (afi) {
|
|
|
|
case AFI_IP:
|
|
|
|
case AFI_IP:
|
|
|
|
memset(&adr, 0, sizeof(adr));
|
|
|
|
memset(&adr, 0, sizeof(adr));
|
|
|
|
memcpy(&adr, prefix->bytes, PFXLEN(prefix->width));
|
|
|
|
_smallbytecopy4(adr.bytes, prefix->bytes, PFXLEN(prefix->width));
|
|
|
|
dest = Ipv4_AdrToString(&adr, dest);
|
|
|
|
dest = Ipv4_AdrToString(&adr, dest);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case AFI_IP6:
|
|
|
|
case AFI_IP6:
|
|
|
|
memset(&adr6, 0, sizeof(adr6));
|
|
|
|
memset(&adr6, 0, sizeof(adr6));
|
|
|
|
memcpy(&adr6, prefix->bytes, PFXLEN(prefix->width));
|
|
|
|
_smallbytecopy16(adr6.bytes, prefix->bytes, PFXLEN(prefix->width));
|
|
|
|
dest = Ipv6_AdrToString(&adr6, dest);
|
|
|
|
dest = Ipv6_AdrToString(&adr6, dest);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
@ -122,7 +123,7 @@ Judgement Bgp_StringToPrefix(const char *s, Prefix *dest)
|
|
|
|
|
|
|
|
|
|
|
|
dest->isAddPath = FALSE;
|
|
|
|
dest->isAddPath = FALSE;
|
|
|
|
dest->width = width;
|
|
|
|
dest->width = width;
|
|
|
|
memcpy(dest->bytes, adr.bytes, PFXLEN(width));
|
|
|
|
_smallbytecopy16(dest->bytes, adr.bytes, PFXLEN(width));
|
|
|
|
return OK;
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|