Changeset 87398 in vbox for trunk/src/VBox/NetworkServices/NAT
- Timestamp:
- Jan 23, 2021 1:11:06 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
r87397 r87398 922 922 923 923 924 /*static*/ err_t VBoxNetLwipNAT::netifLinkoutput(netif *pNetif, pbuf *pPBuf) RT_NOTHROW_DEF925 {926 AssertPtrReturn(pNetif, ERR_ARG);927 AssertPtrReturn(pPBuf, ERR_ARG);928 929 VBoxNetLwipNAT *self = static_cast<VBoxNetLwipNAT *>(pNetif->state);930 AssertPtrReturn(self, ERR_IF);931 AssertReturn(self == g_pLwipNat, ERR_ARG);932 933 LogFlowFunc(("ENTER: pNetif[%c%c%d], pPbuf:%p\n",934 pNetif->name[0],935 pNetif->name[1],936 pNetif->num,937 pPBuf));938 939 RT_ZERO(VBoxNetLwipNAT::aXmitSeg);940 941 size_t idx = 0;942 for (struct pbuf *q = pPBuf; q != NULL; q = q->next, ++idx)943 {944 AssertReturn(idx < RT_ELEMENTS(VBoxNetLwipNAT::aXmitSeg), ERR_MEM);945 946 #if ETH_PAD_SIZE947 if (q == pPBuf)948 {949 VBoxNetLwipNAT::aXmitSeg[idx].pv = (uint8_t *)q->payload + ETH_PAD_SIZE;950 VBoxNetLwipNAT::aXmitSeg[idx].cb = q->len - ETH_PAD_SIZE;951 }952 else953 #endif954 {955 VBoxNetLwipNAT::aXmitSeg[idx].pv = q->payload;956 VBoxNetLwipNAT::aXmitSeg[idx].cb = q->len;957 }958 }959 960 int rc = self->sendBufferOnWire(VBoxNetLwipNAT::aXmitSeg, idx,961 pPBuf->tot_len - ETH_PAD_SIZE);962 AssertRCReturn(rc, ERR_IF);963 964 self->flushWire();965 966 LogFlowFunc(("LEAVE: %d\n", ERR_OK));967 return ERR_OK;968 }969 970 971 924 /*static*/ int VBoxNetLwipNAT::natServicePfRegister(NATSERVICEPORTFORWARDRULE& natPf) 972 925 { … … 1089 1042 1090 1043 1044 /** 1045 * Process an incoming frame received from the intnet. 1046 */ 1091 1047 int VBoxNetLwipNAT::processFrame(void *pvFrame, size_t cbFrame) 1092 1048 { … … 1128 1084 1129 1085 1086 /** 1087 * Process an incoming GSO frame received from the intnet. 1088 */ 1130 1089 int VBoxNetLwipNAT::processGSO(PCPDMNETWORKGSO pGso, size_t cbFrame) 1131 1090 { … … 1156 1115 1157 1116 return VINF_SUCCESS; 1117 } 1118 1119 1120 /** 1121 * Send an outgoing frame from lwIP to intnet. 1122 */ 1123 /* static */ 1124 err_t VBoxNetLwipNAT::netifLinkoutput(netif *pNetif, pbuf *pPBuf) RT_NOTHROW_DEF 1125 { 1126 AssertPtrReturn(pNetif, ERR_ARG); 1127 AssertPtrReturn(pPBuf, ERR_ARG); 1128 1129 VBoxNetLwipNAT *self = static_cast<VBoxNetLwipNAT *>(pNetif->state); 1130 AssertPtrReturn(self, ERR_IF); 1131 AssertReturn(pNetif == &self->m_LwipNetIf, ERR_IF); 1132 1133 LogFlowFunc(("ENTER: pNetif[%c%c%d], pPbuf:%p\n", 1134 pNetif->name[0], 1135 pNetif->name[1], 1136 pNetif->num, 1137 pPBuf)); 1138 1139 RT_ZERO(VBoxNetLwipNAT::aXmitSeg); 1140 1141 size_t idx = 0; 1142 for (struct pbuf *q = pPBuf; q != NULL; q = q->next, ++idx) 1143 { 1144 AssertReturn(idx < RT_ELEMENTS(VBoxNetLwipNAT::aXmitSeg), ERR_MEM); 1145 1146 #if ETH_PAD_SIZE 1147 if (q == pPBuf) 1148 { 1149 VBoxNetLwipNAT::aXmitSeg[idx].pv = (uint8_t *)q->payload + ETH_PAD_SIZE; 1150 VBoxNetLwipNAT::aXmitSeg[idx].cb = q->len - ETH_PAD_SIZE; 1151 } 1152 else 1153 #endif 1154 { 1155 VBoxNetLwipNAT::aXmitSeg[idx].pv = q->payload; 1156 VBoxNetLwipNAT::aXmitSeg[idx].cb = q->len; 1157 } 1158 } 1159 1160 int rc = self->sendBufferOnWire(VBoxNetLwipNAT::aXmitSeg, idx, 1161 pPBuf->tot_len - ETH_PAD_SIZE); 1162 AssertRCReturn(rc, ERR_IF); 1163 1164 self->flushWire(); 1165 1166 LogFlowFunc(("LEAVE: %d\n", ERR_OK)); 1167 return ERR_OK; 1158 1168 } 1159 1169
Note:
See TracChangeset
for help on using the changeset viewer.