X-Git-Url: https://git.distorted.org.uk/~mdw/secnet/blobdiff_plain/cfd794827e3243c681590845063309fa628cfef4..211cd6277e10a6402a4f7abb41dc8b0829b04ada:/netlink.c diff --git a/netlink.c b/netlink.c index 87b6671..0dd4450 100644 --- a/netlink.c +++ b/netlink.c @@ -120,7 +120,7 @@ their use. #define ICMP_CODE_TTL_EXCEEDED 0 /* Generic IP checksum routine */ -static inline uint16_t ip_csum(uint8_t *iph,int32_t count) +static inline uint16_t ip_csum(const uint8_t *iph,int32_t count) { register uint32_t sum=0; @@ -144,7 +144,7 @@ static inline uint16_t ip_csum(uint8_t *iph,int32_t count) * By Jorge Cwik , adapted for linux by * Arnt Gulbrandsen. */ -static inline uint16_t ip_fast_csum(uint8_t *iph, int32_t ihl) { +static inline uint16_t ip_fast_csum(const uint8_t *iph, int32_t ihl) { uint32_t sum; __asm__ __volatile__( @@ -304,9 +304,17 @@ static bool_t netlink_icmp_may_reply(struct buffer_if *buf) icmph=(struct icmphdr *)buf->start; if (iph->protocol==1) { switch(icmph->type) { - case 3: /* Destination unreachable */ - case 11: /* Time Exceeded */ - case 12: /* Parameter Problem */ + /* Based on http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml#icmp-parameters-types + * as retrieved Thu, 20 Mar 2014 00:16:44 +0000. + * Deprecated, reserved, unassigned and experimental + * options are treated as not safe to reply to. + */ + case 0: /* Echo Reply */ + case 8: /* Echo */ + case 13: /* Timestamp */ + case 14: /* Timestamp Reply */ + return True; + default: return False; } }