Esempio n. 1
0
/*-#+func----------------------------------------------------------
    FUNCTION: ntoharp()
     PURPOSE: Convert an incoming ARP packet into a host-format structure
      SYNTAX: int ntoharp(struct arp *arp, MBUF *buf);
 DESCRIPTION:
     RETURNS: Always 0
     HISTORY: 940306 V0.1
--#-func----------------------------------------------------------*/
int ntoharp(struct arp *arp, MBUF *buf)
{
	arp->hardware = pull16(buf);
	arp->protocol = pull16(buf);
	arp->hwalen   = pull8(buf);
	arp->pralen   = pull8(buf);
	arp->opcode   = pull16(buf);
	buf2data(arp->shwaddr,buf,(int16)uchar(arp->hwalen));
	arp->sprotaddr = pull32(buf);
	buf2data(arp->thwaddr,buf,(int16)uchar(arp->hwalen));
	arp->tprotaddr = pull32(buf);

	return 0;
}
Esempio n. 2
0
/* Process remote command */
static void
uremote(
    struct iface *iface,
    struct udp_cb *up,
    int cnt)
{

    struct mbuf *bp;
    struct socket fsock;
    char command;
    int32 addr;

    recv_udp(up,&fsock,&bp);
    command = PULLCHAR(&bp);
    switch(command & 0xff) {
    case SYS__EXIT:
        if(chkrpass(bp) == 0) {
            logmsg(NULL,"%s - Remote exit PASSWORD FAIL",
                   pinet_udp(&fsock));
        } else {
            logmsg(NULL,"%s - Remote exit PASSWORD OK",
                   pinet_udp(&fsock));
            main_exit = 1;
        }
        break;
    case KICK__ME:
        if(len_p(bp) >= sizeof(int32))
            addr = pull32(&bp);
        else
            addr = fsock.address;
        kick(addr);
        /*** smtptick((void *)addr); ***/
        break;
    }
    free_p(&bp);
}