Merge branch 'master' into net-next

This commit is contained in:
Stephen Hemminger 2017-10-11 11:07:20 -07:00
commit 4999c57733
13 changed files with 74 additions and 10 deletions

24
configure vendored
View File

@ -326,6 +326,27 @@ EOF
rm -f $TMPDIR/dbtest.c $TMPDIR/dbtest rm -f $TMPDIR/dbtest.c $TMPDIR/dbtest
} }
check_strlcpy()
{
cat >$TMPDIR/strtest.c <<EOF
#include <string.h>
int main(int argc, char **argv) {
char dst[10];
strlcpy(dst, "test", sizeof(dst));
return 0;
}
EOF
$CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "no"
else
echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
echo "yes"
fi
rm -f $TMPDIR/strtest.c $TMPDIR/strtest
}
quiet_config() quiet_config()
{ {
cat <<EOF cat <<EOF
@ -397,6 +418,9 @@ check_mnl
echo -n "Berkeley DB: " echo -n "Berkeley DB: "
check_berkeley_db check_berkeley_db
echo -n "need for strlcpy: "
check_strlcpy
echo echo
echo -n "docs:" echo -n "docs:"
check_docs check_docs

View File

@ -195,6 +195,8 @@ static inline void __jiffies_to_tv(struct timeval *tv, unsigned long jiffies)
tv->tv_usec = tvusec - 1000000 * tv->tv_sec; tv->tv_usec = tvusec - 1000000 * tv->tv_sec;
} }
void print_escape_buf(const __u8 *buf, size_t len, const char *escape);
int print_timestamp(FILE *fp); int print_timestamp(FILE *fp);
void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n); void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n);

View File

@ -31,6 +31,7 @@
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <errno.h> #include <errno.h>
#include <ctype.h>
#include "rt_names.h" #include "rt_names.h"
#include "utils.h" #include "utils.h"
@ -1047,6 +1048,20 @@ int addr64_n2a(__u64 addr, char *buff, size_t len)
return written; return written;
} }
/* Print buffer and escape bytes that are !isprint or among 'escape' */
void print_escape_buf(const __u8 *buf, size_t len, const char *escape)
{
size_t i;
for (i = 0; i < len; ++i) {
if (isprint(buf[i]) && buf[i] != '\\' &&
!strchr(escape, buf[i]))
printf("%c", buf[i]);
else
printf("\\%03o", buf[i]);
}
}
int print_timestamp(FILE *fp) int print_timestamp(FILE *fp)
{ {
struct timeval tv; struct timeval tv;
@ -1260,6 +1275,7 @@ int get_real_family(int rtm_type, int rtm_family)
return rtm_family; return rtm_family;
} }
#ifdef NEED_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t size) size_t strlcpy(char *dst, const char *src, size_t size)
{ {
size_t srclen = strlen(src); size_t srclen = strlen(src);
@ -1282,3 +1298,4 @@ size_t strlcat(char *dst, const char *src, size_t size)
return dlen + strlcpy(dst + dlen, src, size - dlen); return dlen + strlcpy(dst + dlen, src, size - dlen);
} }
#endif

View File

@ -2230,6 +2230,16 @@ static void print_skmeminfo(struct rtattr *tb[], int attrtype)
printf(")"); printf(")");
} }
static void print_md5sig(struct tcp_diag_md5sig *sig)
{
printf("%s/%d=",
format_host(sig->tcpm_family,
sig->tcpm_family == AF_INET6 ? 16 : 4,
&sig->tcpm_addr),
sig->tcpm_prefixlen);
print_escape_buf(sig->tcpm_key, sig->tcpm_keylen, " ,");
}
#define TCPI_HAS_OPT(info, opt) !!(info->tcpi_options & (opt)) #define TCPI_HAS_OPT(info, opt) !!(info->tcpi_options & (opt))
static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
@ -2366,6 +2376,17 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
free(s.dctcp); free(s.dctcp);
free(s.bbr_info); free(s.bbr_info);
} }
if (tb[INET_DIAG_MD5SIG]) {
struct tcp_diag_md5sig *sig = RTA_DATA(tb[INET_DIAG_MD5SIG]);
int len = RTA_PAYLOAD(tb[INET_DIAG_MD5SIG]);
printf(" md5keys:");
print_md5sig(sig++);
for (len -= sizeof(*sig); len > 0; len -= sizeof(*sig)) {
printf(",");
print_md5sig(sig++);
}
}
} }
static const char *format_host_sa(struct sockaddr_storage *sa) static const char *format_host_sa(struct sockaddr_storage *sa)

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
source lib/generic.sh . lib/generic.sh
ts_log "[Testing add/del virtual links]" ts_log "[Testing add/del virtual links]"

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
source lib/generic.sh . lib/generic.sh
NL_FILE="tests/ip/link/dev_wo_vf_rate.nl" NL_FILE="tests/ip/link/dev_wo_vf_rate.nl"
ts_ip "$0" "Show VF devices w/o VF rate info" -d monitor file $NL_FILE ts_ip "$0" "Show VF devices w/o VF rate info" -d monitor file $NL_FILE

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
source lib/generic.sh . lib/generic.sh
ts_log "[Testing netns nsid]" ts_log "[Testing netns nsid]"

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
source lib/generic.sh . lib/generic.sh
ts_log "[Testing netns nsid in batch mode]" ts_log "[Testing netns nsid in batch mode]"

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/bash
source lib/generic.sh . lib/generic.sh
ts_log "[Testing add default route]" ts_log "[Testing add default route]"

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
source lib/generic.sh . lib/generic.sh
TUNNEL_NAME="tunnel_test_ip" TUNNEL_NAME="tunnel_test_ip"

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# vim: ft=sh # vim: ft=sh
source lib/generic.sh . lib/generic.sh
QDISCS="cbq htb dsmark" QDISCS="cbq htb dsmark"

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# vim: ft=sh # vim: ft=sh
source lib/generic.sh . lib/generic.sh
ts_qdisc_available "dsmark" ts_qdisc_available "dsmark"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
source lib/generic.sh . lib/generic.sh
DEV="$(rand_dev)" DEV="$(rand_dev)"
ts_ip "$0" "Add $DEV dummy interface" link add dev $DEV type dummy ts_ip "$0" "Add $DEV dummy interface" link add dev $DEV type dummy