• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/pptpd/

Lines Matching refs:header

341 	static unsigned char buffer[PACKET_MAX + 64 /*ip header */ ];
342 struct pptp_gre_header *header;
352 /* strip off IP header, if present */
355 header = (struct pptp_gre_header *) (buffer + ip_len);
358 if (((ntoh8(header->ver) & 0x7F) != PPTP_GRE_VER) || /* version should be 1 */
359 (ntoh16(header->protocol) != PPTP_GRE_PROTO) || /* GRE protocol for PPTP */
360 PPTP_GRE_IS_C(ntoh8(header->flags)) || /* flag C should be clear */
361 PPTP_GRE_IS_R(ntoh8(header->flags)) || /* flag R should be clear */
362 (!PPTP_GRE_IS_K(ntoh8(header->flags))) || /* flag K should be set */
363 ((ntoh8(header->flags) & 0xF) != 0)) { /* routing and recursion ctrl = 0 */
365 syslog(LOG_ERR, "GRE: Discarding packet by header check");
369 if (header->call_id != GET_VALUE(PAC, gre.call_id_pair)) {
379 if (PPTP_GRE_IS_A(ntoh8(header->ver))) { /* acknowledgement present */
380 u_int32_t ack = (PPTP_GRE_IS_S(ntoh8(header->flags))) ?
381 ntoh32(header->ack) : ntoh32(header->seq);
394 if (PPTP_GRE_IS_S(ntoh8(header->flags))) { /* payload present */
395 unsigned headersize = sizeof(*header);
396 unsigned payload_len = ntoh16(header->payload_len);
397 u_int32_t seq = ntoh32(header->seq);
399 if (!PPTP_GRE_IS_A(ntoh8(header->ver)))
400 headersize -= sizeof(header->ack);
437 struct pptp_gre_header header;
450 u.header.flags = hton8(PPTP_GRE_FLAG_K);
451 u.header.ver = hton8(PPTP_GRE_VER);
452 u.header.protocol = hton16(PPTP_GRE_PROTO);
453 u.header.payload_len = hton16(len);
454 u.header.call_id = GET_VALUE(PNS, gre.call_id_pair);
459 u.header.ver |= hton8(PPTP_GRE_FLAG_A);
460 u.header.payload_len = hton16(0);
461 u.header.seq = hton32(gre.seq_recv); /* ack is in odd place because S=0 */
464 return write(fd, u.buffer, sizeof(u.header) - sizeof(u.header.ack));
469 u.header.flags |= hton8(PPTP_GRE_FLAG_S);
470 u.header.seq = hton32(gre.seq_sent);
473 u.header.ver |= hton8(PPTP_GRE_FLAG_A);
474 u.header.ack = hton32(gre.seq_recv);
476 header_len = sizeof(u.header);
478 header_len = sizeof(u.header) - sizeof(u.header.ack);
486 /* write header and buffer without copying. */