pppoe-discovery.c needs to call only the first phase of discovery.
Signed-off-by: Pali Rohár <pali@kernel.org>
}
/**********************************************************************
}
/**********************************************************************
*%ARGUMENTS:
* conn -- PPPoE connection info structure
*%RETURNS:
* Nothing
*%DESCRIPTION:
*%ARGUMENTS:
* conn -- PPPoE connection info structure
*%RETURNS:
* Nothing
*%DESCRIPTION:
-* Performs the PPPoE discovery phase
+* Performs the PPPoE discovery phase 1
***********************************************************************/
void
***********************************************************************/
void
-discovery(PPPoEConnection *conn)
+discovery1(PPPoEConnection *conn)
int timeout = conn->discoveryTimeout;
do {
int timeout = conn->discoveryTimeout;
do {
timeout *= 2;
} while (conn->discoveryState == STATE_SENT_PADI);
timeout *= 2;
} while (conn->discoveryState == STATE_SENT_PADI);
+}
+
+/**********************************************************************
+*%FUNCTION: discovery2
+*%ARGUMENTS:
+* conn -- PPPoE connection info structure
+*%RETURNS:
+* Nothing
+*%DESCRIPTION:
+* Performs the PPPoE discovery phase 2
+***********************************************************************/
+void
+discovery2(PPPoEConnection *conn)
+{
+ int padrAttempts = 0;
+ int timeout = conn->discoveryTimeout;
- timeout = conn->discoveryTimeout;
do {
padrAttempts++;
if (got_sigterm || padrAttempts > conn->discoveryAttempts) {
do {
padrAttempts++;
if (got_sigterm || padrAttempts > conn->discoveryAttempts) {
error("Failed to create PPPoE discovery socket: %m");
goto errout;
}
error("Failed to create PPPoE discovery socket: %m");
goto errout;
}
+ discovery1(conn);
+ if (conn->discoveryState != STATE_RECEIVED_PADO) {
+ error("Unable to complete PPPoE Discovery phase 1");
+ goto errout;
+ }
+ discovery2(conn);
if (conn->discoveryState != STATE_SESSION) {
if (conn->discoveryState != STATE_SESSION) {
- error("Unable to complete PPPoE Discovery");
+ error("Unable to complete PPPoE Discovery phase 2");
void clampMSS(PPPoEPacket *packet, char const *dir, int clampMss);
UINT16_t computeTCPChecksum(unsigned char *ipHdr, unsigned char *tcpHdr);
UINT16_t pppFCS16(UINT16_t fcs, unsigned char *cp, int len);
void clampMSS(PPPoEPacket *packet, char const *dir, int clampMss);
UINT16_t computeTCPChecksum(unsigned char *ipHdr, unsigned char *tcpHdr);
UINT16_t pppFCS16(UINT16_t fcs, unsigned char *cp, int len);
-void discovery(PPPoEConnection *conn);
+void discovery1(PPPoEConnection *conn);
+void discovery2(PPPoEConnection *conn);
unsigned char *findTag(PPPoEPacket *packet, UINT16_t tagType,
PPPoETag *tag);
unsigned char *findTag(PPPoEPacket *packet, UINT16_t tagType,
PPPoETag *tag);