ip_icmp.c (4399e055ea610cdefa1470ad1ee614dd81ba5e56) | ip_icmp.c (60d8dbbef075d3b39891ed35e124d0f7ef8e5fb9) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 330 unchanged lines hidden (view full) --- 339 m->m_data += sizeof(struct ip); 340 m->m_len = ICMP_MINLEN + icmplen; 341 342 /* XXX MRT make the outgoing packet use the same FIB 343 * that was associated with the incoming packet 344 */ 345 M_SETFIB(m, M_GETFIB(n)); 346 icp = mtod(m, struct icmp *); | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 330 unchanged lines hidden (view full) --- 339 m->m_data += sizeof(struct ip); 340 m->m_len = ICMP_MINLEN + icmplen; 341 342 /* XXX MRT make the outgoing packet use the same FIB 343 * that was associated with the incoming packet 344 */ 345 M_SETFIB(m, M_GETFIB(n)); 346 icp = mtod(m, struct icmp *); |
347 ICMPSTAT_INC(icps_outhist[type]); | 347 ICMPSTAT_INC2(icps_outhist, type); |
348 icp->icmp_type = type; 349 if (type == ICMP_REDIRECT) 350 icp->icmp_gwaddr.s_addr = dest; 351 else { 352 icp->icmp_void = 0; 353 /* 354 * The following assignments assume an overlay with the 355 * just zeroed icmp_void field. --- 167 unchanged lines hidden (view full) --- 523 icmpsrc.sin_family = AF_INET; 524 bzero(&icmpdst, sizeof(icmpdst)); 525 icmpdst.sin_len = sizeof(struct sockaddr_in); 526 icmpdst.sin_family = AF_INET; 527 bzero(&icmpgw, sizeof(icmpgw)); 528 icmpgw.sin_len = sizeof(struct sockaddr_in); 529 icmpgw.sin_family = AF_INET; 530 | 348 icp->icmp_type = type; 349 if (type == ICMP_REDIRECT) 350 icp->icmp_gwaddr.s_addr = dest; 351 else { 352 icp->icmp_void = 0; 353 /* 354 * The following assignments assume an overlay with the 355 * just zeroed icmp_void field. --- 167 unchanged lines hidden (view full) --- 523 icmpsrc.sin_family = AF_INET; 524 bzero(&icmpdst, sizeof(icmpdst)); 525 icmpdst.sin_len = sizeof(struct sockaddr_in); 526 icmpdst.sin_family = AF_INET; 527 bzero(&icmpgw, sizeof(icmpgw)); 528 icmpgw.sin_len = sizeof(struct sockaddr_in); 529 icmpgw.sin_family = AF_INET; 530 |
531 ICMPSTAT_INC(icps_inhist[icp->icmp_type]); | 531 ICMPSTAT_INC2(icps_inhist, icp->icmp_type); |
532 code = icp->icmp_code; 533 switch (icp->icmp_type) { 534 case ICMP_UNREACH: 535 if (code > ICMP_UNREACH_PRECEDENCE_CUTOFF) 536 goto badcode; 537 else 538 goto deliver; 539 --- 118 unchanged lines hidden (view full) --- 658 if (ip->ip_src.s_addr == 0) { 659 if (ia->ia_ifp->if_flags & IFF_BROADCAST) 660 ip->ip_src = satosin(&ia->ia_broadaddr)->sin_addr; 661 else if (ia->ia_ifp->if_flags & IFF_POINTOPOINT) 662 ip->ip_src = satosin(&ia->ia_dstaddr)->sin_addr; 663 } 664reflect: 665 ICMPSTAT_INC(icps_reflect); | 532 code = icp->icmp_code; 533 switch (icp->icmp_type) { 534 case ICMP_UNREACH: 535 if (code > ICMP_UNREACH_PRECEDENCE_CUTOFF) 536 goto badcode; 537 else 538 goto deliver; 539 --- 118 unchanged lines hidden (view full) --- 658 if (ip->ip_src.s_addr == 0) { 659 if (ia->ia_ifp->if_flags & IFF_BROADCAST) 660 ip->ip_src = satosin(&ia->ia_broadaddr)->sin_addr; 661 else if (ia->ia_ifp->if_flags & IFF_POINTOPOINT) 662 ip->ip_src = satosin(&ia->ia_dstaddr)->sin_addr; 663 } 664reflect: 665 ICMPSTAT_INC(icps_reflect); |
666 ICMPSTAT_INC(icps_outhist[icp->icmp_type]); | 666 ICMPSTAT_INC2(icps_outhist, icp->icmp_type); |
667 icmp_reflect(m); 668 return (IPPROTO_DONE); 669 670 case ICMP_REDIRECT: 671 if (V_log_redirect) { 672 u_long src, dst, gw; 673 674 src = ntohl(ip->ip_src.s_addr); --- 531 unchanged lines hidden --- | 667 icmp_reflect(m); 668 return (IPPROTO_DONE); 669 670 case ICMP_REDIRECT: 671 if (V_log_redirect) { 672 u_long src, dst, gw; 673 674 src = ntohl(ip->ip_src.s_addr); --- 531 unchanged lines hidden --- |