mld6.c (a61b5cfbbfd54c51c9ba6cc9aa19907911fb3aa9) | mld6.c (32af08ecad3fe435ee646791e345526b5bcb7795) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2009 Bruce Simpson. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 1235 unchanged lines hidden (view full) --- 1244 * have been pulled up. 1245 * Assume that userland will want to see the message, even if it 1246 * otherwise fails kernel input validation; do not free it. 1247 * Pullup may however free the mbuf chain m if it fails. 1248 * 1249 * Return IPPROTO_DONE if we freed m. Otherwise, return 0. 1250 */ 1251int | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2009 Bruce Simpson. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 1235 unchanged lines hidden (view full) --- 1244 * have been pulled up. 1245 * Assume that userland will want to see the message, even if it 1246 * otherwise fails kernel input validation; do not free it. 1247 * Pullup may however free the mbuf chain m if it fails. 1248 * 1249 * Return IPPROTO_DONE if we freed m. Otherwise, return 0. 1250 */ 1251int |
1252mld_input(struct mbuf *m, int off, int icmp6len) | 1252mld_input(struct mbuf **mp, int off, int icmp6len) |
1253{ 1254 struct ifnet *ifp; 1255 struct ip6_hdr *ip6; | 1253{ 1254 struct ifnet *ifp; 1255 struct ip6_hdr *ip6; |
1256 struct mbuf *m; |
|
1256 struct mld_hdr *mld; 1257 int mldlen; 1258 | 1257 struct mld_hdr *mld; 1258 int mldlen; 1259 |
1260 m = *mp; |
|
1259 CTR3(KTR_MLD, "%s: called w/mbuf (%p,%d)", __func__, m, off); 1260 1261 ifp = m->m_pkthdr.rcvif; 1262 1263 /* Pullup to appropriate size. */ 1264 m = m_pullup(m, off + sizeof(*mld)); 1265 if (m == NULL) { 1266 ICMP6STAT_INC(icp6s_badlen); --- 6 unchanged lines hidden (view full) --- 1273 } else { 1274 mldlen = sizeof(struct mld_hdr); 1275 } 1276 m = m_pullup(m, off + mldlen); 1277 if (m == NULL) { 1278 ICMP6STAT_INC(icp6s_badlen); 1279 return (IPPROTO_DONE); 1280 } | 1261 CTR3(KTR_MLD, "%s: called w/mbuf (%p,%d)", __func__, m, off); 1262 1263 ifp = m->m_pkthdr.rcvif; 1264 1265 /* Pullup to appropriate size. */ 1266 m = m_pullup(m, off + sizeof(*mld)); 1267 if (m == NULL) { 1268 ICMP6STAT_INC(icp6s_badlen); --- 6 unchanged lines hidden (view full) --- 1275 } else { 1276 mldlen = sizeof(struct mld_hdr); 1277 } 1278 m = m_pullup(m, off + mldlen); 1279 if (m == NULL) { 1280 ICMP6STAT_INC(icp6s_badlen); 1281 return (IPPROTO_DONE); 1282 } |
1283 *mp = m; |
|
1281 ip6 = mtod(m, struct ip6_hdr *); 1282 mld = (struct mld_hdr *)(mtod(m, uint8_t *) + off); 1283 1284 /* 1285 * Userland needs to see all of this traffic for implementing 1286 * the endpoint discovery portion of multicast routing. 1287 */ 1288 switch (mld->mld_type) { --- 2046 unchanged lines hidden --- | 1284 ip6 = mtod(m, struct ip6_hdr *); 1285 mld = (struct mld_hdr *)(mtod(m, uint8_t *) + off); 1286 1287 /* 1288 * Userland needs to see all of this traffic for implementing 1289 * the endpoint discovery portion of multicast routing. 1290 */ 1291 switch (mld->mld_type) { --- 2046 unchanged lines hidden --- |