MCPcopy Create free account
hub / github.com/F-Stack/f-stack / AliasVerifyPptp

Function AliasVerifyPptp

freebsd/netinet/libalias/alias_pptp.c:436–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434}
435
436static PptpCallId
437AliasVerifyPptp(struct ip *pip, u_int16_t * ptype)
438{ /* IP packet to examine/patch */
439 int hlen, tlen, dlen;
440 PptpMsgHead hptr;
441 struct tcphdr *tc;
442
443 /* Calculate some lengths */
444 tc = (struct tcphdr *)ip_next(pip);
445 hlen = (pip->ip_hl + tc->th_off) << 2;
446 tlen = ntohs(pip->ip_len);
447 dlen = tlen - hlen;
448
449 /* Verify data length */
450 if (dlen < (int)(sizeof(struct pptpMsgHead) + sizeof(struct pptpCallIds)))
451 return (NULL);
452
453 /* Move up to PPTP message header */
454 hptr = (PptpMsgHead) tcp_next(tc);
455
456 /* Return the control message type */
457 *ptype = ntohs(hptr->type);
458
459 /* Verify PPTP Control Message */
460 if ((ntohs(hptr->msgType) != PPTP_CTRL_MSG_TYPE) ||
461 (ntohl(hptr->magic) != PPTP_MAGIC))
462 return (NULL);
463
464 /* Verify data length. */
465 if ((*ptype == PPTP_OutCallReply || *ptype == PPTP_InCallReply) &&
466 (dlen < (int)(sizeof(struct pptpMsgHead) + sizeof(struct pptpCallIds) +
467 sizeof(struct pptpCodes))))
468 return (NULL);
469 else
470 return (PptpCallId) (hptr + 1);
471}
472
473static int
474AliasHandlePptpGreOut(struct libalias *la, struct ip *pip)

Callers 2

AliasHandlePptpOutFunction · 0.85
AliasHandlePptpInFunction · 0.85

Calls 2

ip_nextFunction · 0.85
tcp_nextFunction · 0.85

Tested by

no test coverage detected