mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-18 02:19:39 +00:00
Reapply "sbin/ping: allow normal users to specify larger packets"
The ping tests were originally broken by an unrelated isue that is now fixed (2926c25942
). THanks to kp@ for fixing the test and Jose Luis Duran for pinting it out. This reverts commit7bc0cb91a2
.
This commit is contained in:
parent
60516a51ab
commit
b88df1e893
@ -25,7 +25,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd September 15, 2023
|
.Dd October 15, 2024
|
||||||
.Dt PING 8
|
.Dt PING 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -312,7 +312,6 @@ with the 8 bytes of
|
|||||||
ICMP
|
ICMP
|
||||||
header data.
|
header data.
|
||||||
.Pp
|
.Pp
|
||||||
For IPv4, only the super-user may specify values more than default.
|
|
||||||
This option cannot be used with ping sweeps.
|
This option cannot be used with ping sweeps.
|
||||||
.Pp
|
.Pp
|
||||||
For IPv6, you may need to specify
|
For IPv6, you may need to specify
|
||||||
|
@ -96,8 +96,8 @@
|
|||||||
#define DEFDATALEN 56 /* default data length */
|
#define DEFDATALEN 56 /* default data length */
|
||||||
#define FLOOD_BACKOFF 20000 /* usecs to back off if F_FLOOD mode */
|
#define FLOOD_BACKOFF 20000 /* usecs to back off if F_FLOOD mode */
|
||||||
/* runs out of buffer space */
|
/* runs out of buffer space */
|
||||||
#define MAXIPLEN (sizeof(struct ip) + MAX_IPOPTLEN)
|
#define MAXIPLEN ((int)sizeof(struct ip) + MAX_IPOPTLEN)
|
||||||
#define MAXICMPLEN (ICMP_ADVLENMIN + MAX_IPOPTLEN)
|
#define MAXPAYLOAD (IP_MAXPACKET - MAXIPLEN - ICMP_MINLEN)
|
||||||
#define MAXWAIT 10000 /* max ms to wait for response */
|
#define MAXWAIT 10000 /* max ms to wait for response */
|
||||||
#define MAXALARM (60 * 60) /* max seconds for alarm timeout */
|
#define MAXALARM (60 * 60) /* max seconds for alarm timeout */
|
||||||
#define MAXTOS 255
|
#define MAXTOS 255
|
||||||
@ -458,11 +458,10 @@ ping(int argc, char *const *argv)
|
|||||||
errx(EX_USAGE, "invalid packet size: `%s'",
|
errx(EX_USAGE, "invalid packet size: `%s'",
|
||||||
optarg);
|
optarg);
|
||||||
datalen = (int)ltmp;
|
datalen = (int)ltmp;
|
||||||
if (uid != 0 && datalen > DEFDATALEN) {
|
if (datalen > MAXPAYLOAD) {
|
||||||
errno = EPERM;
|
errx(EX_USAGE,
|
||||||
err(EX_NOPERM,
|
|
||||||
"packet size too large: %d > %u",
|
"packet size too large: %d > %u",
|
||||||
datalen, DEFDATALEN);
|
datalen, MAXPAYLOAD);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'T': /* multicast TTL */
|
case 'T': /* multicast TTL */
|
||||||
|
Loading…
Reference in New Issue
Block a user