dhcp6-option.c revision 4903a73c37d444261c0a6b362e1c27e58100ea72
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright (C) 2014 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 "sparse-endian.h"
#include "unaligned.h"
#include "util.h"
#include "dhcp6-internal.h"
#include "dhcp6-protocol.h"
#define DHCP6_OPTION_IA_NA_LEN 12
#define DHCP6_OPTION_IA_TA_LEN 4
typedef struct DHCP6Option {
} DHCP6Option;
return -ENOBUFS;
*buf += sizeof(DHCP6Option);
*buflen -= sizeof(DHCP6Option);
return 0;
}
int r;
if (r < 0)
return r;
if (optval)
return 0;
}
int r;
case DHCP6_OPTION_IA_NA:
break;
case DHCP6_OPTION_IA_TA:
break;
default:
return -EINVAL;
}
return -ENOBUFS;
*buf += sizeof(DHCP6Option);
*buflen -= sizeof(DHCP6Option);
if (r < 0)
return r;
}
if (r < 0)
return r;
return 0;
}
if (*buflen < sizeof(DHCP6Option))
return -ENOMSG;
return -ENOMSG;
*buf += 4;
*buflen -= 4;
return 0;
}
int r;
if (r < 0)
return r;
return -ENOBUFS;
return 0;
}
int r;
switch (iatype) {
case DHCP6_OPTION_IA_NA:
r = -ENOBUFS;
goto error;
}
r = -EINVAL;
goto error;
}
break;
case DHCP6_OPTION_IA_TA:
r = -ENOBUFS;
goto error;
}
ia->lifetime_t1 = 0;
ia->lifetime_t2 = 0;
break;
default:
r = -ENOMSG;
goto error;
}
*buflen -= iaaddr_offset;
*buf += iaaddr_offset;
switch (opt) {
case DHCP6_OPTION_IAADDR:
if (!addr) {
r = -ENOMEM;
goto error;
}
} else {
}
break;
case DHCP6_OPTION_STATUS_CODE:
break;
if (status) {
status);
r = -EINVAL;
goto error;
}
break;
default:
break;
}
}
if (r == -ENOMSG)
r = 0;
}
if (*buflen)
r = -ENOMSG;
*buflen = 0;
return r;
}