mirror of https://gitee.com/openkylin/qemu.git
slirp updates
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEErr90SPq5RTpFUjkOsKUb9YyRecUFAlja6QcACgkQsKUb9YyR ecUX2Q/9GWmhwicy0PqSDwqz/cKSqjs1PBCyiKhc4xVnR+kID5TjrnNTaOnlvGC/ 9Y4y6fYL7Z80Ir4ECIjHRI7csZ8wvEsZEAmSbvBtAn+5xaIBc0KaMvKZuV4v0kFf ufZxQpJOzob6C/2a+WOTVdhHKUyCUD7+B3qAlyrDmfR24sWKfsTkegDD/zFy82+b oN1pra5MofGvmKbT0qDDVQD12VeYkl2ugvEnMK9aYRJUtXv0oilmVhkKLREUSQfF N9wO5W6ULunvEMvfOgLBwxKig43z1zya4NGfEVs61OZgNQrpKqT6nsUq83hU16DN filwLRUidH5O8jK2nCPZ6WkmsV6Lg7hi/mv81vzKrWrL+pqs0nYB5RY71hBawpO3 NhhcBHuTlsqP1nwYSUY+zQgIQXGykKRenMFbLPA5bxl5I7F4DAehlt3RueYhWyd4 ZGlQ1AlBtEU0syqFxOnCxxl59y915korrBCkV9H6L3I9O/y0OIVfKUyG0DAVBYlR 1o115msC+Y35psTNfT2c1TKI9msfY3NPG2+XL1xnoDUKw9AW1h42uOTKaxwxNUEn 7umjAfT8FuGn8mLgVhpm+tE9Apsok1gIWLr+l3SthCvqBctfWzXQ4TLPoFrBSgqP LEKkpCJTpgqK9IS2KAKDQgd9AfrfFf/2YXyt/NlU9rY1BrFq3bQ= =KxSW -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging slirp updates # gpg: Signature made Tue 28 Mar 2017 23:51:51 BST # gpg: using RSA key 0xB0A51BF58C9179C5 # gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" # gpg: aka "Samuel Thibault <sthibault@debian.org>" # gpg: aka "Samuel Thibault <samuel.thibault@gnu.org>" # gpg: aka "Samuel Thibault <samuel.thibault@inria.fr>" # gpg: aka "Samuel Thibault <samuel.thibault@labri.fr>" # gpg: aka "Samuel Thibault <samuel.thibault@ens-lyon.org>" # gpg: aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 900C B024 B679 31D4 0F82 304B D017 8C76 7D06 9EE6 # Subkey fingerprint: AEBF 7448 FAB9 453A 4552 390E B0A5 1BF5 8C91 79C5 * remotes/thibault/tags/samuel-thibault: slirp: Send RDNSS in RA only if host has an IPv6 DNS server slirp: Make RA build more flexible slirp: fix compilation errors with DEBUG set Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
e839001d5b
|
@ -143,17 +143,13 @@ void ndp_send_ra(Slirp *slirp)
|
|||
/* Build IPv6 packet */
|
||||
struct mbuf *t = m_get(slirp);
|
||||
struct ip6 *rip = mtod(t, struct ip6 *);
|
||||
size_t pl_size = 0;
|
||||
struct in6_addr addr;
|
||||
uint32_t scope_id;
|
||||
|
||||
rip->ip_src = (struct in6_addr)LINKLOCAL_ADDR;
|
||||
rip->ip_dst = (struct in6_addr)ALLNODES_MULTICAST;
|
||||
rip->ip_nh = IPPROTO_ICMPV6;
|
||||
rip->ip_pl = htons(ICMP6_NDP_RA_MINLEN
|
||||
+ NDPOPT_LINKLAYER_LEN
|
||||
+ NDPOPT_PREFIXINFO_LEN
|
||||
#ifndef _WIN32
|
||||
+ NDPOPT_RDNSS_LEN
|
||||
#endif
|
||||
);
|
||||
t->m_len = sizeof(struct ip6) + ntohs(rip->ip_pl);
|
||||
|
||||
/* Build ICMPv6 packet */
|
||||
t->m_data += sizeof(struct ip6);
|
||||
|
@ -171,6 +167,7 @@ void ndp_send_ra(Slirp *slirp)
|
|||
ricmp->icmp6_nra.reach_time = htonl(NDP_AdvReachableTime);
|
||||
ricmp->icmp6_nra.retrans_time = htonl(NDP_AdvRetransTime);
|
||||
t->m_data += ICMP6_NDP_RA_MINLEN;
|
||||
pl_size += ICMP6_NDP_RA_MINLEN;
|
||||
|
||||
/* Source link-layer address (NDP option) */
|
||||
struct ndpopt *opt = mtod(t, struct ndpopt *);
|
||||
|
@ -178,6 +175,7 @@ void ndp_send_ra(Slirp *slirp)
|
|||
opt->ndpopt_len = NDPOPT_LINKLAYER_LEN / 8;
|
||||
in6_compute_ethaddr(rip->ip_src, opt->ndpopt_linklayer);
|
||||
t->m_data += NDPOPT_LINKLAYER_LEN;
|
||||
pl_size += NDPOPT_LINKLAYER_LEN;
|
||||
|
||||
/* Prefix information (NDP option) */
|
||||
struct ndpopt *opt2 = mtod(t, struct ndpopt *);
|
||||
|
@ -192,27 +190,26 @@ void ndp_send_ra(Slirp *slirp)
|
|||
opt2->ndpopt_prefixinfo.reserved2 = 0;
|
||||
opt2->ndpopt_prefixinfo.prefix = slirp->vprefix_addr6;
|
||||
t->m_data += NDPOPT_PREFIXINFO_LEN;
|
||||
pl_size += NDPOPT_PREFIXINFO_LEN;
|
||||
|
||||
#ifndef _WIN32
|
||||
/* Prefix information (NDP option) */
|
||||
/* disabled for windows for now, until get_dns6_addr is implemented */
|
||||
struct ndpopt *opt3 = mtod(t, struct ndpopt *);
|
||||
opt3->ndpopt_type = NDPOPT_RDNSS;
|
||||
opt3->ndpopt_len = NDPOPT_RDNSS_LEN / 8;
|
||||
opt3->ndpopt_rdnss.reserved = 0;
|
||||
opt3->ndpopt_rdnss.lifetime = htonl(2 * NDP_MaxRtrAdvInterval);
|
||||
opt3->ndpopt_rdnss.addr = slirp->vnameserver_addr6;
|
||||
t->m_data += NDPOPT_RDNSS_LEN;
|
||||
#endif
|
||||
if (get_dns6_addr(&addr, &scope_id) >= 0) {
|
||||
/* Host system does have an IPv6 DNS server, announce our proxy. */
|
||||
struct ndpopt *opt3 = mtod(t, struct ndpopt *);
|
||||
opt3->ndpopt_type = NDPOPT_RDNSS;
|
||||
opt3->ndpopt_len = NDPOPT_RDNSS_LEN / 8;
|
||||
opt3->ndpopt_rdnss.reserved = 0;
|
||||
opt3->ndpopt_rdnss.lifetime = htonl(2 * NDP_MaxRtrAdvInterval);
|
||||
opt3->ndpopt_rdnss.addr = slirp->vnameserver_addr6;
|
||||
t->m_data += NDPOPT_RDNSS_LEN;
|
||||
pl_size += NDPOPT_RDNSS_LEN;
|
||||
}
|
||||
|
||||
rip->ip_pl = htons(pl_size);
|
||||
t->m_data -= sizeof(struct ip6) + pl_size;
|
||||
t->m_len = sizeof(struct ip6) + pl_size;
|
||||
|
||||
/* ICMPv6 Checksum */
|
||||
#ifndef _WIN32
|
||||
t->m_data -= NDPOPT_RDNSS_LEN;
|
||||
#endif
|
||||
t->m_data -= NDPOPT_PREFIXINFO_LEN;
|
||||
t->m_data -= NDPOPT_LINKLAYER_LEN;
|
||||
t->m_data -= ICMP6_NDP_RA_MINLEN;
|
||||
t->m_data -= sizeof(struct ip6);
|
||||
ricmp->icmp6_cksum = ip6_cksum(t);
|
||||
|
||||
ip6_output(NULL, t, 0);
|
||||
|
|
|
@ -198,7 +198,7 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr,
|
|||
#ifdef DEBUG
|
||||
else {
|
||||
char s[INET6_ADDRSTRLEN];
|
||||
char *res = inet_ntop(af, tmp_addr, s, sizeof(s));
|
||||
const char *res = inet_ntop(af, tmp_addr, s, sizeof(s));
|
||||
if (!res) {
|
||||
res = "(string conversion error)";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue