dhcp-network.c revision 85923f79e1d1191673c5dffa4bdf1f5aadaa415b
/***
This file is part of systemd.
Copyright (C) 2013 Intel Corporation. All rights reserved.
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <string.h>
#include <linux/if_packet.h>
#include <net/ethernet.h>
#include <stdio.h>
#include <unistd.h>
#include "socket-util.h"
#include "dhcp-internal.h"
struct sock_filter filter[] = {
/* TODO: match ip.version */
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, DHCP_PORT_CLIENT, 1, 0), /* UDP destination port == DHCP client port ? */
/* TODO: match chaddr */
};
struct sock_fprog fprog = {
};
int s, one = 1;
if (s < 0)
return -errno;
return -errno;
return -errno;
}
safe_close(s);
return -errno;
}
return s;
}
{
int s, tos = IPTOS_CLASS_CS6;
union sockaddr_union src = {
};
if (s < 0)
return -errno;
return -errno;
safe_close(s);
return -errno;
}
return s;
}
{
return -errno;
return 0;
}
{
union sockaddr_union dest = {
};
return -errno;
return 0;
}