mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Merge branch 'int-new' of gitlab.labs.nic.cz:labs/bird into int-new
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
src := bitops.c checksum.c ip.c lists.c md5.c net.c patmatch.c printf.c sha1.c sha256.c sha512.c slists.c xmalloc.c
|
||||
obj := $(src-o-files)
|
||||
$(all-client)
|
||||
|
||||
src := bitops.c checksum.c event.c idm.c ip.c lists.c md5.c mempool.c net.c patmatch.c printf.c resource.c sha1.c sha256.c sha512.c slab.c slists.c tbf.c xmalloc.c
|
||||
obj := $(src-o-files)
|
||||
$(all-daemon)
|
||||
|
@@ -61,6 +61,7 @@ static inline int u64_cmp(u64 i1, u64 i2)
|
||||
|
||||
#define NORET __attribute__((noreturn))
|
||||
#define UNUSED __attribute__((unused))
|
||||
#define PACKED __attribute__((packed))
|
||||
|
||||
|
||||
/* Microsecond time */
|
||||
|
@@ -25,5 +25,6 @@ u32 u32_log2(u32 v);
|
||||
|
||||
static inline u32 u32_hash(u32 v) { return v * 2902958171u; }
|
||||
|
||||
#endif
|
||||
static inline u8 u32_popcount(u32 v) { return __builtin_popcount(v); }
|
||||
|
||||
#endif
|
||||
|
1
lib/ip.h
1
lib/ip.h
@@ -26,6 +26,7 @@
|
||||
#define IP6_OSPF_ALL_ROUTERS ipa_build6(0xFF020000, 0, 0, 5)
|
||||
#define IP6_OSPF_DES_ROUTERS ipa_build6(0xFF020000, 0, 0, 6)
|
||||
#define IP6_RIP_ROUTERS ipa_build6(0xFF020000, 0, 0, 9)
|
||||
#define IP6_BABEL_ROUTERS ipa_build6(0xFF020000, 0, 0, 0x00010006)
|
||||
|
||||
#define IP4_NONE _MI4(0)
|
||||
#define IP6_NONE _MI6(0,0,0,0)
|
||||
|
27
lib/printf.c
27
lib/printf.c
@@ -124,9 +124,10 @@ static char * number(char * str, long num, int base, int size, int precision,
|
||||
* standard IP address width which depends on whether we use IPv4 or IPv6; |%I4|
|
||||
* or |%I6| can be used for explicit ip4_addr / ip6_addr arguments, |%N| for
|
||||
* generic network addresses (net_addr *), |%R| for Router / Network ID (u32
|
||||
* value printed as IPv4 address) and |%m| resp. |%M| for error messages (uses
|
||||
* strerror() to translate @errno code to message text). On the other hand, it
|
||||
* doesn't support floating point numbers.
|
||||
* value printed as IPv4 address), |%lR| for 64bit Router / Network ID (u64
|
||||
* value printed as eight :-separated octets) and |%m| resp. |%M| for error
|
||||
* messages (uses strerror() to translate @errno code to message text). On the
|
||||
* other hand, it doesn't support floating point numbers.
|
||||
*
|
||||
* Result: number of characters of the output string or -1 if
|
||||
* the buffer space was insufficient.
|
||||
@@ -137,6 +138,7 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
|
||||
unsigned long num;
|
||||
int i, base;
|
||||
u32 x;
|
||||
u64 X;
|
||||
char *str, *start;
|
||||
const char *s;
|
||||
char ipbuf[NET_MAX_TEXT_LENGTH+1];
|
||||
@@ -338,8 +340,23 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
|
||||
|
||||
/* Router/Network ID - essentially IPv4 address in u32 value */
|
||||
case 'R':
|
||||
x = va_arg(args, u32);
|
||||
ip4_ntop(ip4_from_u32(x), ipbuf);
|
||||
if (qualifier == 'l') {
|
||||
X = va_arg(args, u64);
|
||||
bsprintf(ipbuf, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
((X >> 56) & 0xff),
|
||||
((X >> 48) & 0xff),
|
||||
((X >> 40) & 0xff),
|
||||
((X >> 32) & 0xff),
|
||||
((X >> 24) & 0xff),
|
||||
((X >> 16) & 0xff),
|
||||
((X >> 8) & 0xff),
|
||||
(X & 0xff));
|
||||
}
|
||||
else
|
||||
{
|
||||
x = va_arg(args, u32);
|
||||
ip4_ntop(ip4_from_u32(x), ipbuf);
|
||||
}
|
||||
s = ipbuf;
|
||||
goto str;
|
||||
|
||||
|
@@ -79,7 +79,7 @@ int sk_leave_group(sock *s, ip_addr maddr); /* Leave multicast group on sk iface
|
||||
int sk_setup_broadcast(sock *s);
|
||||
int sk_set_ttl(sock *s, int ttl); /* Set transmit TTL for given socket */
|
||||
int sk_set_min_ttl(sock *s, int ttl); /* Set minimal accepted TTL for given socket */
|
||||
int sk_set_md5_auth(sock *s, ip_addr a, struct iface *ifa, char *passwd);
|
||||
int sk_set_md5_auth(sock *s, ip_addr local, ip_addr remote, struct iface *ifa, char *passwd, int setkey);
|
||||
int sk_set_ipv6_checksum(sock *s, int offset);
|
||||
int sk_set_icmp6_filter(sock *s, int p1, int p2);
|
||||
void sk_log_error(sock *s, const char *p);
|
||||
|
@@ -24,4 +24,12 @@ void buffer_puts(buffer *buf, const char *str);
|
||||
|
||||
int patmatch(const byte *pat, const byte *str);
|
||||
|
||||
static inline char *xbasename(const char *str)
|
||||
{
|
||||
char *s = strrchr(str, '/');
|
||||
return s ? s+1 : (char *) str;
|
||||
}
|
||||
|
||||
#define ROUTER_ID_64_LENGTH 23
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user