diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2011-07-20 12:20:18 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-07-23 10:19:50 -0500 |
commit | e6d43cfb1f937898dc031c7b38a23e5ccad8bd9a (patch) | |
tree | 67adcf8336aa881316f8b91dc17307c47d70ae9f /slirp/misc.c | |
parent | 565465fcae755fbdb11c2f65ec5f0ae62c78db3a (diff) |
slirp: Forward ICMP echo requests via unprivileged sockets
Linux 3.0 gained support for unprivileged ICMP ping sockets. Use this
feature to forward guest pings to the outer world. The host admin has to
set the ping_group_range in order to grant access to those sockets. To
allow ping for the users group (GID 100):
echo 100 100 > /proc/sys/net/ipv4/ping_group_range
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'slirp/misc.c')
-rw-r--r-- | slirp/misc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/slirp/misc.c b/slirp/misc.c index 34179e26a8..6002550361 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -407,4 +407,17 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon) inet_ntoa(dst_addr), ntohs(dst_port), so->so_rcv.sb_cc, so->so_snd.sb_cc); } + + for (so = slirp->icmp.so_next; so != &slirp->icmp; so = so->so_next) { + n = snprintf(buf, sizeof(buf), " ICMP[%d sec]", + (so->so_expire - curtime) / 1000); + src.sin_addr = so->so_laddr; + dst_addr = so->so_faddr; + memset(&buf[n], ' ', 19 - n); + buf[19] = 0; + monitor_printf(mon, "%s %3d %15s - ", buf, so->s, + src.sin_addr.s_addr ? inet_ntoa(src.sin_addr) : "*"); + monitor_printf(mon, "%15s - %5d %5d\n", inet_ntoa(dst_addr), + so->so_rcv.sb_cc, so->so_snd.sb_cc); + } } |