Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 139179 | Differences between
and this patch

Collapse All | Expand All

(-)dhcpcd-2.0.5/src/arp.c (-2 lines)
Lines 59-65 Link Here
59
59
60
const int inaddr_broadcast = INADDR_BROADCAST;
60
const int inaddr_broadcast = INADDR_BROADCAST;
61
/*****************************************************************************/
61
/*****************************************************************************/
62
#ifdef ARPCHECK
63
int arpCheck()
62
int arpCheck()
64
{
63
{
65
  arpMessage ArpMsgSend,ArpMsgRecv;
64
  arpMessage ArpMsgSend,ArpMsgRecv;
Lines 159-165 Link Here
159
  while ( 1 );
158
  while ( 1 );
160
  return 0;
159
  return 0;
161
}
160
}
162
#endif
163
/*****************************************************************************/
161
/*****************************************************************************/
164
int arpRelease()  /* sends UNARP message, cf. RFC1868 */
162
int arpRelease()  /* sends UNARP message, cf. RFC1868 */
165
{
163
{
(-)dhcpcd-2.0.5/src/buildmsg.c (-2 lines)
Lines 576-582 Link Here
576
  sizeof(dhcpMessage));
576
  sizeof(dhcpMessage));
577
}
577
}
578
/*****************************************************************************/
578
/*****************************************************************************/
579
#ifdef ARPCHECK
580
void buildDhcpDecline(xid)
579
void buildDhcpDecline(xid)
581
unsigned xid;
580
unsigned xid;
582
{
581
{
Lines 620-626 Link Here
620
  DhcpIface.siaddr,htons(DHCP_CLIENT_PORT),htons(DHCP_SERVER_PORT),
619
  DhcpIface.siaddr,htons(DHCP_CLIENT_PORT),htons(DHCP_SERVER_PORT),
621
  sizeof(dhcpMessage));
620
  sizeof(dhcpMessage));
622
}
621
}
623
#endif
624
/*****************************************************************************/
622
/*****************************************************************************/
625
void buildDhcpInform(xid)
623
void buildDhcpInform(xid)
626
unsigned xid;
624
unsigned xid;
(-)dhcpcd-2.0.5/src/client.c (-40 / +42 lines)
Lines 75-80 Link Here
75
extern	int		InitialHostName_len,InitialDomainName_len;
75
extern	int		InitialHostName_len,InitialDomainName_len;
76
extern	char		*InitialHostName,*InitialDomainName;
76
extern	char		*InitialHostName,*InitialDomainName;
77
extern	int		DownIfaceOnStop;
77
extern	int		DownIfaceOnStop;
78
extern  int		DoARP;
78
79
79
extern	char		resolv_file[128];
80
extern	char		resolv_file[128];
80
extern	char		resolv_file_sv[128];
81
extern	char		resolv_file_sv[128];
Lines 90-98 Link Here
90
91
91
extern	int		SetFQDNHostName;
92
extern	int		SetFQDNHostName;
92
93
93
#ifdef ARPCHECK
94
int     arpCheck();
94
int arpCheck();
95
#endif
96
int	arpRelease();
95
int	arpRelease();
97
int	dhcpConfig();
96
int	dhcpConfig();
98
int	readDhcpCache();
97
int	readDhcpCache();
Lines 1088-1114 Link Here
1088
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[1],
1085
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[1],
1089
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[2],
1086
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[2],
1090
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[3]);
1087
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[3]);
1091
#ifdef ARPCHECK
1092
/* check if the offered IP address already in use */
1088
/* check if the offered IP address already in use */
1093
  if ( arpCheck() )
1089
  if ( DoARP )
1094
    {
1090
    {
1095
      logger(LOG_ERR,
1091
      if ( arpCheck() )
1096
	"requested %u.%u.%u.%u address is in use",
1092
        {
1097
	((unsigned char *)&DhcpIface.ciaddr)[0],
1093
          logger(LOG_ERR,
1098
	((unsigned char *)&DhcpIface.ciaddr)[1],
1094
	    "requested %u.%u.%u.%u address is in use",
1099
	((unsigned char *)&DhcpIface.ciaddr)[2],
1095
	    ((unsigned char *)&DhcpIface.ciaddr)[0],
1100
	((unsigned char *)&DhcpIface.ciaddr)[3]);
1096
	    ((unsigned char *)&DhcpIface.ciaddr)[1],
1101
      dhcpDecline();
1097
	    ((unsigned char *)&DhcpIface.ciaddr)[2],
1102
      DhcpIface.ciaddr = 0;
1098
	    ((unsigned char *)&DhcpIface.ciaddr)[3]);
1103
      return &dhcpInit;
1099
          dhcpDecline();
1100
          DhcpIface.ciaddr = 0;
1101
          return &dhcpInit;
1102
        }
1103
      logger(LOG_INFO,
1104
        "verified %u.%u.%u.%u address is not in use",
1105
        ((unsigned char *)&DhcpIface.ciaddr)[0],
1106
        ((unsigned char *)&DhcpIface.ciaddr)[1],
1107
        ((unsigned char *)&DhcpIface.ciaddr)[2],
1108
        ((unsigned char *)&DhcpIface.ciaddr)[3]);
1104
    }
1109
    }
1105
  logger(LOG_INFO,
1106
    "verified %u.%u.%u.%u address is not in use",
1107
    ((unsigned char *)&DhcpIface.ciaddr)[0],
1108
    ((unsigned char *)&DhcpIface.ciaddr)[1],
1109
    ((unsigned char *)&DhcpIface.ciaddr)[2],
1110
    ((unsigned char *)&DhcpIface.ciaddr)[3]);
1111
#endif
1112
  if ( dhcpConfig() )
1110
  if ( dhcpConfig() )
1113
    {
1111
    {
1114
      dhcpStop();
1112
      dhcpStop();
Lines 1169-1174 Link Here
1169
	  if (FD_ISSET(dhcpSocket, &rset))
1167
	  if (FD_ISSET(dhcpSocket, &rset))
1170
	    while (recvfrom(dhcpSocket,(void *)foobuf,sizeof(foobuf),0,NULL,NULL) != -1 );
1168
	    while (recvfrom(dhcpSocket,(void *)foobuf,sizeof(foobuf),0,NULL,NULL) != -1 );
1171
	}
1169
	}
1170
1171
      /* Sleep for 2 seconds so we don't gobble CPU time */
1172
      sleep(2);
1172
    }
1173
    }
1173
}
1174
}
1174
/*****************************************************************************/
1175
/*****************************************************************************/
Lines 1333-1339 Link Here
1333
  return &dhcpStart;
1332
  return &dhcpStart;
1334
}
1333
}
1335
/*****************************************************************************/
1334
/*****************************************************************************/
1336
#ifdef ARPCHECK
1337
void *dhcpDecline()
1335
void *dhcpDecline()
1338
{
1336
{
1339
  struct sockaddr addr;
1337
  struct sockaddr addr;
Lines 1353-1359 Link Here
1353
    logger(LOG_ERR,"dhcpDecline: sendto: %s",strerror(errno));
1351
    logger(LOG_ERR,"dhcpDecline: sendto: %s",strerror(errno));
1354
  return &dhcpInit;
1352
  return &dhcpInit;
1355
}
1353
}
1356
#endif
1357
/*****************************************************************************/
1354
/*****************************************************************************/
1358
void *dhcpInform()
1355
void *dhcpInform()
1359
{
1356
{
Lines 1422-1447 Link Here
1422
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[1],
1419
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[1],
1423
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[2],
1420
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[2],
1424
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[3]);
1421
    ((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[3]);
1425
#ifdef ARPCHECK
1426
/* check if the offered IP address already in use */
1422
/* check if the offered IP address already in use */
1427
  if ( arpCheck() )
1423
  if ( DoARP )
1428
    {
1424
    {
1429
      logger(LOG_ERR,
1425
      if ( arpCheck() )
1430
	"requested %u.%u.%u.%u address is in use",
1426
        {
1431
	((unsigned char *)&DhcpIface.ciaddr)[0],
1427
          logger(LOG_ERR,
1432
	((unsigned char *)&DhcpIface.ciaddr)[1],
1428
	    "requested %u.%u.%u.%u address is in use",
1433
	((unsigned char *)&DhcpIface.ciaddr)[2],
1429
	    ((unsigned char *)&DhcpIface.ciaddr)[0],
1434
	((unsigned char *)&DhcpIface.ciaddr)[3]);
1430
	    ((unsigned char *)&DhcpIface.ciaddr)[1],
1435
      dhcpDecline();
1431
	    ((unsigned char *)&DhcpIface.ciaddr)[2],
1436
      return 0;
1432
	    ((unsigned char *)&DhcpIface.ciaddr)[3]);
1433
          dhcpDecline();
1434
          return 0;
1435
        }
1436
      logger(LOG_INFO,
1437
        "verified %u.%u.%u.%u address is not in use",
1438
        ((unsigned char *)&DhcpIface.ciaddr)[0],
1439
        ((unsigned char *)&DhcpIface.ciaddr)[1],
1440
        ((unsigned char *)&DhcpIface.ciaddr)[2],
1441
        ((unsigned char *)&DhcpIface.ciaddr)[3]);
1437
    }
1442
    }
1438
  logger(LOG_INFO,
1439
    "verified %u.%u.%u.%u address is not in use",
1440
    ((unsigned char *)&DhcpIface.ciaddr)[0],
1441
    ((unsigned char *)&DhcpIface.ciaddr)[1],
1442
    ((unsigned char *)&DhcpIface.ciaddr)[2],
1443
    ((unsigned char *)&DhcpIface.ciaddr)[3]);
1444
#endif
1445
  if ( dhcpConfig() ) return 0;
1443
  if ( dhcpConfig() ) return 0;
1446
  exit(0);
1444
  exit(0);
1447
}
1445
}
(-)dhcpcd-2.0.5/src/client.h (-2 lines)
Lines 217-224 Link Here
217
void *dhcpRelease();
217
void *dhcpRelease();
218
void *dhcpStop();
218
void *dhcpStop();
219
void *dhcpInform();
219
void *dhcpInform();
220
#ifdef ARPCHECK
221
void *dhcpDecline();
220
void *dhcpDecline();
222
#endif
223
221
224
#endif
222
#endif
(-)dhcpcd-2.0.5/src/dhcpcd.c (+5 lines)
Lines 77-82 Link Here
77
int		SetDHCPDefaultRoutes=	1;
77
int		SetDHCPDefaultRoutes=	1;
78
int		Persistent	=	0;
78
int		Persistent	=	0;
79
int		DownIfaceOnStop	=	1;
79
int		DownIfaceOnStop	=	1;
80
int		DoARP		=	1;
80
81
81
#if 0
82
#if 0
82
unsigned char	ClientMACaddr[ETH_ALEN];
83
unsigned char	ClientMACaddr[ETH_ALEN];
Lines 158-163 Link Here
158
	    i++;
159
	    i++;
159
	    s=1;
160
	    s=1;
160
	    break;
161
	    break;
162
	  case 'a':
163
	    s++;
164
	    DoARP = 0;
165
	    goto prgs;
161
	  case 'p':
166
	  case 'p':
162
	    s++;
167
	    s++;
163
	    Persistent = 1;
168
	    Persistent = 1;

Return to bug 139179