/***
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 <net/ethernet.h>
#include <stdio.h>
#include <string.h>
#include <linux/if_infiniband.h>
#include <linux/if_packet.h>
#include "dhcp-internal.h"
#include "fd-util.h"
#include "socket-util.h"
const uint8_t *bcast_addr,
const struct ether_addr *eth_mac,
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, offsetof(DHCPPacket, ip.frag_off)), /* A <- Flags + Fragment offset */
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, DHCP_PORT_CLIENT, 1, 0), /* UDP destination port == DHCP client port ? */
BPF_STMT(BPF_LD + BPF_IMM, htobe32(*((unsigned int *) eth_mac))), /* A <- 4 bytes of client's MAC */
BPF_STMT(BPF_LD + BPF_W + BPF_ABS, offsetof(DHCPPacket, dhcp.chaddr)), /* A <- 4 bytes of MAC from dhcp.chaddr */
BPF_STMT(BPF_LD + BPF_IMM, htobe16(*((unsigned short *) (((char *) eth_mac) + 4)))), /* A <- remainder of client's MAC */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, offsetof(DHCPPacket, dhcp.chaddr) + 4), /* A <- remainder of MAC from dhcp.chaddr */
};
};
_cleanup_close_ int s = -1;
if (s < 0)
return -errno;
if (r < 0)
return -errno;
if (r < 0)
return -errno;
if (r < 0)
return -errno;
r = s;
s = -1;
return r;
}
/* Default broadcast address for IPoIB */
0x00, 0xff, 0xff, 0xff, 0xff, 0x12, 0x40, 0x1b,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff
};
if (arp_type == ARPHRD_ETHER) {
} else if (arp_type == ARPHRD_INFINIBAND) {
} else
return -EINVAL;
}
};
_cleanup_close_ int s = -1;
if (s < 0)
return -errno;
if (r < 0)
return -errno;
if (r < 0)
return -errno;
if (address == INADDR_ANY) {
if (r < 0)
return -errno;
if (r < 0)
return -errno;
} else {
if (r < 0)
return -errno;
}
if (r < 0)
return -errno;
r = s;
s = -1;
return r;
}
int r;
if (r < 0)
return -errno;
return 0;
}
};
int r;
assert(s >= 0);
if (r < 0)
return -errno;
return 0;
}