Advertisement
adeep

if_ethersubr patch

Jan 13th, 2012
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. # cat if_ethersubr.c.patch
  2. *** if_ethersubr.c Fri Jan 13 09:52:49 2012
  3. --- if_ethersubr.c_ Sun Oct 30 19:40:28 2011
  4. ***************
  5. *** 622,627 ****
  6. --- 622,633 ----
  7. ifp->if_imcasts++;
  8. }
  9.  
  10. + m->m_flags |= M_FLOWID;
  11. + m->m_pkthdr.flowid = eh->ether_dhost[0] + eh->ether_dhost[1] + eh->ether_dhost[2] + eh->ether_dhost[3] + eh->ether_dhost[4] + eh->ether_dhost[5];
  12. + m->m_pkthdr.flowid += eh->ether_shost[0] + eh->ether_shost[1] + eh->ether_shost[2] + eh->ether_shost[3] + eh->ether_shost[4] + eh->ether_shost[5];
  13. +
  14. +
  15. +
  16. #ifdef MAC
  17. /*
  18. * Tag the mbuf with an appropriate MAC label before any other
  19. ***************
  20. *** 873,878 ****
  21. --- 879,908 ----
  22. if ((m = ip_fastforward(m)) == NULL)
  23. return;
  24. isr = NETISR_IP;
  25. +
  26. + struct ipheader {
  27. + u_char offset [12]; //ip header fields not actually needed here
  28. + u_char src [4]; //ip src
  29. + u_char dst [4]; //ip dst
  30. + } __packed __aligned(4);
  31. +
  32. + if (m->m_pkthdr.len < sizeof(struct ipheader)) { //from ip_fastforward
  33. + if_printf(ifp, "flowid math: discard frame with too small header\n");
  34. + goto discard;
  35. + }
  36. + if (m->m_len < sizeof (struct ipheader) &&
  37. + (m = m_pullup(m, sizeof (struct ipheader))) == NULL) { //ip_fastforward
  38. + if_printf(ifp, "flowid math: discard frame at pullup\n");
  39. + return; /* mbuf already free'd */
  40. + }
  41. + struct ipheader *ip;
  42. + ip = mtod(m, struct ipheader *);
  43. + m->m_pkthdr.flowid += ip->src[0] + ip->src[1] + ip->src[2] + ip->src[3];
  44. + m->m_pkthdr.flowid += ip->dst[0] + ip->dst[1] + ip->dst[2] + ip->dst[3];
  45. +
  46. + //if_printf(ifp, "Calculated flow id %d\n", m->m_pkthdr.flowid);
  47. +
  48. +
  49. break;
  50.  
  51. case ETHERTYPE_ARP:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement