chiark
/
gitweb
/
~mdw
/
tripe
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a8f70fe
)
pathmtu/pathmtu.c (raw): Check the UDP packet signature.
author
Mark Wooding
<mdw@distorted.org.uk>
Tue, 19 Sep 2017 09:02:25 +0000
(10:02 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Thu, 28 Jun 2018 23:25:20 +0000
(
00:25
+0100)
pathmtu/pathmtu.c
patch
|
blob
|
blame
|
history
diff --git
a/pathmtu/pathmtu.c
b/pathmtu/pathmtu.c
index 6d988031c474a520fcc0b7b57f6886fe3854b55b..f42602e03bce709391ff7765b5fa7fab8c640d01 100644
(file)
--- a/
pathmtu/pathmtu.c
+++ b/
pathmtu/pathmtu.c
@@
-533,6
+533,7
@@
static int raw_selproc(void *stv, fd_set *fd_in, struct probestate *ps)
struct ip *ip;
struct icmp *icmp;
struct udphdr *udp;
struct ip *ip;
struct icmp *icmp;
struct udphdr *udp;
+ const unsigned char *payload;
ssize_t n;
/* An ICMP packet: see what's inside. */
ssize_t n;
/* An ICMP packet: see what's inside. */
@@
-565,6
+566,9
@@
static int raw_selproc(void *stv, fd_set *fd_in, struct probestate *ps)
goto skip_icmp;
n -= sizeof(*udp);
goto skip_icmp;
n -= sizeof(*udp);
+ payload = (const unsigned char *)(udp + 1);
+ if (!mypacketp(ps, payload, n)) goto skip_icmp;
+
if (icmp->icmp_code == ICMP_UNREACH_PORT) return (RC_HIGHER);
else if (icmp->icmp_code != ICMP_UNREACH_NEEDFRAG) goto skip_icmp;
else if (icmp->icmp_nextmtu) return (htons(icmp->icmp_nextmtu));
if (icmp->icmp_code == ICMP_UNREACH_PORT) return (RC_HIGHER);
else if (icmp->icmp_code != ICMP_UNREACH_NEEDFRAG) goto skip_icmp;
else if (icmp->icmp_nextmtu) return (htons(icmp->icmp_nextmtu));